Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,14 @@ from mccabe import get_code_complexity
|
|
| 16 |
|
| 17 |
@tool
|
| 18 |
def analyze_code_complexity(code: str) -> list:
|
| 19 |
-
"""Analyzes the cyclomatic complexity of functions in the code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
tree = ast.parse(code)
|
| 21 |
issues = []
|
| 22 |
|
|
@@ -30,7 +37,15 @@ def analyze_code_complexity(code: str) -> list:
|
|
| 30 |
|
| 31 |
@tool
|
| 32 |
def detect_code_issues(code: str) -> list:
|
| 33 |
-
"""Analyzes Python code for issues
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
issues = []
|
| 35 |
|
| 36 |
# Check for syntax errors
|
|
|
|
| 16 |
|
| 17 |
@tool
|
| 18 |
def analyze_code_complexity(code: str) -> list:
|
| 19 |
+
"""Analyzes the cyclomatic complexity of functions in the given code.
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
code (str): The Python source code as a string.
|
| 23 |
+
|
| 24 |
+
Returns:
|
| 25 |
+
list: A list of warnings if any function has high complexity.
|
| 26 |
+
"""
|
| 27 |
tree = ast.parse(code)
|
| 28 |
issues = []
|
| 29 |
|
|
|
|
| 37 |
|
| 38 |
@tool
|
| 39 |
def detect_code_issues(code: str) -> list:
|
| 40 |
+
"""Analyzes Python code for issues including syntax errors, style violations,
|
| 41 |
+
undefined variables, unused imports, and function complexity.
|
| 42 |
+
|
| 43 |
+
Args:
|
| 44 |
+
code (str): The Python source code to analyze.
|
| 45 |
+
|
| 46 |
+
Returns:
|
| 47 |
+
list: A list of detected issues in the code.
|
| 48 |
+
"""
|
| 49 |
issues = []
|
| 50 |
|
| 51 |
# Check for syntax errors
|