diff --git a/examples/cyclomatic_complexity/run.py b/examples/cyclomatic_complexity/run.py index 2aa2cba..0b5943a 100644 --- a/examples/cyclomatic_complexity/run.py +++ b/examples/cyclomatic_complexity/run.py @@ -1,5 +1,6 @@ import codegen from codegen import Codebase +from codegen.sdk.enums import ProgrammingLanguage from codegen.sdk.core.statements.for_loop_statement import ForLoopStatement from codegen.sdk.core.statements.if_block_statement import IfBlockStatement from codegen.sdk.core.statements.try_catch_statement import TryCatchStatement @@ -81,7 +82,7 @@ def calculate_cyclomatic_complexity(code_block): if __name__ == "__main__": print("🔍 Analyzing codebase...") - codebase = Codebase.from_repo("fastapi/fastapi", commit="887270ff8a54bb58c406b0651678a27589793d2f") + codebase = Codebase.from_repo("fastapi/fastapi", commit="887270ff8a54bb58c406b0651678a27589793d2f", programming_language=ProgrammingLanguage.PYTHON) print("Running analysis...") run(codebase) diff --git a/examples/document_functions/README.md b/examples/document_functions/README.md index ffa11ce..572cca9 100644 --- a/examples/document_functions/README.md +++ b/examples/document_functions/README.md @@ -43,15 +43,17 @@ def hop_through_imports(imp: Import) -> Symbol | ExternalModule: return imp.imported_symbol ``` -## Usage +## Running the Conversion -1. Run the script on a target repository: -```python -codebase = Codebase.from_repo("your/repo", commit="commit_hash") -run(codebase) +```bash +# Install Codegen +pip install codegen + +# Run the conversion +python run.py ``` -2. The script will: +The script will: - Process each function in the codebase - Skip functions that already have docstrings - Generate contextually aware docstrings for undocumented functions @@ -81,4 +83,13 @@ The script provides detailed progress information: - Documenting legacy codebases - Maintaining documentation standards in large projects - Onboarding new team members with better code documentation -- Preparing codebases for public release \ No newline at end of file +- Preparing codebases for public release + +## Learn More + +- [Creating Documentation](https://docs.codegen.com/tutorials/creating-documentation#creating-documentation) +- [Codegen Documentation](https://docs.codegen.com) + +## Contributing + +Feel free to submit issues and enhancement requests!