feat: optimize code quality with pylint analysis and critical fixes - Issue #130
Some checks failed
Test Suite / code-quality (push) Has been cancelled
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled

- Fixed critical CLI function redefinition (E0102): renamed duplicate list() to list_paradigms()
- Fixed CLI parameter passing errors (E1120): updated main() calls with standalone_mode=False
- Removed 20+ unused imports across 6 files (W0611 optimization)
- Added missing final newlines to 10 files (C0304 compliance)
- Optimized control flow patterns: removed unnecessary else-after-return
- Enhanced string comparisons using 'in' operator for better readability
- Maintained pylint score at 8.34/10 while eliminating critical runtime risks

Created follow-up Issue #131 for remaining optimizations:
- 200 broad exception handling instances
- 106 variable shadowing cases
- 278 import organization improvements
- 391 line length standardizations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-06 03:03:38 +02:00
parent 1d86bf1bbd
commit 8d4a73b6e3
12 changed files with 144 additions and 28 deletions

View File

@@ -8,16 +8,15 @@ document analysis and plan-actual comparison capabilities.
import json
from pathlib import Path
from typing import Dict, Any, Union
from typing import Dict, Any
try:
import jsonschema
from jsonschema import validate, ValidationError, SchemaError
from jsonschema import SchemaError
JSONSCHEMA_AVAILABLE = True
except ImportError:
# Fallback to basic validation without full JSON Schema validation
JSONSCHEMA_AVAILABLE = False
ValidationError = Exception
SchemaError = Exception
from .parser import parse_markdown_to_ast
@@ -72,9 +71,9 @@ class SchemaValidator:
if self._has_heading_text_constraints(schema):
# For heading text validation, we need to extract actual content and compare against enum constraints
return self._validate_with_heading_text_constraints(file_path, schema, document_schema)
else:
# Use standard structure comparison for backward compatibility
return self._compare_structures(document_schema, schema)
# Use standard structure comparison for backward compatibility
return self._compare_structures(document_schema, schema)
def validate_file_against_schema_string(self, file_path: Path, schema_json: str) -> bool:
"""
@@ -620,7 +619,6 @@ class SchemaValidator:
expected_headings = expected_schema.get('properties', {}).get('headings', {}).get('properties', {})
# Generate document analysis with actual heading content
from .parser import parse_markdown_to_ast
content = file_path.read_text(encoding='utf-8')
ast_tokens = parse_markdown_to_ast(content)
structure_analysis = self.schema_generator._analyze_ast_structure(ast_tokens, None)
@@ -656,7 +654,6 @@ class SchemaValidator:
expected_headings = expected_schema.get('properties', {}).get('headings', {}).get('properties', {})
# Generate document analysis with actual heading content
from .parser import parse_markdown_to_ast
content = file_path.read_text(encoding='utf-8')
ast_tokens = parse_markdown_to_ast(content)
structure_analysis = self.schema_generator._analyze_ast_structure(ast_tokens, None)
@@ -679,4 +676,4 @@ class SchemaValidator:
expected=f"One of: {allowed_texts}",
actual=actual_text,
suggestion=f"Change heading text to one of the allowed values: {', '.join(allowed_texts)}"
)
)