fix: Remove all trailing whitespace from code_analyzer.py
- Use sed to remove trailing whitespace from all lines - Fixes all remaining ruff W293 errors - This is a comprehensive fix to prevent further whitespace issues Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1583,7 +1583,7 @@ class CodeAnalyzer:
|
|||||||
"name": name,
|
"name": name,
|
||||||
"type": var_type
|
"type": var_type
|
||||||
})
|
})
|
||||||
|
|
||||||
# Extract functions
|
# Extract functions
|
||||||
for match in re.finditer(r'void\s+(\w+)\s*\(([^)]*)\)', content):
|
for match in re.finditer(r'void\s+(\w+)\s*\(([^)]*)\)', content):
|
||||||
func_name, params = match.groups()
|
func_name, params = match.groups()
|
||||||
@@ -1591,7 +1591,7 @@ class CodeAnalyzer:
|
|||||||
"name": func_name,
|
"name": func_name,
|
||||||
"parameters": params.strip() if params else ""
|
"parameters": params.strip() if params else ""
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"file": file_path,
|
"file": file_path,
|
||||||
"shader_type": shader_type,
|
"shader_type": shader_type,
|
||||||
@@ -1607,7 +1607,7 @@ class CodeAnalyzer:
|
|||||||
def _analyze_gdscript(self, content: str, file_path: str) -> dict[str, Any]:
|
def _analyze_gdscript(self, content: str, file_path: str) -> dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Analyze GDScript file using regex (Godot-specific syntax).
|
Analyze GDScript file using regex (Godot-specific syntax).
|
||||||
|
|
||||||
GDScript has Python-like syntax but with Godot-specific keywords:
|
GDScript has Python-like syntax but with Godot-specific keywords:
|
||||||
- class_name MyClass extends Node
|
- class_name MyClass extends Node
|
||||||
- func _ready(): (functions)
|
- func _ready(): (functions)
|
||||||
@@ -1619,7 +1619,7 @@ class CodeAnalyzer:
|
|||||||
functions = []
|
functions = []
|
||||||
signals = []
|
signals = []
|
||||||
exports = []
|
exports = []
|
||||||
|
|
||||||
# Extract class definition
|
# Extract class definition
|
||||||
class_match = re.search(r'class_name\s+(\w+)(?:\s+extends\s+(\w+))?', content)
|
class_match = re.search(r'class_name\s+(\w+)(?:\s+extends\s+(\w+))?', content)
|
||||||
if class_match:
|
if class_match:
|
||||||
@@ -1631,11 +1631,11 @@ class CodeAnalyzer:
|
|||||||
"methods": [],
|
"methods": [],
|
||||||
"line_number": content[: class_match.start()].count("\n") + 1
|
"line_number": content[: class_match.start()].count("\n") + 1
|
||||||
})
|
})
|
||||||
|
|
||||||
# Extract functions
|
# Extract functions
|
||||||
for match in re.finditer(r'func\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*(\w+))?:', content):
|
for match in re.finditer(r'func\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*(\w+))?:', content):
|
||||||
func_name, params, return_type = match.groups()
|
func_name, params, return_type = match.groups()
|
||||||
|
|
||||||
# Parse parameters
|
# Parse parameters
|
||||||
param_list = []
|
param_list = []
|
||||||
if params.strip():
|
if params.strip():
|
||||||
@@ -1646,10 +1646,10 @@ class CodeAnalyzer:
|
|||||||
parts = param.split(':')
|
parts = param.split(':')
|
||||||
name = parts[0].strip()
|
name = parts[0].strip()
|
||||||
type_and_default = parts[1].strip()
|
type_and_default = parts[1].strip()
|
||||||
|
|
||||||
param_type = type_and_default.split('=')[0].strip() if '=' in type_and_default else type_and_default
|
param_type = type_and_default.split('=')[0].strip() if '=' in type_and_default else type_and_default
|
||||||
default = type_and_default.split('=')[1].strip() if '=' in type_and_default else None
|
default = type_and_default.split('=')[1].strip() if '=' in type_and_default else None
|
||||||
|
|
||||||
param_list.append({
|
param_list.append({
|
||||||
"name": name,
|
"name": name,
|
||||||
"type_hint": param_type,
|
"type_hint": param_type,
|
||||||
@@ -1661,14 +1661,14 @@ class CodeAnalyzer:
|
|||||||
"type_hint": None,
|
"type_hint": None,
|
||||||
"default": None
|
"default": None
|
||||||
})
|
})
|
||||||
|
|
||||||
functions.append({
|
functions.append({
|
||||||
"name": func_name,
|
"name": func_name,
|
||||||
"parameters": param_list,
|
"parameters": param_list,
|
||||||
"return_type": return_type,
|
"return_type": return_type,
|
||||||
"line_number": content[: match.start()].count("\n") + 1
|
"line_number": content[: match.start()].count("\n") + 1
|
||||||
})
|
})
|
||||||
|
|
||||||
# Extract signals with documentation
|
# Extract signals with documentation
|
||||||
signal_connections = []
|
signal_connections = []
|
||||||
signal_emissions = []
|
signal_emissions = []
|
||||||
|
|||||||
Reference in New Issue
Block a user