From b95191074001b3973448086d2f3dde1a372d20ee Mon Sep 17 00:00:00 2001 From: DaisukeYoda Date: Wed, 10 Sep 2025 20:10:37 +0900 Subject: [PATCH] feat: improve HTML reports and health score calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## HTML Report Quality Improvements - Fix dead code table displaying actual data instead of empty rows - Correct file paths showing real paths instead of "unknown" - Fix clone type display showing "Type-1", "Type-2" etc. instead of blank cells - Improve template loop logic for proper item limiting ## Report Format Standardization - Create shared FormatUtils for consistent formatting across all analysis types - Standardize header widths, label alignment, and section structures - Unify color schemes and risk level representations - Add comprehensive summary statistics and warning sections ## Health Score Algorithm Enhancement - Add project size normalization using logarithmic scaling for large projects - Implement penalty caps: max 25 points per category (Complexity, Dead Code, Clones, CBO) - Set minimum score threshold of 10 points to avoid complete failure - Adjust grade thresholds: A(85+), B(70+), C(55+), D(40+), F(<40) - Fix scoring issue where large projects always got 0/100 (Grade: F) ## Test Coverage Expansion - Add comprehensive dead code test cases in testdata/python/ - Create simple, edge cases, and complex dead code pattern examples - Improve test coverage for various unreachable code scenarios ## Results - Large projects: 0/100 (F) → 50/100 (D) - Small projects: appropriate scores (60-70 range) - HTML reports now show detailed, accurate information - Consistent professional formatting across all analysis types 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- analyze_20250910_112737.html | 855 ++ analyze_20250910_123538.html | 0 analyze_20250910_123615.html | 3906 ++++++++ analyze_20250910_124033.html | 7952 +++++++++++++++++ analyze_20250910_133656.html | 616 ++ analyze_20250910_133742.html | 615 ++ analyze_20250910_135746.html | 791 ++ analyze_20250910_150750.html | 865 ++ analyze_20250910_164535.html | 7951 ++++++++++++++++ analyze_20250910_164727.html | 7951 ++++++++++++++++ analyze_20250910_165913.html | 7951 ++++++++++++++++ analyze_20250910_165937.html | 615 ++ deadcode_20250910_132639.json | 134 + deadcode_20250910_133636.html | 220 + deadcode_20250910_133710.json | 134 + deadcode_20250910_133732.json | 134 + domain/analyze.go | 84 +- service/analyze_formatter.go | 179 +- service/cbo_formatter.go | 118 +- service/clone_formatter.go | 76 +- service/dead_code_formatter.go | 99 +- service/dead_code_service.go | 2 +- service/format_utils.go | 175 + service/output_formatter.go | 71 +- testdata/python/complex/dead_code_complex.py | 185 + .../python/edge_cases/dead_code_examples.py | 174 + testdata/python/simple/dead_code_simple.py | 66 + 27 files changed, 41701 insertions(+), 218 deletions(-) create mode 100644 analyze_20250910_112737.html create mode 100644 analyze_20250910_123538.html create mode 100644 analyze_20250910_123615.html create mode 100644 analyze_20250910_124033.html create mode 100644 analyze_20250910_133656.html create mode 100644 analyze_20250910_133742.html create mode 100644 analyze_20250910_135746.html create mode 100644 analyze_20250910_150750.html create mode 100644 analyze_20250910_164535.html create mode 100644 analyze_20250910_164727.html create mode 100644 analyze_20250910_165913.html create mode 100644 analyze_20250910_165937.html create mode 100644 deadcode_20250910_132639.json create mode 100644 deadcode_20250910_133636.html create mode 100644 deadcode_20250910_133710.json create mode 100644 deadcode_20250910_133732.json create mode 100644 testdata/python/complex/dead_code_complex.py create mode 100644 testdata/python/edge_cases/dead_code_examples.py create mode 100644 testdata/python/simple/dead_code_simple.py diff --git a/analyze_20250910_112737.html b/analyze_20250910_112737.html new file mode 100644 index 0000000..ef835b4 --- /dev/null +++ b/analyze_20250910_112737.html @@ -0,0 +1,855 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 11:27:37

+
+ Health Score: 75/100 (Grade: C) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
11
+
Total Files
+
+
+
11
+
Analyzed Files
+
+
+
1.91
+
Avg Complexity
+
+
+
0
+
Dead Code Issues
+
+
+
1442
+
Clone Pairs
+
+
+
40.7%
+
Code Duplication
+
+ +
+
36
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.19
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
147
+
Total Functions
+
+
+
1.91
+
Average
+
+
+
33
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
AbstractClass.abstract_methodtestdata/python/simple/classes.py2low
AbstractClass.concrete_methodtestdata/python/simple/classes.py1low
AsyncClass.async_class_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_static_methodtestdata/python/complex/async_await.py1low
AsyncContextManager.__aenter__testdata/python/complex/async_await.py1low
AsyncContextManager.__aexit__testdata/python/complex/async_await.py1low
AsyncRange.__aiter__testdata/python/complex/async_await.py1low
AsyncRange.__anext__testdata/python/complex/async_await.py3low
AsyncRange.__init__testdata/python/complex/async_await.py1low
+ +
+ + + +
+

Dead Code Detection

+ +
+
+
0
+
Total Issues
+
+
+
0
+
Critical
+
+
+
0
+
Warnings
+
+
+ +
+ + + +
+

Clone Detection

+ +
+
+
1442
+
Clone Pairs
+
+
+
2
+
Clone Groups
+
+
+
0.73
+
Avg Similarity
+
+
+ +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
36
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.19
+
Average Dependencies
+
+
+
2
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
MultipleInheritancetestdata/python/simple/classes.py2lowSimpleClass, EmptyClass
InnerClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
ValidationErrortestdata/python/complex/exceptions.py1lowCustomError
ClassWithMagicMethodstestdata/python/simple/classes.py1lowClassWithMagicMethods
InheritedClasstestdata/python/simple/classes.py1lowSimpleClass
ComplexClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
AsyncRangetestdata/python/complex/async_await.py0low
SimpleClasstestdata/python/simple/classes.py0low
MethodDecoratorstestdata/python/complex/decorators.py0low
PropertyExampletestdata/python/complex/decorators.py0low
+ +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_123538.html b/analyze_20250910_123538.html new file mode 100644 index 0000000..e69de29 diff --git a/analyze_20250910_123615.html b/analyze_20250910_123615.html new file mode 100644 index 0000000..887b104 --- /dev/null +++ b/analyze_20250910_123615.html @@ -0,0 +1,3906 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 12:36:15

+
+ Health Score: 75/100 (Grade: C) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
11
+
Total Files
+
+
+
11
+
Analyzed Files
+
+
+
1.91
+
Avg Complexity
+
+
+
0
+
Dead Code Issues
+
+
+
1442
+
Clone Pairs
+
+
+
40.7%
+
Code Duplication
+
+ +
+
36
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.19
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
147
+
Total Functions
+
+
+
1.91
+
Average
+
+
+
33
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
AbstractClass.abstract_methodtestdata/python/simple/classes.py2low
AbstractClass.concrete_methodtestdata/python/simple/classes.py1low
AsyncClass.async_class_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_static_methodtestdata/python/complex/async_await.py1low
AsyncContextManager.__aenter__testdata/python/complex/async_await.py1low
AsyncContextManager.__aexit__testdata/python/complex/async_await.py1low
AsyncRange.__aiter__testdata/python/complex/async_await.py1low
AsyncRange.__anext__testdata/python/complex/async_await.py3low
AsyncRange.__init__testdata/python/complex/async_await.py1low
+ +

Showing top 10 of 147 functions

+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
0
+
Total Issues
+
+
+
0
+
Critical
+
+
+
0
+
Warnings
+
+
+ + +

✓ No dead code detected

+ + +
+ + + +
+

Clone Detection

+ +
+
+
1442
+
Clone Pairs
+
+
+
2
+
Clone Groups
+
+
+
0.73
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py8-12157-1611.000Type-1
testdata/python/edge_cases/nested_structures.pytestdata/python/edge_cases/nested_structures.py90-94171-1801.000Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/simple/control_flow.py116-129133-1460.993Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py49-60143-1540.992Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py32-4194-1030.990Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py22-29106-1130.988Type-1
testdata/python/complex/comprehensions.pytestdata/python/edge_cases/nested_structures.py52-58155-1640.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/exceptions.py128-138171-1800.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py7-13156-1620.986Type-1
testdata/python/complex/async_await.pytestdata/python/complex/async_await.py106-115189-1960.983Type-1
testdata/python/complex/async_await.pytestdata/python/complex/comprehensions.py106-115100-1130.983Type-1
testdata/python/complex/async_await.pytestdata/python/complex/comprehensions.py189-196100-1130.983Type-1
testdata/python/complex/decorators.pytestdata/python/edge_cases/python310_features.py81-88162-1670.982Type-1
testdata/python/complex/decorators.pytestdata/python/complex/exceptions.py132-13685-900.982Type-1
testdata/python/simple/classes.pytestdata/python/simple/classes.py19-3248-650.980Type-1
+ +

Showing top 15 of 1442 clone pairs

+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
36
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.19
+
Average Dependencies
+
+
+
2
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
MultipleInheritancetestdata/python/simple/classes.py2lowSimpleClass, EmptyClass
ValidationErrortestdata/python/complex/exceptions.py1lowCustomError
InheritedClasstestdata/python/simple/classes.py1lowSimpleClass
ClassWithMagicMethodstestdata/python/simple/classes.py1lowClassWithMagicMethods
ComplexClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
InnerClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
MixedNestingtestdata/python/edge_cases/nested_structures.py0low
AbstractClasstestdata/python/simple/classes.py0low
MethodDecoratorstestdata/python/complex/decorators.py0low
CustomErrortestdata/python/complex/exceptions.py0low
+ +

Showing top 10 of 36 classes

+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_124033.html b/analyze_20250910_124033.html new file mode 100644 index 0000000..33aef4c --- /dev/null +++ b/analyze_20250910_124033.html @@ -0,0 +1,7952 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 12:40:33

+
+ Health Score: 0/100 (Grade: F) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
14
+
Total Files
+
+
+
14
+
Analyzed Files
+
+
+
1.99
+
Avg Complexity
+
+
+
15
+
Dead Code Issues
+
+
+
3332
+
Clone Pairs
+
+
+
49.4%
+
Code Duplication
+
+ +
+
39
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.18
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
177
+
Total Functions
+
+
+
1.99
+
Average
+
+
+
33
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
AbstractClass.abstract_methodtestdata/python/simple/classes.py2low
AbstractClass.concrete_methodtestdata/python/simple/classes.py1low
AsyncClass.async_class_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_static_methodtestdata/python/complex/async_await.py1low
AsyncContextManager.__aenter__testdata/python/complex/async_await.py1low
AsyncContextManager.__aexit__testdata/python/complex/async_await.py1low
AsyncRange.__aiter__testdata/python/complex/async_await.py1low
AsyncRange.__anext__testdata/python/complex/async_await.py3low
AsyncRange.__init__testdata/python/complex/async_await.py1low
+ +

Showing top 10 of 177 functions

+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
15
+
Total Issues
+
+
+
14
+
Critical
+
+
+
1
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
unknowncontext_manager_dead_code74-74criticalunreachable_after_raise
unknownfinally_block_patterns168-168criticalunreachable_after_return
unknownfinally_block_patterns172-172criticalunreachable_after_return
unknownfinally_block_patterns179-179warningunreachable_branch
unknownasync_dead_code57-58criticalunreachable_after_return
unknownexception_hierarchy_dead_code160-160criticalunreachable_after_return
unknowncomplex_control_flow30-31criticalunreachable_after_return
unknowngenerator_with_dead_code45-46criticalunreachable_after_return
unknownunreachable_after_break54-55criticalunreachable_after_break
unknownunreachable_after_continue69-70criticalunreachable_after_continue
unknownnested_dead_code101-101criticalunreachable_after_return
unknown__init__117-118criticalunreachable_after_return
unknownnested_return_dead_code60-60criticalunreachable_after_return
unknownsimple_dead_code12-13criticalunreachable_after_return
unknownloop_with_dead_code34-34criticalunreachable_after_break
+ +

Showing top 10 of 15 dead code issues

+ + + +
+ + + +
+

Clone Detection

+ +
+
+
3332
+
Clone Pairs
+
+
+
2
+
Clone Groups
+
+
+
0.76
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py102-107113-1181.000Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py8-12157-1611.000Type-1
testdata/python/edge_cases/nested_structures.pytestdata/python/edge_cases/nested_structures.py90-94171-1801.000Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/edge_cases/dead_code_examples.py56-6397-1041.000Type-1
testdata/python/simple/control_flow.pytestdata/python/edge_cases/python310_features.py133-146116-1290.993Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py143-15449-600.992Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py32-4194-1030.990Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py22-29106-1130.988Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py61-7798-1220.987Type-1
testdata/python/complex/comprehensions.pytestdata/python/edge_cases/nested_structures.py52-58155-1640.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py9-3576-900.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py80-9598-1220.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/exceptions.py128-138171-1800.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py7-13156-1620.986Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/nested_structures.py113-119155-1640.985Type-1
+ +

Showing top 15 of 3332 clone pairs

+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
39
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.18
+
Average Dependencies
+
+
+
2
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
MultipleInheritancetestdata/python/simple/classes.py2lowSimpleClass, EmptyClass
ValidationErrortestdata/python/complex/exceptions.py1lowCustomError
ClassWithMagicMethodstestdata/python/simple/classes.py1lowClassWithMagicMethods
InheritedClasstestdata/python/simple/classes.py1lowSimpleClass
ComplexClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
InnerClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
MaxCallstestdata/python/complex/decorators.py0low
Containertestdata/python/edge_cases/python310_features.py0low
CountCallstestdata/python/complex/decorators.py0low
AsyncRangetestdata/python/complex/async_await.py0low
+ +

Showing top 10 of 39 classes

+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_133656.html b/analyze_20250910_133656.html new file mode 100644 index 0000000..ed0867a --- /dev/null +++ b/analyze_20250910_133656.html @@ -0,0 +1,616 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 13:36:56

+
+ Health Score: 54/100 (Grade: F) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
1
+
Total Files
+
+
+
1
+
Analyzed Files
+
+
+
2.17
+
Avg Complexity
+
+
+
3
+
Dead Code Issues
+
+
+
13
+
Clone Pairs
+
+
+
80.3%
+
Code Duplication
+
+ +
+
0
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.00
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
6
+
Total Functions
+
+
+
2.17
+
Average
+
+
+
3
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
__main__testdata/python/simple/dead_code_simple.py1low
conditional_dead_codetestdata/python/simple/dead_code_simple.py2low
exception_dead_codetestdata/python/simple/dead_code_simple.py3low
loop_with_dead_codetestdata/python/simple/dead_code_simple.py3low
nested_return_dead_codetestdata/python/simple/dead_code_simple.py3low
simple_dead_codetestdata/python/simple/dead_code_simple.py1low
+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
3
+
Total Issues
+
+
+
3
+
Critical
+
+
+
0
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
unknownsimple_dead_code12-13criticalunreachable_after_return
unknownloop_with_dead_code34-34criticalunreachable_after_break
unknownnested_return_dead_code60-60criticalunreachable_after_return
+ + + +
+ + + +
+

Clone Detection

+ +
+
+
13
+
Clone Pairs
+
+
+
1
+
Clone Groups
+
+
+
0.88
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2540-490.971Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1340-490.969Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1316-250.969Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py40-4952-660.925Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2552-660.925Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1352-660.920Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3752-660.918Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py30-3556-630.860Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2528-370.853Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3740-490.853Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1328-370.843Type-3
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3730-350.746Type-3
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3756-630.746Type-3
+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
0
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.00
+
Average Dependencies
+
+
+
0
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_133742.html b/analyze_20250910_133742.html new file mode 100644 index 0000000..1ad0fe3 --- /dev/null +++ b/analyze_20250910_133742.html @@ -0,0 +1,615 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 13:37:42

+
+ Health Score: 54/100 (Grade: F) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
1
+
Total Files
+
+
+
1
+
Analyzed Files
+
+
+
2.17
+
Avg Complexity
+
+
+
3
+
Dead Code Issues
+
+
+
13
+
Clone Pairs
+
+
+
80.3%
+
Code Duplication
+
+ +
+
0
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.00
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
6
+
Total Functions
+
+
+
2.17
+
Average
+
+
+
3
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
__main__testdata/python/simple/dead_code_simple.py1low
conditional_dead_codetestdata/python/simple/dead_code_simple.py2low
exception_dead_codetestdata/python/simple/dead_code_simple.py3low
loop_with_dead_codetestdata/python/simple/dead_code_simple.py3low
nested_return_dead_codetestdata/python/simple/dead_code_simple.py3low
simple_dead_codetestdata/python/simple/dead_code_simple.py1low
+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
3
+
Total Issues
+
+
+
3
+
Critical
+
+
+
0
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
testdata/python/simple/dead_code_simple.pynested_return_dead_code60-60criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pysimple_dead_code12-13criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pyloop_with_dead_code34-34criticalunreachable_after_break
+ + + +
+ + + +
+

Clone Detection

+ +
+
+
13
+
Clone Pairs
+
+
+
1
+
Clone Groups
+
+
+
0.88
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2540-490.971Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1340-490.969Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1316-250.969Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py40-4952-660.925Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2552-660.925Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1352-660.920Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3752-660.918Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py30-3556-630.860Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2528-370.853Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3740-490.853Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1328-370.843Type-3
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3730-350.746Type-3
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3756-630.746Type-3
+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
0
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.00
+
Average Dependencies
+
+
+
0
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_135746.html b/analyze_20250910_135746.html new file mode 100644 index 0000000..191ffa7 --- /dev/null +++ b/analyze_20250910_135746.html @@ -0,0 +1,791 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 13:57:46

+
+ Health Score: 47/100 (Grade: F) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
1
+
Total Files
+
+
+
1
+
Analyzed Files
+
+
+
2.46
+
Avg Complexity
+
+
+
4
+
Dead Code Issues
+
+
+
58
+
Clone Pairs
+
+
+
82.2%
+
Code Duplication
+
+ +
+
1
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.00
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
13
+
Total Functions
+
+
+
2.46
+
Average
+
+
+
4
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
DeadCodeClass.__init__testdata/python/edge_cases/dead_code_examples.py1low
DeadCodeClass.method_with_dead_codetestdata/python/edge_cases/dead_code_examples.py2low
DeadCodeClass.setuptestdata/python/edge_cases/dead_code_examples.py1low
__main__testdata/python/edge_cases/dead_code_examples.py2low
early_exit_patterntestdata/python/edge_cases/dead_code_examples.py2low
infinite_loop_with_breaktestdata/python/edge_cases/dead_code_examples.py4low
multiple_returns_with_dead_codetestdata/python/edge_cases/dead_code_examples.py3low
nested_dead_codetestdata/python/edge_cases/dead_code_examples.py3low
unreachable_after_breaktestdata/python/edge_cases/dead_code_examples.py3low
unreachable_after_continuetestdata/python/edge_cases/dead_code_examples.py3low
+ +

Showing top 10 of 13 functions

+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
4
+
Total Issues
+
+
+
4
+
Critical
+
+
+
0
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
testdata/python/edge_cases/dead_code_examples.pynested_dead_code101-101criticalunreachable_after_return
testdata/python/edge_cases/dead_code_examples.py__init__117-118criticalunreachable_after_return
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_break54-55criticalunreachable_after_break
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_continue69-70criticalunreachable_after_continue
+ + + +
+ + + +
+

Clone Detection

+ +
+
+
58
+
Clone Pairs
+
+
+
1
+
Clone Groups
+
+
+
0.88
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py29-4360-730.984Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py76-90157-1670.983Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py60-73125-1330.978Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py7-1560-730.978Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py46-5793-1070.978Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py18-2660-730.978Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py18-26125-1330.971Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py7-15125-1330.971Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py7-1518-260.971Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py29-4376-900.959Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py76-90136-1540.957Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py60-7376-900.954Type-1
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py29-43157-1670.948Type-2
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py136-154157-1670.945Type-2
testdata/python/edge_cases/dead_code_examples.pytestdata/python/edge_cases/dead_code_examples.py29-43110-1330.941Type-2
+ +

Showing top 15 of 58 clone pairs

+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
1
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.00
+
Average Dependencies
+
+
+
0
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
DeadCodeClasstestdata/python/edge_cases/dead_code_examples.py0low
+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_150750.html b/analyze_20250910_150750.html new file mode 100644 index 0000000..74b5f0a --- /dev/null +++ b/analyze_20250910_150750.html @@ -0,0 +1,865 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 15:07:50

+
+ Health Score: 24/100 (Grade: F) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
1
+
Total Files
+
+
+
1
+
Analyzed Files
+
+
+
2.36
+
Avg Complexity
+
+
+
8
+
Dead Code Issues
+
+
+
70
+
Clone Pairs
+
+
+
82.7%
+
Code Duplication
+
+ +
+
2
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.00
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
11
+
Total Functions
+
+
+
2.36
+
Average
+
+
+
6
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
__main__testdata/python/complex/dead_code_complex.py2low
async_dead_codetestdata/python/complex/dead_code_complex.py1low
class_method_dead_codetestdata/python/complex/dead_code_complex.py1low
complex_control_flowtestdata/python/complex/dead_code_complex.py6low
comprehension_dead_codetestdata/python/complex/dead_code_complex.py2low
context_manager_dead_codetestdata/python/complex/dead_code_complex.py3low
decorator_dead_codetestdata/python/complex/dead_code_complex.py1low
exception_hierarchy_dead_codetestdata/python/complex/dead_code_complex.py5low
finally_block_patternstestdata/python/complex/dead_code_complex.py2low
generator_with_dead_codetestdata/python/complex/dead_code_complex.py1low
+ +

Showing top 10 of 11 functions

+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
8
+
Total Issues
+
+
+
7
+
Critical
+
+
+
1
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
testdata/python/complex/dead_code_complex.pyfinally_block_patterns168-168criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns172-172criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns179-179warningunreachable_branch
testdata/python/complex/dead_code_complex.pygenerator_with_dead_code45-46criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyexception_hierarchy_dead_code160-160criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pycontext_manager_dead_code74-74criticalunreachable_after_raise
testdata/python/complex/dead_code_complex.pycomplex_control_flow30-31criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyasync_dead_code57-58criticalunreachable_after_return
+ + + +
+ + + +
+

Clone Detection

+ +
+
+
70
+
Clone Pairs
+
+
+
1
+
Clone Groups
+
+
+
0.81
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py61-7798-1220.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py80-9598-1220.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py61-7780-950.984Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py38-4649-580.973Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py149-160163-1790.964Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py9-3598-1220.942Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py9-3561-770.939Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py61-77125-1350.933Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py80-95125-1350.930Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py14-3115-250.924Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py15-25102-1070.923Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py49-5861-770.919Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py9-3580-950.919Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py49-58125-1350.912Type-2
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py38-46125-1350.907Type-2
+ +

Showing top 15 of 70 clone pairs

+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
2
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.00
+
Average Dependencies
+
+
+
0
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
CustomContexttestdata/python/complex/dead_code_complex.py0low
TestClasstestdata/python/complex/dead_code_complex.py0low
+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_164535.html b/analyze_20250910_164535.html new file mode 100644 index 0000000..d2719d1 --- /dev/null +++ b/analyze_20250910_164535.html @@ -0,0 +1,7951 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 16:45:35

+
+ Health Score: 0/100 (Grade: F) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
14
+
Total Files
+
+
+
14
+
Analyzed Files
+
+
+
1.99
+
Avg Complexity
+
+
+
15
+
Dead Code Issues
+
+
+
3332
+
Clone Pairs
+
+
+
49.4%
+
Code Duplication
+
+ +
+
39
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.18
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
177
+
Total Functions
+
+
+
1.99
+
Average
+
+
+
33
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
AbstractClass.abstract_methodtestdata/python/simple/classes.py2low
AbstractClass.concrete_methodtestdata/python/simple/classes.py1low
AsyncClass.async_class_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_static_methodtestdata/python/complex/async_await.py1low
AsyncContextManager.__aenter__testdata/python/complex/async_await.py1low
AsyncContextManager.__aexit__testdata/python/complex/async_await.py1low
AsyncRange.__aiter__testdata/python/complex/async_await.py1low
AsyncRange.__anext__testdata/python/complex/async_await.py3low
AsyncRange.__init__testdata/python/complex/async_await.py1low
+ +

Showing top 10 of 177 functions

+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
15
+
Total Issues
+
+
+
14
+
Critical
+
+
+
1
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
testdata/python/complex/dead_code_complex.pygenerator_with_dead_code45-46criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pycontext_manager_dead_code74-74criticalunreachable_after_raise
testdata/python/complex/dead_code_complex.pycomplex_control_flow30-31criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyasync_dead_code57-58criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyexception_hierarchy_dead_code160-160criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns168-168criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns172-172criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns179-179warningunreachable_branch
testdata/python/edge_cases/dead_code_examples.py__init__117-118criticalunreachable_after_return
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_break54-55criticalunreachable_after_break
testdata/python/edge_cases/dead_code_examples.pynested_dead_code101-101criticalunreachable_after_return
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_continue69-70criticalunreachable_after_continue
testdata/python/simple/dead_code_simple.pyloop_with_dead_code34-34criticalunreachable_after_break
testdata/python/simple/dead_code_simple.pynested_return_dead_code60-60criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pysimple_dead_code12-13criticalunreachable_after_return
+ +

Showing top 10 of 15 dead code issues

+ + + +
+ + + +
+

Clone Detection

+ +
+
+
3332
+
Clone Pairs
+
+
+
2
+
Clone Groups
+
+
+
0.76
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py102-107113-1181.000Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py8-12157-1611.000Type-1
testdata/python/edge_cases/nested_structures.pytestdata/python/edge_cases/nested_structures.py90-94171-1801.000Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/edge_cases/dead_code_examples.py56-6397-1041.000Type-1
testdata/python/simple/control_flow.pytestdata/python/edge_cases/python310_features.py133-146116-1290.993Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py143-15449-600.992Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py32-4194-1030.990Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py22-29106-1130.988Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py61-7798-1220.987Type-1
testdata/python/complex/comprehensions.pytestdata/python/edge_cases/nested_structures.py52-58155-1640.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py9-3576-900.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py80-9598-1220.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/exceptions.py128-138171-1800.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py7-13156-1620.986Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/nested_structures.py113-119155-1640.985Type-1
+ +

Showing top 15 of 3332 clone pairs

+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
39
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.18
+
Average Dependencies
+
+
+
2
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
MultipleInheritancetestdata/python/simple/classes.py2lowSimpleClass, EmptyClass
ValidationErrortestdata/python/complex/exceptions.py1lowCustomError
ClassWithMagicMethodstestdata/python/simple/classes.py1lowClassWithMagicMethods
InheritedClasstestdata/python/simple/classes.py1lowSimpleClass
ComplexClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
InnerClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
InnermostClasstestdata/python/edge_cases/nested_structures.py0low
Pointtestdata/python/edge_cases/python310_features.py0low
DecoratedClasstestdata/python/complex/decorators.py0low
PropertyExampletestdata/python/complex/decorators.py0low
+ +

Showing top 10 of 39 classes

+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_164727.html b/analyze_20250910_164727.html new file mode 100644 index 0000000..8af393d --- /dev/null +++ b/analyze_20250910_164727.html @@ -0,0 +1,7951 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 16:47:27

+
+ Health Score: 0/100 (Grade: F) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
14
+
Total Files
+
+
+
14
+
Analyzed Files
+
+
+
1.99
+
Avg Complexity
+
+
+
15
+
Dead Code Issues
+
+
+
3332
+
Clone Pairs
+
+
+
49.4%
+
Code Duplication
+
+ +
+
39
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.18
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
177
+
Total Functions
+
+
+
1.99
+
Average
+
+
+
33
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
AbstractClass.abstract_methodtestdata/python/simple/classes.py2low
AbstractClass.concrete_methodtestdata/python/simple/classes.py1low
AsyncClass.async_class_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_static_methodtestdata/python/complex/async_await.py1low
AsyncContextManager.__aenter__testdata/python/complex/async_await.py1low
AsyncContextManager.__aexit__testdata/python/complex/async_await.py1low
AsyncRange.__aiter__testdata/python/complex/async_await.py1low
AsyncRange.__anext__testdata/python/complex/async_await.py3low
AsyncRange.__init__testdata/python/complex/async_await.py1low
+ +

Showing top 10 of 177 functions

+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
15
+
Total Issues
+
+
+
14
+
Critical
+
+
+
1
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
testdata/python/complex/dead_code_complex.pyexception_hierarchy_dead_code160-160criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyasync_dead_code57-58criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns168-168criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns172-172criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns179-179warningunreachable_branch
testdata/python/complex/dead_code_complex.pycomplex_control_flow30-31criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pygenerator_with_dead_code45-46criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pycontext_manager_dead_code74-74criticalunreachable_after_raise
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_continue69-70criticalunreachable_after_continue
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_break54-55criticalunreachable_after_break
testdata/python/edge_cases/dead_code_examples.pynested_dead_code101-101criticalunreachable_after_return
testdata/python/edge_cases/dead_code_examples.py__init__117-118criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pynested_return_dead_code60-60criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pysimple_dead_code12-13criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pyloop_with_dead_code34-34criticalunreachable_after_break
+ +

Showing top 10 of 15 dead code issues

+ + + +
+ + + +
+

Clone Detection

+ +
+
+
3332
+
Clone Pairs
+
+
+
2
+
Clone Groups
+
+
+
0.76
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py102-107113-1181.000Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py8-12157-1611.000Type-1
testdata/python/edge_cases/nested_structures.pytestdata/python/edge_cases/nested_structures.py90-94171-1801.000Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/edge_cases/dead_code_examples.py56-6397-1041.000Type-1
testdata/python/simple/control_flow.pytestdata/python/edge_cases/python310_features.py133-146116-1290.993Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py143-15449-600.992Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py32-4194-1030.990Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py22-29106-1130.988Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py61-7798-1220.987Type-1
testdata/python/complex/comprehensions.pytestdata/python/edge_cases/nested_structures.py52-58155-1640.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py9-3576-900.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py80-9598-1220.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/exceptions.py128-138171-1800.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py7-13156-1620.986Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/nested_structures.py113-119155-1640.985Type-1
+ +

Showing top 15 of 3332 clone pairs

+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
39
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.18
+
Average Dependencies
+
+
+
2
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
MultipleInheritancetestdata/python/simple/classes.py2lowEmptyClass, SimpleClass
ValidationErrortestdata/python/complex/exceptions.py1lowCustomError
ClassWithMagicMethodstestdata/python/simple/classes.py1lowClassWithMagicMethods
InheritedClasstestdata/python/simple/classes.py1lowSimpleClass
ComplexClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
InnerClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
InnermostClasstestdata/python/edge_cases/nested_structures.py0low
Containertestdata/python/edge_cases/python310_features.py0low
CountCallstestdata/python/complex/decorators.py0low
MaxCallstestdata/python/complex/decorators.py0low
+ +

Showing top 10 of 39 classes

+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_165913.html b/analyze_20250910_165913.html new file mode 100644 index 0000000..b913e2d --- /dev/null +++ b/analyze_20250910_165913.html @@ -0,0 +1,7951 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 16:59:13

+
+ Health Score: 50/100 (Grade: D) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
14
+
Total Files
+
+
+
14
+
Analyzed Files
+
+
+
1.99
+
Avg Complexity
+
+
+
15
+
Dead Code Issues
+
+
+
3332
+
Clone Pairs
+
+
+
49.4%
+
Code Duplication
+
+ +
+
39
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.18
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
177
+
Total Functions
+
+
+
1.99
+
Average
+
+
+
33
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
AbstractClass.abstract_methodtestdata/python/simple/classes.py2low
AbstractClass.concrete_methodtestdata/python/simple/classes.py1low
AsyncClass.async_class_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_methodtestdata/python/complex/async_await.py1low
AsyncClass.async_static_methodtestdata/python/complex/async_await.py1low
AsyncContextManager.__aenter__testdata/python/complex/async_await.py1low
AsyncContextManager.__aexit__testdata/python/complex/async_await.py1low
AsyncRange.__aiter__testdata/python/complex/async_await.py1low
AsyncRange.__anext__testdata/python/complex/async_await.py3low
AsyncRange.__init__testdata/python/complex/async_await.py1low
+ +

Showing top 10 of 177 functions

+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
15
+
Total Issues
+
+
+
14
+
Critical
+
+
+
1
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
testdata/python/complex/dead_code_complex.pyexception_hierarchy_dead_code160-160criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyasync_dead_code57-58criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pycontext_manager_dead_code74-74criticalunreachable_after_raise
testdata/python/complex/dead_code_complex.pygenerator_with_dead_code45-46criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns168-168criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns172-172criticalunreachable_after_return
testdata/python/complex/dead_code_complex.pyfinally_block_patterns179-179warningunreachable_branch
testdata/python/complex/dead_code_complex.pycomplex_control_flow30-31criticalunreachable_after_return
testdata/python/edge_cases/dead_code_examples.py__init__117-118criticalunreachable_after_return
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_break54-55criticalunreachable_after_break
testdata/python/edge_cases/dead_code_examples.pyunreachable_after_continue69-70criticalunreachable_after_continue
testdata/python/edge_cases/dead_code_examples.pynested_dead_code101-101criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pyloop_with_dead_code34-34criticalunreachable_after_break
testdata/python/simple/dead_code_simple.pynested_return_dead_code60-60criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pysimple_dead_code12-13criticalunreachable_after_return
+ +

Showing top 10 of 15 dead code issues

+ + + +
+ + + +
+

Clone Detection

+ +
+
+
3332
+
Clone Pairs
+
+
+
2
+
Clone Groups
+
+
+
0.76
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py102-107113-1181.000Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py8-12157-1611.000Type-1
testdata/python/edge_cases/nested_structures.pytestdata/python/edge_cases/nested_structures.py90-94171-1801.000Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/edge_cases/dead_code_examples.py56-6397-1041.000Type-1
testdata/python/simple/control_flow.pytestdata/python/edge_cases/python310_features.py133-146116-1290.993Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py143-15449-600.992Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py32-4194-1030.990Type-1
testdata/python/edge_cases/python310_features.pytestdata/python/edge_cases/python310_features.py22-29106-1130.988Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py61-7798-1220.987Type-1
testdata/python/complex/comprehensions.pytestdata/python/edge_cases/nested_structures.py52-58155-1640.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/dead_code_examples.py9-3576-900.987Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/complex/dead_code_complex.py80-9598-1220.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/exceptions.py128-138171-1800.987Type-1
testdata/python/complex/decorators.pytestdata/python/complex/decorators.py7-13156-1620.986Type-1
testdata/python/complex/dead_code_complex.pytestdata/python/edge_cases/nested_structures.py113-119155-1640.985Type-1
+ +

Showing top 15 of 3332 clone pairs

+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
39
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.18
+
Average Dependencies
+
+
+
2
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
MultipleInheritancetestdata/python/simple/classes.py2lowSimpleClass, EmptyClass
ValidationErrortestdata/python/complex/exceptions.py1lowCustomError
InheritedClasstestdata/python/simple/classes.py1lowSimpleClass
ClassWithMagicMethodstestdata/python/simple/classes.py1lowClassWithMagicMethods
ComplexClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
InnerClasstestdata/python/edge_cases/nested_structures.py1lowMethodClass
MethodDecoratorstestdata/python/complex/decorators.py0low
Containertestdata/python/edge_cases/python310_features.py0low
CachedPropertyExampletestdata/python/complex/decorators.py0low
AsyncRangetestdata/python/complex/async_await.py0low
+ +

Showing top 10 of 39 classes

+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/analyze_20250910_165937.html b/analyze_20250910_165937.html new file mode 100644 index 0000000..734d53c --- /dev/null +++ b/analyze_20250910_165937.html @@ -0,0 +1,615 @@ + + + + + + pyscn Analysis Report + + + +
+
+

pyscn Analysis Report

+

Generated: 2025-09-10 16:59:37

+
+ Health Score: 63/100 (Grade: C) +
+
+ +
+
+ + + + + + + + + + + + + +
+ +
+

Analysis Summary

+
+
+
1
+
Total Files
+
+
+
1
+
Analyzed Files
+
+
+
2.17
+
Avg Complexity
+
+
+
3
+
Dead Code Issues
+
+
+
13
+
Clone Pairs
+
+
+
80.3%
+
Code Duplication
+
+ +
+
0
+
Total Classes
+
+
+
0
+
High Dependencies
+
+
+
0.00
+
Avg Dependencies
+
+ +
+
+ + +
+

Complexity Analysis

+ +
+
+
6
+
Total Functions
+
+
+
2.17
+
Average
+
+
+
3
+
Maximum
+
+
+ +

Top Complex Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionFileComplexityRisk
__main__testdata/python/simple/dead_code_simple.py1low
conditional_dead_codetestdata/python/simple/dead_code_simple.py2low
exception_dead_codetestdata/python/simple/dead_code_simple.py3low
loop_with_dead_codetestdata/python/simple/dead_code_simple.py3low
nested_return_dead_codetestdata/python/simple/dead_code_simple.py3low
simple_dead_codetestdata/python/simple/dead_code_simple.py1low
+ + +
+ + + +
+

Dead Code Detection

+ +
+
+
3
+
Total Issues
+
+
+
3
+
Critical
+
+
+
0
+
Warnings
+
+
+ + +

Top Dead Code Issues

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileFunctionLinesSeverityReason
testdata/python/simple/dead_code_simple.pysimple_dead_code12-13criticalunreachable_after_return
testdata/python/simple/dead_code_simple.pyloop_with_dead_code34-34criticalunreachable_after_break
testdata/python/simple/dead_code_simple.pynested_return_dead_code60-60criticalunreachable_after_return
+ + + +
+ + + +
+

Clone Detection

+ +
+
+
13
+
Clone Pairs
+
+
+
1
+
Clone Groups
+
+
+
0.88
+
Avg Similarity
+
+
+ + +

Major Clone Pairs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File 1File 2Lines 1Lines 2SimilarityType
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2540-490.971Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1340-490.969Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1316-250.969Type-1
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py40-4952-660.925Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2552-660.925Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1352-660.920Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3752-660.918Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py30-3556-630.860Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py16-2528-370.853Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3740-490.853Type-2
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py6-1328-370.843Type-3
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3730-350.746Type-3
testdata/python/simple/dead_code_simple.pytestdata/python/simple/dead_code_simple.py28-3756-630.746Type-3
+ + + +
+ + + +
+

Dependency Analysis

+

Class coupling metrics (CBO - Coupling Between Objects)

+ +
+
+
0
+
Total Classes
+
+
+
0
+
High Risk Classes
+
+
+
0.00
+
Average Dependencies
+
+
+
0
+
Max Dependencies
+
+
+ +

Most Dependent Classes

+ + + + + + + + + + + + + +
ClassFileDependenciesRisk LevelDependent Classes
+ + +
+ +
+
+ + + + \ No newline at end of file diff --git a/deadcode_20250910_132639.json b/deadcode_20250910_132639.json new file mode 100644 index 0000000..2ab1159 --- /dev/null +++ b/deadcode_20250910_132639.json @@ -0,0 +1,134 @@ +{ + "files": [ + { + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "functions": [ + { + "name": "loop_with_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "unknown", + "start_line": 34, + "end_line": 34, + "start_column": 0, + "end_column": 0 + }, + "function_name": "loop_with_dead_code", + "code": "Call", + "reason": "unreachable_after_break", + "severity": "critical", + "description": "Code appears after a break statement and will never be executed", + "block_id": "bb8" + } + ], + "total_blocks": 10, + "dead_blocks": 1, + "reachable_ratio": 0.8, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + }, + { + "name": "nested_return_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "unknown", + "start_line": 60, + "end_line": 60, + "start_column": 0, + "end_column": 0 + }, + "function_name": "nested_return_dead_code", + "code": "Call", + "reason": "unreachable_after_return", + "severity": "critical", + "description": "Code appears after a return statement and will never be executed", + "block_id": "bb7" + } + ], + "total_blocks": 9, + "dead_blocks": 1, + "reachable_ratio": 0.7777777777777778, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + }, + { + "name": "simple_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "unknown", + "start_line": 12, + "end_line": 13, + "start_column": 0, + "end_column": 0 + }, + "function_name": "simple_dead_code", + "code": "Call\nassignment", + "reason": "unreachable_after_return", + "severity": "critical", + "description": "Code appears after a return statement and will never be executed", + "block_id": "bb3" + } + ], + "total_blocks": 4, + "dead_blocks": 1, + "reachable_ratio": 0.75, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + } + ], + "total_findings": 3, + "total_functions": 5, + "affected_functions": 3, + "dead_code_ratio": 0.13043478260869565 + } + ], + "summary": { + "total_files": 1, + "total_functions": 5, + "total_findings": 3, + "files_with_dead_code": 1, + "functions_with_dead_code": 3, + "critical_findings": 3, + "warning_findings": 0, + "info_findings": 0, + "findings_by_reason": { + "unreachable_after_break": 1, + "unreachable_after_return": 2 + }, + "total_blocks": 23, + "dead_blocks": 3, + "overall_dead_ratio": 0.13043478260869565 + }, + "warnings": null, + "errors": null, + "generated_at": "2025-09-10T13:26:39+09:00", + "version": "dev", + "config": { + "context_lines": 3, + "detect_after_break": true, + "detect_after_continue": true, + "detect_after_raise": true, + "detect_after_return": true, + "detect_unreachable_branches": true, + "exclude_patterns": [ + "test_*.py", + "*_test.py" + ], + "ignore_patterns": [], + "include_patterns": [ + "*.py" + ], + "min_severity": "warning", + "show_context": false, + "sort_by": "severity" + } +} \ No newline at end of file diff --git a/deadcode_20250910_133636.html b/deadcode_20250910_133636.html new file mode 100644 index 0000000..8d18177 --- /dev/null +++ b/deadcode_20250910_133636.html @@ -0,0 +1,220 @@ + + + + + + pyscn Code Quality Report - Python Project + + + +
+
+

Code Quality Report

+
Python Project
+
Generated on 2025-09-10T13:36:36+09:00
+
+ +
+
+
+
+ 86 +
+
+
Overall Score
+
Weighted average of all quality metrics
+
+ + +
+
+
+ 86 +
+
+
Dead_code Score
+
87.0% Reachable
+
+ +
+ +
+

Analysis Details

+
+
+
86
+
Dead_code Score
+
+
+
87.0% Reachable
+
Details
+
+
+
+ + +
+ + \ No newline at end of file diff --git a/deadcode_20250910_133710.json b/deadcode_20250910_133710.json new file mode 100644 index 0000000..6f914a2 --- /dev/null +++ b/deadcode_20250910_133710.json @@ -0,0 +1,134 @@ +{ + "files": [ + { + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "functions": [ + { + "name": "simple_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "unknown", + "start_line": 12, + "end_line": 13, + "start_column": 0, + "end_column": 0 + }, + "function_name": "simple_dead_code", + "code": "Call\nassignment", + "reason": "unreachable_after_return", + "severity": "critical", + "description": "Code appears after a return statement and will never be executed", + "block_id": "bb3" + } + ], + "total_blocks": 4, + "dead_blocks": 1, + "reachable_ratio": 0.75, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + }, + { + "name": "loop_with_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "unknown", + "start_line": 34, + "end_line": 34, + "start_column": 0, + "end_column": 0 + }, + "function_name": "loop_with_dead_code", + "code": "Call", + "reason": "unreachable_after_break", + "severity": "critical", + "description": "Code appears after a break statement and will never be executed", + "block_id": "bb8" + } + ], + "total_blocks": 10, + "dead_blocks": 1, + "reachable_ratio": 0.8, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + }, + { + "name": "nested_return_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "unknown", + "start_line": 60, + "end_line": 60, + "start_column": 0, + "end_column": 0 + }, + "function_name": "nested_return_dead_code", + "code": "Call", + "reason": "unreachable_after_return", + "severity": "critical", + "description": "Code appears after a return statement and will never be executed", + "block_id": "bb7" + } + ], + "total_blocks": 9, + "dead_blocks": 1, + "reachable_ratio": 0.7777777777777778, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + } + ], + "total_findings": 3, + "total_functions": 5, + "affected_functions": 3, + "dead_code_ratio": 0.13043478260869565 + } + ], + "summary": { + "total_files": 1, + "total_functions": 5, + "total_findings": 3, + "files_with_dead_code": 1, + "functions_with_dead_code": 3, + "critical_findings": 3, + "warning_findings": 0, + "info_findings": 0, + "findings_by_reason": { + "unreachable_after_break": 1, + "unreachable_after_return": 2 + }, + "total_blocks": 23, + "dead_blocks": 3, + "overall_dead_ratio": 0.13043478260869565 + }, + "warnings": null, + "errors": null, + "generated_at": "2025-09-10T13:37:10+09:00", + "version": "dev", + "config": { + "context_lines": 3, + "detect_after_break": true, + "detect_after_continue": true, + "detect_after_raise": true, + "detect_after_return": true, + "detect_unreachable_branches": true, + "exclude_patterns": [ + "test_*.py", + "*_test.py" + ], + "ignore_patterns": [], + "include_patterns": [ + "*.py" + ], + "min_severity": "warning", + "show_context": false, + "sort_by": "severity" + } +} \ No newline at end of file diff --git a/deadcode_20250910_133732.json b/deadcode_20250910_133732.json new file mode 100644 index 0000000..5524263 --- /dev/null +++ b/deadcode_20250910_133732.json @@ -0,0 +1,134 @@ +{ + "files": [ + { + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "functions": [ + { + "name": "nested_return_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "start_line": 60, + "end_line": 60, + "start_column": 0, + "end_column": 0 + }, + "function_name": "nested_return_dead_code", + "code": "Call", + "reason": "unreachable_after_return", + "severity": "critical", + "description": "Code appears after a return statement and will never be executed", + "block_id": "bb7" + } + ], + "total_blocks": 9, + "dead_blocks": 1, + "reachable_ratio": 0.7777777777777778, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + }, + { + "name": "simple_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "start_line": 12, + "end_line": 13, + "start_column": 0, + "end_column": 0 + }, + "function_name": "simple_dead_code", + "code": "Call\nassignment", + "reason": "unreachable_after_return", + "severity": "critical", + "description": "Code appears after a return statement and will never be executed", + "block_id": "bb3" + } + ], + "total_blocks": 4, + "dead_blocks": 1, + "reachable_ratio": 0.75, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + }, + { + "name": "loop_with_dead_code", + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "findings": [ + { + "location": { + "file_path": "/Users/daisukeyoda/projects/pyqol/testdata/python/simple/dead_code_simple.py", + "start_line": 34, + "end_line": 34, + "start_column": 0, + "end_column": 0 + }, + "function_name": "loop_with_dead_code", + "code": "Call", + "reason": "unreachable_after_break", + "severity": "critical", + "description": "Code appears after a break statement and will never be executed", + "block_id": "bb8" + } + ], + "total_blocks": 10, + "dead_blocks": 1, + "reachable_ratio": 0.8, + "critical_count": 1, + "warning_count": 0, + "info_count": 0 + } + ], + "total_findings": 3, + "total_functions": 5, + "affected_functions": 3, + "dead_code_ratio": 0.13043478260869565 + } + ], + "summary": { + "total_files": 1, + "total_functions": 5, + "total_findings": 3, + "files_with_dead_code": 1, + "functions_with_dead_code": 3, + "critical_findings": 3, + "warning_findings": 0, + "info_findings": 0, + "findings_by_reason": { + "unreachable_after_break": 1, + "unreachable_after_return": 2 + }, + "total_blocks": 23, + "dead_blocks": 3, + "overall_dead_ratio": 0.13043478260869565 + }, + "warnings": null, + "errors": null, + "generated_at": "2025-09-10T13:37:32+09:00", + "version": "v0.1.0-beta.14-6-g8dd877b-dirty", + "config": { + "context_lines": 3, + "detect_after_break": true, + "detect_after_continue": true, + "detect_after_raise": true, + "detect_after_return": true, + "detect_unreachable_branches": true, + "exclude_patterns": [ + "test_*.py", + "*_test.py" + ], + "ignore_patterns": [], + "include_patterns": [ + "*.py" + ], + "min_severity": "warning", + "show_context": false, + "sort_by": "severity" + } +} \ No newline at end of file diff --git a/domain/analyze.go b/domain/analyze.go index e2e634f..0cdfedd 100644 --- a/domain/analyze.go +++ b/domain/analyze.go @@ -1,6 +1,7 @@ package domain import ( + "math" "time" ) @@ -59,64 +60,85 @@ type AnalyzeSummary struct { func (s *AnalyzeSummary) CalculateHealthScore() { score := 100 - // Deduct points for high complexity + // Calculate normalization factor for large projects + normalizationFactor := 1.0 + if s.TotalFiles > 10 { + // Use logarithmic scaling to reduce penalty impact for large projects + normalizationFactor = math.Log10(float64(s.TotalFiles)) / 2.0 + } + + // Complexity penalty (max 25 points) + complexityPenalty := 0 if s.AverageComplexity > 20 { - score -= 30 + complexityPenalty = 25 } else if s.AverageComplexity > 10 { - score -= 20 + complexityPenalty = 15 } else if s.AverageComplexity > 5 { - score -= 10 + complexityPenalty = 8 } + score -= complexityPenalty - // Deduct points for dead code + // Dead code penalty (max 25 points, normalized for project size) + deadCodePenalty := 0 if s.DeadCodeCount > 0 { - deduction := (s.DeadCodeCount * 2) - if deduction > 20 { - deduction = 20 - } - score -= deduction + rawPenalty := float64(s.DeadCodeCount) / normalizationFactor + deadCodePenalty = int(math.Min(25, rawPenalty)) } + + // Additional penalty for critical dead code (max 15 points, normalized) + criticalPenalty := 0 + if s.CriticalDeadCode > 0 { + rawCriticalPenalty := float64(s.CriticalDeadCode*3) / normalizationFactor + criticalPenalty = int(math.Min(15, rawCriticalPenalty)) + } + + totalDeadCodePenalty := deadCodePenalty + criticalPenalty + if totalDeadCodePenalty > 25 { + totalDeadCodePenalty = 25 + } + score -= totalDeadCodePenalty - // Deduct points for critical dead code - score -= s.CriticalDeadCode * 5 - - // Deduct points for code duplication - if s.CodeDuplication > 30 { - score -= 25 - } else if s.CodeDuplication > 20 { - score -= 15 + // Clone penalty (max 25 points, based on percentage) + clonePenalty := 0 + if s.CodeDuplication > 40 { + clonePenalty = 25 + } else if s.CodeDuplication > 25 { + clonePenalty = 15 } else if s.CodeDuplication > 10 { - score -= 10 + clonePenalty = 8 } + score -= clonePenalty - // Deduct points for high coupling + // CBO penalty (max 25 points) + cboPenalty := 0 if s.CBOClasses > 0 { couplingRatio := float64(s.HighCouplingClasses) / float64(s.CBOClasses) if couplingRatio > 0.5 { - score -= 20 + cboPenalty = 20 } else if couplingRatio > 0.3 { - score -= 15 + cboPenalty = 12 } else if couplingRatio > 0.1 { - score -= 10 + cboPenalty = 6 } } + score -= cboPenalty - // Ensure score is within bounds - if score < 0 { - score = 0 + // Set minimum score to 10 (never completely fail) + if score < 10 { + score = 10 } s.HealthScore = score - // Assign grade based on score + // Assign grade based on score (adjusted thresholds) switch { - case score >= 90: + case score >= 85: s.Grade = "A" - case score >= 80: - s.Grade = "B" case score >= 70: + s.Grade = "B" + case score >= 55: s.Grade = "C" - case score >= 60: + case score >= 40: s.Grade = "D" default: s.Grade = "F" diff --git a/service/analyze_formatter.go b/service/analyze_formatter.go index 9058934..6f05322 100644 --- a/service/analyze_formatter.go +++ b/service/analyze_formatter.go @@ -46,58 +46,84 @@ func (f *AnalyzeFormatter) Write(response *domain.AnalyzeResponse, format domain // writeText formats the response as plain text func (f *AnalyzeFormatter) writeText(response *domain.AnalyzeResponse, writer io.Writer) error { - fmt.Fprintf(writer, "pyscn Comprehensive Analysis Report\n") - fmt.Fprintf(writer, "====================================\n\n") - fmt.Fprintf(writer, "Generated: %s\n\n", response.GeneratedAt.Format(time.RFC3339)) + utils := NewFormatUtils() - // Summary section - fmt.Fprintf(writer, "Overall Health Score: %d/100 (Grade: %s)\n", - response.Summary.HealthScore, response.Summary.Grade) - fmt.Fprintf(writer, "Analysis Duration: %.2fs\n\n", float64(response.Duration)/1000.0) + // Header + fmt.Fprint(writer, utils.FormatMainHeader("Comprehensive Analysis Report")) + + // Overall health and duration + healthStats := map[string]interface{}{ + "Health Score": fmt.Sprintf("%d/100 (%s)", response.Summary.HealthScore, response.Summary.Grade), + "Analysis Duration": fmt.Sprintf("%.2fs", float64(response.Duration)/1000.0), + "Generated": response.GeneratedAt.Format(time.RFC3339), + } + fmt.Fprint(writer, utils.FormatSummaryStats(healthStats)) // File statistics - fmt.Fprintf(writer, "File Statistics:\n") - fmt.Fprintf(writer, " Total Files: %d\n", response.Summary.TotalFiles) - fmt.Fprintf(writer, " Analyzed: %d\n", response.Summary.AnalyzedFiles) - fmt.Fprintf(writer, " Skipped: %d\n\n", response.Summary.SkippedFiles) + fmt.Fprint(writer, utils.FormatFileStats( + response.Summary.AnalyzedFiles, + response.Summary.TotalFiles, + response.Summary.TotalFiles-response.Summary.AnalyzedFiles)) - // Complexity analysis results - if response.Complexity != nil && response.Summary.ComplexityEnabled { - fmt.Fprintf(writer, "Complexity Analysis:\n") - fmt.Fprintf(writer, "--------------------\n") - fmt.Fprintf(writer, " Total Functions: %d\n", response.Summary.TotalFunctions) - fmt.Fprintf(writer, " Average Complexity: %.2f\n", response.Summary.AverageComplexity) - fmt.Fprintf(writer, " High Complexity Count: %d\n\n", response.Summary.HighComplexityCount) + // Analysis modules results + if response.Summary.ComplexityEnabled { + fmt.Fprint(writer, utils.FormatSectionHeader("COMPLEXITY ANALYSIS")) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Total Functions", response.Summary.TotalFunctions)) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Average Complexity", fmt.Sprintf("%.1f", response.Summary.AverageComplexity))) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "High Complexity Count", response.Summary.HighComplexityCount)) + fmt.Fprint(writer, utils.FormatSectionSeparator()) } - // Dead code analysis results - if response.DeadCode != nil && response.Summary.DeadCodeEnabled { - fmt.Fprintf(writer, "Dead Code Detection:\n") - fmt.Fprintf(writer, "-------------------\n") - fmt.Fprintf(writer, " Total Issues: %d\n", response.Summary.DeadCodeCount) - fmt.Fprintf(writer, " Critical Issues: %d\n\n", response.Summary.CriticalDeadCode) + if response.Summary.DeadCodeEnabled { + fmt.Fprint(writer, utils.FormatSectionHeader("DEAD CODE DETECTION")) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Total Issues", response.Summary.DeadCodeCount)) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Critical Issues", response.Summary.CriticalDeadCode)) + fmt.Fprint(writer, utils.FormatSectionSeparator()) } - // Clone detection results - if response.Clone != nil && response.Summary.CloneEnabled { - fmt.Fprintf(writer, "Clone Detection:\n") - fmt.Fprintf(writer, "---------------\n") - fmt.Fprintf(writer, " Clone Pairs: %d\n", response.Summary.ClonePairs) - fmt.Fprintf(writer, " Clone Groups: %d\n", response.Summary.CloneGroups) - fmt.Fprintf(writer, " Code Duplication: %.2f%%\n\n", response.Summary.CodeDuplication) + if response.Summary.CloneEnabled { + fmt.Fprint(writer, utils.FormatSectionHeader("CLONE DETECTION")) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Clone Pairs", response.Summary.ClonePairs)) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Clone Groups", response.Summary.CloneGroups)) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Code Duplication", utils.FormatPercentage(response.Summary.CodeDuplication))) + fmt.Fprint(writer, utils.FormatSectionSeparator()) + } + + if response.Summary.CBOEnabled { + fmt.Fprint(writer, utils.FormatSectionHeader("DEPENDENCY ANALYSIS")) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Classes Analyzed", response.Summary.CBOClasses)) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "High Coupling Classes", response.Summary.HighCouplingClasses)) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Average Coupling", fmt.Sprintf("%.1f", response.Summary.AverageCoupling))) + fmt.Fprint(writer, utils.FormatSectionSeparator()) } // Recommendations - fmt.Fprintf(writer, "Recommendations:\n") - fmt.Fprintf(writer, "---------------\n") + fmt.Fprint(writer, utils.FormatSectionHeader("RECOMMENDATIONS")) + recommendationCount := 0 + if response.Summary.HighComplexityCount > 0 { - fmt.Fprintf(writer, " • Refactor %d high-complexity functions\n", response.Summary.HighComplexityCount) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "•", + fmt.Sprintf("Refactor %d high-complexity functions", response.Summary.HighComplexityCount))) + recommendationCount++ } if response.Summary.DeadCodeCount > 0 { - fmt.Fprintf(writer, " • Remove %d dead code segments\n", response.Summary.DeadCodeCount) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "•", + fmt.Sprintf("Remove %d dead code segments", response.Summary.DeadCodeCount))) + recommendationCount++ } if response.Summary.CodeDuplication > 10 { - fmt.Fprintf(writer, " • Reduce code duplication (currently %.1f%%)\n", response.Summary.CodeDuplication) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "•", + fmt.Sprintf("Reduce code duplication (currently %.1f%%)", response.Summary.CodeDuplication))) + recommendationCount++ + } + if response.Summary.HighCouplingClasses > 0 { + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "•", + fmt.Sprintf("Reduce coupling in %d high-dependency classes", response.Summary.HighCouplingClasses))) + recommendationCount++ + } + + if recommendationCount == 0 { + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Status", "No major issues detected")) } return nil @@ -134,6 +160,9 @@ func (f *AnalyzeFormatter) writeHTML(response *domain.AnalyzeResponse, writer io "join": func(elems []string, sep string) string { return strings.Join(elems, sep) }, + "add": func(a, b int) int { + return a + b + }, } tmpl := template.Must(template.New("analyze").Funcs(funcMap).Parse(analyzeHTMLTemplate)) return tmpl.Execute(writer, response) @@ -376,6 +405,9 @@ const analyzeHTMLTemplate = ` {{end}} + {{if gt (len .Complexity.Functions) 10}} +

Showing top 10 of {{len .Complexity.Functions}} functions

+ {{end}} {{end}} {{end}} @@ -398,6 +430,43 @@ const analyzeHTMLTemplate = `
Warnings
+ + {{if gt .DeadCode.Summary.TotalFindings 0}} +

Top Dead Code Issues

+ + + + + + + + + + + + {{range $file := .DeadCode.Files}} + {{range $func := $file.Functions}} + {{range $i, $finding := $func.Findings}} + {{if lt $i 10}} + + + + + + + + {{end}} + {{end}} + {{end}} + {{end}} + +
FileFunctionLinesSeverityReason
{{$finding.Location.FilePath}}{{$finding.FunctionName}}{{$finding.Location.StartLine}}-{{$finding.Location.EndLine}}{{$finding.Severity}}{{$finding.Reason}}
+ {{if gt .DeadCode.Summary.TotalFindings 10}} +

Showing top 10 of {{.DeadCode.Summary.TotalFindings}} dead code issues

+ {{end}} + {{else}} +

✓ No dead code detected

+ {{end}} {{end}} {{end}} @@ -420,6 +489,41 @@ const analyzeHTMLTemplate = `
Avg Similarity
+ + {{if gt .Clone.Statistics.TotalClonePairs 0}} +

Major Clone Pairs

+ + + + + + + + + + + + + {{range $i, $pair := .Clone.ClonePairs}} + {{if lt $i 15}} + + + + + + + + + {{end}} + {{end}} + +
File 1File 2Lines 1Lines 2SimilarityType
{{$pair.Clone1.Location.FilePath}}{{$pair.Clone2.Location.FilePath}}{{$pair.Clone1.Location.StartLine}}-{{$pair.Clone1.Location.EndLine}}{{$pair.Clone2.Location.StartLine}}-{{$pair.Clone2.Location.EndLine}}{{printf "%.3f" $pair.Similarity}}{{$pair.Type}}
+ {{if gt .Clone.Statistics.TotalClonePairs 15}} +

Showing top 15 of {{.Clone.Statistics.TotalClonePairs}} clone pairs

+ {{end}} + {{else}} +

✓ No clones detected

+ {{end}} {{end}} {{end}} @@ -473,6 +577,9 @@ const analyzeHTMLTemplate = ` {{end}} + {{if gt (len .CBO.Classes) 10}} +

Showing top 10 of {{len .CBO.Classes}} classes

+ {{end}} {{end}} {{end}} diff --git a/service/cbo_formatter.go b/service/cbo_formatter.go index d073184..4a7861e 100644 --- a/service/cbo_formatter.go +++ b/service/cbo_formatter.go @@ -53,29 +53,30 @@ func (f *CBOFormatterImpl) Write(response *domain.CBOResponse, format domain.Out // formatText formats the response as human-readable text func (f *CBOFormatterImpl) formatText(response *domain.CBOResponse) (string, error) { var builder strings.Builder + utils := NewFormatUtils() // Header - builder.WriteString("=== CBO (Coupling Between Objects) Analysis Results ===\n\n") + builder.WriteString(utils.FormatMainHeader("CBO (Coupling Between Objects) Analysis Report")) // Summary - builder.WriteString("📊 SUMMARY\n") - builder.WriteString(fmt.Sprintf("Total Classes: %d\n", response.Summary.TotalClasses)) - builder.WriteString(fmt.Sprintf("Files Analyzed: %d\n", response.Summary.FilesAnalyzed)) - builder.WriteString(fmt.Sprintf("Average CBO: %.2f\n", response.Summary.AverageCBO)) - builder.WriteString(fmt.Sprintf("Max CBO: %d\n", response.Summary.MaxCBO)) - builder.WriteString(fmt.Sprintf("Min CBO: %d\n", response.Summary.MinCBO)) - builder.WriteString("\n") + stats := map[string]interface{}{ + "Total Classes": response.Summary.TotalClasses, + "Files Analyzed": response.Summary.FilesAnalyzed, + "Average CBO": fmt.Sprintf("%.1f", response.Summary.AverageCBO), + "Max CBO": response.Summary.MaxCBO, + "Min CBO": response.Summary.MinCBO, + } + builder.WriteString(utils.FormatSummaryStats(stats)) // Risk distribution - builder.WriteString("🚦 RISK DISTRIBUTION\n") - builder.WriteString(fmt.Sprintf("Low Risk: %d classes\n", response.Summary.LowRiskClasses)) - builder.WriteString(fmt.Sprintf("Medium Risk: %d classes\n", response.Summary.MediumRiskClasses)) - builder.WriteString(fmt.Sprintf("High Risk: %d classes\n", response.Summary.HighRiskClasses)) - builder.WriteString("\n") + builder.WriteString(utils.FormatRiskDistribution( + response.Summary.HighRiskClasses, + response.Summary.MediumRiskClasses, + response.Summary.LowRiskClasses)) // CBO distribution if len(response.Summary.CBODistribution) > 0 { - builder.WriteString("📈 CBO DISTRIBUTION\n") + builder.WriteString(utils.FormatSectionHeader("CBO DISTRIBUTION")) // Sort ranges for consistent output ranges := make([]string, 0, len(response.Summary.CBODistribution)) @@ -86,98 +87,121 @@ func (f *CBOFormatterImpl) formatText(response *domain.CBOResponse) (string, err for _, rang := range ranges { count := response.Summary.CBODistribution[rang] - builder.WriteString(fmt.Sprintf("CBO %s: %d classes\n", rang, count)) + builder.WriteString(utils.FormatLabelWithIndent(SectionPadding, fmt.Sprintf("CBO %s", rang), fmt.Sprintf("%d classes", count))) } - builder.WriteString("\n") + builder.WriteString(utils.FormatSectionSeparator()) } // Most coupled classes if len(response.Summary.MostCoupledClasses) > 0 { - builder.WriteString("🔗 MOST COUPLED CLASSES\n") + builder.WriteString(utils.FormatSectionHeader("MOST COUPLED CLASSES")) for i, class := range response.Summary.MostCoupledClasses { if i >= 10 { // Limit to top 10 break } - riskIcon := f.getRiskIcon(class.RiskLevel) - builder.WriteString(fmt.Sprintf("%d. %s %s (CBO: %d) - %s:%d\n", - i+1, riskIcon, class.Name, class.Metrics.CouplingCount, class.FilePath, class.StartLine)) + // Convert domain risk level to standard risk level + var standardRisk RiskLevel + switch class.RiskLevel { + case "High": + standardRisk = RiskHigh + case "Medium": + standardRisk = RiskMedium + case "Low": + standardRisk = RiskLow + default: + standardRisk = RiskLow + } + coloredRisk := utils.FormatRiskWithColor(standardRisk) + + builder.WriteString(fmt.Sprintf("%s%d. %s %s (CBO: %d) - %s:%d\n", + strings.Repeat(" ", SectionPadding), i+1, coloredRisk, class.Name, class.Metrics.CouplingCount, class.FilePath, class.StartLine)) } - builder.WriteString("\n") + builder.WriteString(utils.FormatSectionSeparator()) } // Detailed class information if len(response.Classes) > 0 { - builder.WriteString("📋 CLASS DETAILS\n") + builder.WriteString(utils.FormatSectionHeader("CLASS DETAILS")) for _, class := range response.Classes { - f.writeClassDetails(&builder, class) + f.writeClassDetails(&builder, class, utils) builder.WriteString("\n") } + builder.WriteString(utils.FormatSectionSeparator()) } // Warnings if len(response.Warnings) > 0 { - builder.WriteString("⚠️ WARNINGS\n") - for _, warning := range response.Warnings { - builder.WriteString(fmt.Sprintf("• %s\n", warning)) - } - builder.WriteString("\n") + builder.WriteString(utils.FormatWarningsSection(response.Warnings)) } // Errors if len(response.Errors) > 0 { - builder.WriteString("❌ ERRORS\n") + builder.WriteString(utils.FormatSectionHeader("ERRORS")) for _, err := range response.Errors { - builder.WriteString(fmt.Sprintf("• %s\n", err)) + builder.WriteString(utils.FormatLabelWithIndent(SectionPadding, "❌", err)) } - builder.WriteString("\n") + builder.WriteString(utils.FormatSectionSeparator()) } // Footer - builder.WriteString(fmt.Sprintf("Generated at: %s\n", response.GeneratedAt)) - builder.WriteString(fmt.Sprintf("Version: %s\n", response.Version)) + builder.WriteString(utils.FormatSectionHeader("METADATA")) + builder.WriteString(utils.FormatLabelWithIndent(SectionPadding, "Generated at", response.GeneratedAt)) + builder.WriteString(utils.FormatLabelWithIndent(SectionPadding, "Version", response.Version)) return builder.String(), nil } // writeClassDetails writes detailed information about a class -func (f *CBOFormatterImpl) writeClassDetails(builder *strings.Builder, class domain.ClassCoupling) { - riskIcon := f.getRiskIcon(class.RiskLevel) +func (f *CBOFormatterImpl) writeClassDetails(builder *strings.Builder, class domain.ClassCoupling, utils *FormatUtils) { + // Convert domain risk level to standard risk level + var standardRisk RiskLevel + switch class.RiskLevel { + case "High": + standardRisk = RiskHigh + case "Medium": + standardRisk = RiskMedium + case "Low": + standardRisk = RiskLow + default: + standardRisk = RiskLow + } + coloredRisk := utils.FormatRiskWithColor(standardRisk) - builder.WriteString(fmt.Sprintf("%s %s (CBO: %d, Risk: %s)\n", - riskIcon, class.Name, class.Metrics.CouplingCount, class.RiskLevel)) - builder.WriteString(fmt.Sprintf(" Location: %s:%d-%d\n", class.FilePath, class.StartLine, class.EndLine)) + builder.WriteString(utils.FormatLabelWithIndent(SectionPadding, "Class", fmt.Sprintf("%s %s (CBO: %d)", + coloredRisk, class.Name, class.Metrics.CouplingCount))) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding, "Location", fmt.Sprintf("%s:%d-%d", class.FilePath, class.StartLine, class.EndLine))) if class.IsAbstract { - builder.WriteString(" Type: Abstract Class\n") + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding, "Type", "Abstract Class")) } // Base classes if len(class.BaseClasses) > 0 { - builder.WriteString(fmt.Sprintf(" Inherits from: %s\n", strings.Join(class.BaseClasses, ", "))) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding, "Inherits from", strings.Join(class.BaseClasses, ", "))) } // Dependency breakdown if class.Metrics.CouplingCount > 0 { - builder.WriteString(" Dependencies:\n") + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding, "Dependencies", "")) if class.Metrics.InheritanceDependencies > 0 { - builder.WriteString(fmt.Sprintf(" Inheritance: %d\n", class.Metrics.InheritanceDependencies)) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding+2, "Inheritance", class.Metrics.InheritanceDependencies)) } if class.Metrics.TypeHintDependencies > 0 { - builder.WriteString(fmt.Sprintf(" Type Hints: %d\n", class.Metrics.TypeHintDependencies)) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding+2, "Type Hints", class.Metrics.TypeHintDependencies)) } if class.Metrics.InstantiationDependencies > 0 { - builder.WriteString(fmt.Sprintf(" Instantiation: %d\n", class.Metrics.InstantiationDependencies)) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding+2, "Instantiation", class.Metrics.InstantiationDependencies)) } if class.Metrics.AttributeAccessDependencies > 0 { - builder.WriteString(fmt.Sprintf(" Attribute Access: %d\n", class.Metrics.AttributeAccessDependencies)) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding+2, "Attribute Access", class.Metrics.AttributeAccessDependencies)) } if class.Metrics.ImportDependencies > 0 { - builder.WriteString(fmt.Sprintf(" Imports: %d\n", class.Metrics.ImportDependencies)) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding+2, "Imports", class.Metrics.ImportDependencies)) } // List dependent classes if len(class.Metrics.DependentClasses) > 0 { - builder.WriteString(fmt.Sprintf(" Coupled to: %s\n", strings.Join(class.Metrics.DependentClasses, ", "))) + builder.WriteString(utils.FormatLabelWithIndent(ItemPadding+2, "Coupled to", strings.Join(class.Metrics.DependentClasses, ", "))) } } } diff --git a/service/clone_formatter.go b/service/clone_formatter.go index c433429..d21006a 100644 --- a/service/clone_formatter.go +++ b/service/clone_formatter.go @@ -60,94 +60,92 @@ func (f *CloneOutputFormatter) formatAsText(response *domain.CloneResponse, writ return nil } - // Print header - fmt.Fprintf(writer, "Clone Detection Results\n") - fmt.Fprintf(writer, "======================\n\n") + utils := NewFormatUtils() - // Print statistics + // Header + fmt.Fprint(writer, utils.FormatMainHeader("Clone Detection Analysis Report")) + + // Summary if response.Statistics != nil { - fmt.Fprintf(writer, "Summary:\n") - fmt.Fprintf(writer, " Files analyzed: %d\n", response.Statistics.FilesAnalyzed) - fmt.Fprintf(writer, " Lines analyzed: %d\n", response.Statistics.LinesAnalyzed) - fmt.Fprintf(writer, " Clone pairs found: %d\n", response.Statistics.TotalClonePairs) - fmt.Fprintf(writer, " Clone groups found: %d\n", response.Statistics.TotalCloneGroups) - - if response.Statistics.AverageSimilarity > 0 { - fmt.Fprintf(writer, " Average similarity: %.3f\n", response.Statistics.AverageSimilarity) + stats := map[string]interface{}{ + "Files Analyzed": response.Statistics.FilesAnalyzed, + "Lines Analyzed": response.Statistics.LinesAnalyzed, + "Clone Pairs": response.Statistics.TotalClonePairs, + "Clone Groups": response.Statistics.TotalCloneGroups, + "Average Similarity": fmt.Sprintf("%.3f", response.Statistics.AverageSimilarity), + "Analysis Duration": utils.FormatDuration(response.Duration), } - - fmt.Fprintf(writer, " Analysis duration: %dms\n\n", response.Duration) + fmt.Fprint(writer, utils.FormatSummaryStats(stats)) } - // Print clone types breakdown + // Clone Types breakdown if response.Statistics != nil && len(response.Statistics.ClonesByType) > 0 { - fmt.Fprintf(writer, "Clone Types:\n") + fmt.Fprint(writer, utils.FormatSectionHeader("CLONE TYPES")) for cloneType, count := range response.Statistics.ClonesByType { - fmt.Fprintf(writer, " %s: %d pairs\n", cloneType, count) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, cloneType, fmt.Sprintf("%d pairs", count))) } - fmt.Fprintf(writer, "\n") + fmt.Fprint(writer, utils.FormatSectionSeparator()) } if len(response.ClonePairs) == 0 { - fmt.Fprintf(writer, "No clones detected.\n") + fmt.Fprint(writer, utils.FormatSectionHeader("RESULTS")) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Status", "No clones detected")) return nil } - // Print detailed clone pairs + // Detailed clone information if response.Request != nil && response.Request.GroupClones && len(response.CloneGroups) > 0 { - fmt.Fprintf(writer, "Clone Groups:\n") - fmt.Fprintf(writer, "=============\n\n") + fmt.Fprint(writer, utils.FormatSectionHeader("CLONE GROUPS")) for _, group := range response.CloneGroups { if group == nil { continue } - fmt.Fprintf(writer, "Group %d (%s, %d clones, similarity: %.3f):\n", - group.ID, group.Type.String(), group.Size, group.Similarity) + fmt.Fprint(writer, utils.FormatLabelWithIndent(0, "Group", fmt.Sprintf("%d (%s, %d clones, similarity: %.3f)", + group.ID, group.Type.String(), group.Size, group.Similarity))) for i, clone := range group.Clones { if clone == nil || clone.Location == nil { continue } - fmt.Fprintf(writer, " %d. %s (%d lines, %d nodes)\n", - i+1, clone.Location.String(), clone.LineCount, clone.Size) + fmt.Fprint(writer, utils.FormatLabelWithIndent(ItemPadding, fmt.Sprintf("Clone %d", i+1), + fmt.Sprintf("%s (%d lines, %d nodes)", clone.Location.String(), clone.LineCount, clone.Size))) } - fmt.Fprintf(writer, "\n") + fmt.Fprint(writer, "\n") } } else { - fmt.Fprintf(writer, "Clone Pairs:\n") - fmt.Fprintf(writer, "============\n\n") + fmt.Fprint(writer, utils.FormatSectionHeader("CLONE PAIRS")) for i, pair := range response.ClonePairs { if pair == nil { continue } - fmt.Fprintf(writer, "%d. %s (similarity: %.3f, confidence: %.3f)\n", - i+1, pair.Type.String(), pair.Similarity, pair.Confidence) + fmt.Fprint(writer, utils.FormatLabelWithIndent(0, fmt.Sprintf("Pair %d", i+1), + fmt.Sprintf("%s (similarity: %.3f, confidence: %.3f)", pair.Type.String(), pair.Similarity, pair.Confidence))) if pair.Clone1 != nil && pair.Clone1.Location != nil { - fmt.Fprintf(writer, " Clone 1: %s (%d lines, %d nodes)\n", - pair.Clone1.Location.String(), pair.Clone1.LineCount, pair.Clone1.Size) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Clone 1", + fmt.Sprintf("%s (%d lines, %d nodes)", pair.Clone1.Location.String(), pair.Clone1.LineCount, pair.Clone1.Size))) } if pair.Clone2 != nil && pair.Clone2.Location != nil { - fmt.Fprintf(writer, " Clone 2: %s (%d lines, %d nodes)\n", - pair.Clone2.Location.String(), pair.Clone2.LineCount, pair.Clone2.Size) + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Clone 2", + fmt.Sprintf("%s (%d lines, %d nodes)", pair.Clone2.Location.String(), pair.Clone2.LineCount, pair.Clone2.Size))) } if response.Request != nil && response.Request.ShowContent && pair.Clone1 != nil && pair.Clone1.Content != "" { - fmt.Fprintf(writer, " Content preview:\n") + fmt.Fprint(writer, utils.FormatLabelWithIndent(SectionPadding, "Preview", "")) lines := strings.Split(pair.Clone1.Content, "\n") for j, line := range lines { if j >= 5 { // Limit preview to 5 lines - fmt.Fprintf(writer, " ...\n") + fmt.Fprintf(writer, "%s...\n", strings.Repeat(" ", ItemPadding+2)) break } - fmt.Fprintf(writer, " %s\n", line) + fmt.Fprintf(writer, "%s%s\n", strings.Repeat(" ", ItemPadding+2), line) } } - fmt.Fprintf(writer, "\n") + fmt.Fprint(writer, "\n") } } diff --git a/service/dead_code_formatter.go b/service/dead_code_formatter.go index 60c8df4..6bf3427 100644 --- a/service/dead_code_formatter.go +++ b/service/dead_code_formatter.go @@ -54,7 +54,7 @@ func (f *DeadCodeFormatterImpl) Write(response *domain.DeadCodeResponse, format func (f *DeadCodeFormatterImpl) FormatFinding(finding domain.DeadCodeFinding, format domain.OutputFormat) (string, error) { switch format { case domain.OutputFormatText: - return f.formatFindingText(finding), nil + return f.formatFindingTextLegacy(finding), nil case domain.OutputFormatJSON: return EncodeJSON(finding) case domain.OutputFormatYAML: @@ -62,7 +62,7 @@ func (f *DeadCodeFormatterImpl) FormatFinding(finding domain.DeadCodeFinding, fo case domain.OutputFormatHTML: // HTML formatting for individual findings is not typically needed // Fall back to text format for individual findings - return f.formatFindingText(finding), nil + return f.formatFindingTextLegacy(finding), nil default: return "", domain.NewUnsupportedFormatError(string(format)) } @@ -71,60 +71,93 @@ func (f *DeadCodeFormatterImpl) FormatFinding(finding domain.DeadCodeFinding, fo // formatText formats the response as human-readable text func (f *DeadCodeFormatterImpl) formatText(response *domain.DeadCodeResponse) (string, error) { var output strings.Builder + utils := NewFormatUtils() // Header - output.WriteString("Dead Code Detection Results\n") - output.WriteString("============================\n\n") + output.WriteString(utils.FormatMainHeader("Dead Code Analysis Report")) // Summary - output.WriteString(fmt.Sprintf("Files analyzed: %d\n", response.Summary.TotalFiles)) - output.WriteString(fmt.Sprintf("Files with dead code: %d\n", response.Summary.FilesWithDeadCode)) - output.WriteString(fmt.Sprintf("Total findings: %d\n", response.Summary.TotalFindings)) - output.WriteString(fmt.Sprintf("Functions analyzed: %d\n", response.Summary.TotalFunctions)) - output.WriteString(fmt.Sprintf("Functions with dead code: %d\n\n", response.Summary.FunctionsWithDeadCode)) + stats := map[string]interface{}{ + "Total Files": response.Summary.TotalFiles, + "Files with Dead Code": response.Summary.FilesWithDeadCode, + "Total Findings": response.Summary.TotalFindings, + "Functions Analyzed": response.Summary.TotalFunctions, + "Functions with Issues": response.Summary.FunctionsWithDeadCode, + } + output.WriteString(utils.FormatSummaryStats(stats)) - // Severity breakdown - output.WriteString("Severity Breakdown:\n") - output.WriteString(fmt.Sprintf(" Critical: %d\n", response.Summary.CriticalFindings)) - output.WriteString(fmt.Sprintf(" Warning: %d\n", response.Summary.WarningFindings)) - output.WriteString(fmt.Sprintf(" Info: %d\n\n", response.Summary.InfoFindings)) + // Severity distribution (using standard risk levels) + output.WriteString(utils.FormatRiskDistribution( + response.Summary.CriticalFindings, // Map Critical to High + response.Summary.WarningFindings, // Map Warning to Medium + response.Summary.InfoFindings)) // Map Info to Low - // Files with findings - for _, file := range response.Files { - output.WriteString(fmt.Sprintf("File: %s\n", file.FilePath)) - output.WriteString(strings.Repeat("=", len(file.FilePath)+6) + "\n") + // File Details + if len(response.Files) > 0 && response.Summary.TotalFindings > 0 { + output.WriteString(utils.FormatSectionHeader("DETAILED FINDINGS")) - for _, function := range file.Functions { - output.WriteString(fmt.Sprintf("\nFunction: %s\n", function.Name)) - for _, finding := range function.Findings { - output.WriteString(f.formatFindingText(finding) + "\n") + for _, file := range response.Files { + if len(file.Functions) > 0 { + output.WriteString(utils.FormatLabelWithIndent(0, "File", file.FilePath)) + output.WriteString(strings.Repeat("-", HeaderWidth) + "\n") + + for _, function := range file.Functions { + if len(function.Findings) > 0 { + output.WriteString(utils.FormatLabelWithIndent(SectionPadding, "Function", function.Name)) + for _, finding := range function.Findings { + output.WriteString(f.formatFindingText(finding, utils) + "\n") + } + output.WriteString("\n") + } + } } } - output.WriteString("\n") + output.WriteString(utils.FormatSectionSeparator()) } - // Warnings and errors + // Warnings if len(response.Warnings) > 0 { - output.WriteString("Warnings:\n") - for _, warning := range response.Warnings { - output.WriteString(fmt.Sprintf(" - %s\n", warning)) - } - output.WriteString("\n") + output.WriteString(utils.FormatWarningsSection(response.Warnings)) } + // Errors if len(response.Errors) > 0 { - output.WriteString("Errors:\n") + output.WriteString(utils.FormatSectionHeader("ERRORS")) for _, error := range response.Errors { - output.WriteString(fmt.Sprintf(" - %s\n", error)) + output.WriteString(utils.FormatLabelWithIndent(SectionPadding, "❌", error)) } - output.WriteString("\n") + output.WriteString(utils.FormatSectionSeparator()) } return output.String(), nil } // formatFindingText formats a single finding as text -func (f *DeadCodeFormatterImpl) formatFindingText(finding domain.DeadCodeFinding) string { +func (f *DeadCodeFormatterImpl) formatFindingText(finding domain.DeadCodeFinding, utils *FormatUtils) string { + // Convert severity to standard risk level + var standardRisk RiskLevel + switch finding.Severity { + case "critical": + standardRisk = RiskHigh + case "warning": + standardRisk = RiskMedium + case "info": + standardRisk = RiskLow + default: + standardRisk = RiskLow + } + + coloredSeverity := utils.FormatRiskWithColor(standardRisk) + return fmt.Sprintf(" [%s] Line %d-%d: %s (%s)", + coloredSeverity, + finding.Location.StartLine, + finding.Location.EndLine, + finding.Description, + finding.Reason) +} + +// Keep the old method for backward compatibility with FormatFinding +func (f *DeadCodeFormatterImpl) formatFindingTextLegacy(finding domain.DeadCodeFinding) string { return fmt.Sprintf(" [%s] Line %d-%d: %s (%s)", strings.ToUpper(string(finding.Severity)), finding.Location.StartLine, diff --git a/service/dead_code_service.go b/service/dead_code_service.go index 86d5269..972d327 100644 --- a/service/dead_code_service.go +++ b/service/dead_code_service.go @@ -153,7 +153,7 @@ func (s *DeadCodeServiceImpl) analyzeFile(ctx context.Context, filePath string, continue } - deadCodeResults := analyzer.DetectInFunction(cfg) + deadCodeResults := analyzer.DetectInFunctionWithFilePath(cfg, filePath) if deadCodeResults == nil { warnings = append(warnings, fmt.Sprintf("[%s:%s] Failed to analyze dead code for function", filePath, functionName)) continue diff --git a/service/format_utils.go b/service/format_utils.go index 4f8faba..a1e9c1c 100644 --- a/service/format_utils.go +++ b/service/format_utils.go @@ -2,7 +2,9 @@ package service import ( "encoding/json" + "fmt" "io" + "strings" "github.com/ludo-technologies/pyscn/domain" "gopkg.in/yaml.v3" @@ -47,3 +49,176 @@ func WriteYAML(w io.Writer, v interface{}) error { return nil } +// Standard formatting constants +const ( + HeaderWidth = 40 + LabelWidth = 25 + SectionPadding = 2 + ItemPadding = 4 +) + +// ANSI color codes for consistent color usage +const ( + ColorReset = "\x1b[0m" + ColorRed = "\x1b[31m" + ColorYellow = "\x1b[33m" + ColorGreen = "\x1b[32m" + ColorCyan = "\x1b[36m" + ColorBold = "\x1b[1m" +) + +// RiskLevel represents the standard risk levels across all tools +type RiskLevel string + +const ( + RiskHigh RiskLevel = "High" + RiskMedium RiskLevel = "Medium" + RiskLow RiskLevel = "Low" +) + +// FormatUtils provides shared formatting utilities +type FormatUtils struct{} + +// NewFormatUtils creates a new format utilities instance +func NewFormatUtils() *FormatUtils { + return &FormatUtils{} +} + +// FormatMainHeader creates a standardized main header +func (f *FormatUtils) FormatMainHeader(title string) string { + var builder strings.Builder + builder.WriteString(title + "\n") + builder.WriteString(strings.Repeat("=", HeaderWidth) + "\n\n") + return builder.String() +} + +// FormatSectionHeader creates a standardized section header +func (f *FormatUtils) FormatSectionHeader(title string) string { + var builder strings.Builder + builder.WriteString(strings.ToUpper(title) + "\n") + builder.WriteString(strings.Repeat("-", len(title)) + "\n") + return builder.String() +} + +// FormatSectionSeparator creates a section separator +func (f *FormatUtils) FormatSectionSeparator() string { + return "\n" +} + +// FormatLabel creates a consistently formatted label with right alignment +func (f *FormatUtils) FormatLabel(label string, value interface{}) string { + padding := LabelWidth - len(label) + if padding < 0 { + padding = 0 + } + return fmt.Sprintf("%s%s: %v\n", strings.Repeat(" ", padding), label, value) +} + +// FormatLabelWithIndent creates a formatted label with specific indentation +func (f *FormatUtils) FormatLabelWithIndent(indent int, label string, value interface{}) string { + return fmt.Sprintf("%s%s: %v\n", strings.Repeat(" ", indent), label, value) +} + +// FormatPercentage formats a percentage value consistently +func (f *FormatUtils) FormatPercentage(value float64) string { + return fmt.Sprintf("%.1f%%", value) +} + +// FormatDuration formats duration in milliseconds consistently +func (f *FormatUtils) FormatDuration(durationMs int64) string { + return fmt.Sprintf("%dms", durationMs) +} + +// GetRiskColor returns the appropriate color for a risk level +func (f *FormatUtils) GetRiskColor(risk RiskLevel) string { + switch risk { + case RiskHigh: + return ColorRed + case RiskMedium: + return ColorYellow + case RiskLow: + return ColorGreen + default: + return ColorReset + } +} + +// FormatRiskWithColor formats a risk level with appropriate color +func (f *FormatUtils) FormatRiskWithColor(risk RiskLevel) string { + color := f.GetRiskColor(risk) + return fmt.Sprintf("%s%s%s", color, string(risk), ColorReset) +} + +// FormatTableHeader creates a table header with consistent formatting +func (f *FormatUtils) FormatTableHeader(columns ...string) string { + header := strings.Join(columns, " ") + separator := strings.Repeat("-", len(header)) + return header + "\n" + separator + "\n" +} + +// FormatSummaryStats creates a standardized summary statistics section +func (f *FormatUtils) FormatSummaryStats(stats map[string]interface{}) string { + var builder strings.Builder + builder.WriteString(f.FormatSectionHeader("SUMMARY")) + + for label, value := range stats { + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, label, value)) + } + + builder.WriteString(f.FormatSectionSeparator()) + return builder.String() +} + +// FormatRiskDistribution creates a standardized risk distribution section +func (f *FormatUtils) FormatRiskDistribution(high, medium, low int) string { + var builder strings.Builder + builder.WriteString(f.FormatSectionHeader("RISK DISTRIBUTION")) + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, "High", high)) + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, "Medium", medium)) + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, "Low", low)) + builder.WriteString(f.FormatSectionSeparator()) + return builder.String() +} + +// FormatWarningsSection creates a standardized warnings section +func (f *FormatUtils) FormatWarningsSection(warnings []string) string { + if len(warnings) == 0 { + return "" + } + + var builder strings.Builder + builder.WriteString(f.FormatSectionHeader("WARNINGS")) + + for _, warning := range warnings { + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, "⚠", warning)) + } + + builder.WriteString(f.FormatSectionSeparator()) + return builder.String() +} + +// ConvertToStandardRisk converts various risk representations to standard format +func (f *FormatUtils) ConvertToStandardRisk(risk string) RiskLevel { + switch strings.ToLower(risk) { + case "high", "critical", "error": + return RiskHigh + case "medium", "warning", "warn": + return RiskMedium + case "low", "info", "information": + return RiskLow + default: + return RiskLow + } +} + +// FormatFileStats creates standardized file statistics +func (f *FormatUtils) FormatFileStats(analyzed, total, withIssues int) string { + var builder strings.Builder + builder.WriteString(f.FormatSectionHeader("FILE STATISTICS")) + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, "Total Files", total)) + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, "Analyzed", analyzed)) + builder.WriteString(f.FormatLabelWithIndent(SectionPadding, "With Issues", withIssues)) + builder.WriteString(f.FormatSectionSeparator()) + return builder.String() +} + diff --git a/service/output_formatter.go b/service/output_formatter.go index daa1788..c797e5b 100644 --- a/service/output_formatter.go +++ b/service/output_formatter.go @@ -55,66 +55,75 @@ func (f *OutputFormatterImpl) Write(response *domain.ComplexityResponse, format // formatText formats the response as human-readable text func (f *OutputFormatterImpl) formatText(response *domain.ComplexityResponse) (string, error) { var builder strings.Builder + utils := NewFormatUtils() // Header - builder.WriteString("Complexity Analysis Report\n") - builder.WriteString("==========================\n\n") + builder.WriteString(utils.FormatMainHeader("Complexity Analysis Report")) // Summary - builder.WriteString("Summary:\n") - builder.WriteString(fmt.Sprintf(" Total Functions: %d\n", response.Summary.TotalFunctions)) - if response.Summary.TotalFunctions > 0 { - builder.WriteString(fmt.Sprintf(" Average Complexity: %.2f\n", response.Summary.AverageComplexity)) - builder.WriteString(fmt.Sprintf(" Max Complexity: %d\n", response.Summary.MaxComplexity)) - builder.WriteString(fmt.Sprintf(" Min Complexity: %d\n", response.Summary.MinComplexity)) + stats := map[string]interface{}{ + "Total Functions": response.Summary.TotalFunctions, + "Files Analyzed": response.Summary.FilesAnalyzed, } - builder.WriteString("\n") + if response.Summary.TotalFunctions > 0 { + stats["Average Complexity"] = fmt.Sprintf("%.1f", response.Summary.AverageComplexity) + stats["Max Complexity"] = response.Summary.MaxComplexity + stats["Min Complexity"] = response.Summary.MinComplexity + } + builder.WriteString(utils.FormatSummaryStats(stats)) // Risk Distribution - builder.WriteString("Risk Distribution:\n") - builder.WriteString(fmt.Sprintf(" High: %d\n", response.Summary.HighRiskFunctions)) - builder.WriteString(fmt.Sprintf(" Medium: %d\n", response.Summary.MediumRiskFunctions)) - builder.WriteString(fmt.Sprintf(" Low: %d\n", response.Summary.LowRiskFunctions)) - builder.WriteString("\n") + builder.WriteString(utils.FormatRiskDistribution( + response.Summary.HighRiskFunctions, + response.Summary.MediumRiskFunctions, + response.Summary.LowRiskFunctions)) // Function Details if len(response.Functions) > 0 { - builder.WriteString("Function Details:\n") - builder.WriteString("Function Complexity Risk\n") - builder.WriteString("------------------------------------------------\n") + builder.WriteString(utils.FormatSectionHeader("FUNCTION DETAILS")) + builder.WriteString(utils.FormatTableHeader("Function", "Complexity", "Risk")) for _, function := range response.Functions { - color := f.getRiskColor(function.RiskLevel) - builder.WriteString(fmt.Sprintf("%-30s %10d %s%8s\x1b[0m\n", + // Convert domain risk level to standard risk level + var standardRisk RiskLevel + switch function.RiskLevel { + case "High": + standardRisk = RiskHigh + case "Medium": + standardRisk = RiskMedium + case "Low": + standardRisk = RiskLow + default: + standardRisk = RiskLow + } + + coloredRisk := utils.FormatRiskWithColor(standardRisk) + builder.WriteString(fmt.Sprintf("%-30s %10d %s\n", function.Name, function.Metrics.Complexity, - color, - function.RiskLevel)) + coloredRisk)) } - builder.WriteString("\n") + builder.WriteString(utils.FormatSectionSeparator()) } // Warnings if len(response.Warnings) > 0 { - builder.WriteString("Warnings:\n") - for _, warning := range response.Warnings { - builder.WriteString(fmt.Sprintf(" ⚠️ %s\n", warning)) - } - builder.WriteString("\n") + builder.WriteString(utils.FormatWarningsSection(response.Warnings)) } // Errors if len(response.Errors) > 0 { - builder.WriteString("Errors:\n") + builder.WriteString(utils.FormatSectionHeader("ERRORS")) for _, err := range response.Errors { - builder.WriteString(fmt.Sprintf(" ❌ %s\n", err)) + builder.WriteString(utils.FormatLabelWithIndent(SectionPadding, "❌", err)) } - builder.WriteString("\n") + builder.WriteString(utils.FormatSectionSeparator()) } // Footer if parsedTime, err := time.Parse(time.RFC3339, response.GeneratedAt); err == nil { - builder.WriteString(fmt.Sprintf("Generated at: %s\n", parsedTime.Format("2006-01-02T15:04:05-07:00"))) + builder.WriteString(utils.FormatSectionHeader("METADATA")) + builder.WriteString(utils.FormatLabelWithIndent(SectionPadding, "Generated at", parsedTime.Format("2006-01-02T15:04:05-07:00"))) } return builder.String(), nil diff --git a/testdata/python/complex/dead_code_complex.py b/testdata/python/complex/dead_code_complex.py new file mode 100644 index 0000000..148aa74 --- /dev/null +++ b/testdata/python/complex/dead_code_complex.py @@ -0,0 +1,185 @@ +""" +Complex dead code patterns for advanced testing. +""" + +import sys +from typing import Optional, Union + + +def complex_control_flow(): + """Complex function with multiple dead code patterns.""" + state = "initial" + result = [] + + try: + if state == "initial": + state = "processing" + + for i in range(10): + if i > 5: + raise StopIteration("Processing complete") + result.append(i) + + # Dead code - loop always raises exception + print("Loop completed normally") + state = "completed" + + except StopIteration: + return result + # Dead code after return in exception handler + print("Exception handled") + state = "error" + + # Dead code - function always returns in exception handler + print("Function end") + return [] + + +def generator_with_dead_code(): + """Generator function with dead code.""" + yield 1 + yield 2 + return # Early return in generator + + # Dead code after return + yield 3 + yield 4 + + +async def async_dead_code(): + """Async function with dead code.""" + import asyncio + + await asyncio.sleep(0.1) + return "async result" + + # Dead code after return + await asyncio.sleep(1.0) + return "never reached" + + +def context_manager_dead_code(): + """Function with dead code in context manager.""" + class CustomContext: + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if exc_type: + return True # Suppress exception + + with CustomContext(): + raise ValueError("Test exception") + # Dead code after raise + print("This won't execute") + + # This code is reachable due to exception suppression + return "context completed" + + +def decorator_dead_code(): + """Function with dead code in decorator pattern.""" + def early_return_decorator(func): + def wrapper(*args, **kwargs): + return "decorator result" + # Dead code in decorator + result = func(*args, **kwargs) + return f"decorated: {result}" + return wrapper + + @early_return_decorator + def decorated_function(): + print("Original function") + return "original result" + + return decorated_function() + + +def class_method_dead_code(): + """Function demonstrating dead code in class methods.""" + + class TestClass: + def __init__(self): + self.value = 10 + return # Early return in __init__ + # Dead code + self.other_value = 20 + self._setup() + + def _setup(self): + """This method is never called.""" + self.configured = True + + def method_with_dead_code(self): + if self.value > 0: + return self.value * 2 + + # Dead code - value is always > 0 + print("Negative value handling") + return 0 + + obj = TestClass() + return obj.method_with_dead_code() + + +def lambda_dead_code(): + """Function with dead code involving lambdas.""" + always_true = True + + if always_true: + func = lambda x: x * 2 + return func(5) + + # Dead code - condition always true + func = lambda x: x * 3 + return func(5) + + +def comprehension_dead_code(): + """Function with dead code in comprehensions.""" + data = [1, 2, 3, 4, 5] + + if len(data) > 0: + return [x * 2 for x in data if x > 0] + + # Dead code - data always has length > 0 + return [x for x in data if x < 0] + + +def exception_hierarchy_dead_code(): + """Function with dead code in exception hierarchy.""" + try: + raise ValueError("Test error") + except Exception: + return "caught general exception" + except ValueError: + # Dead code - ValueError is already caught by Exception + return "caught specific exception" + + # Dead code - exception always caught + return "no exception" + + +def finally_block_patterns(): + """Function demonstrating dead code with finally blocks.""" + try: + return "try block result" + # Dead code after return in try block + print("After return in try") + except Exception: + return "exception result" + # Dead code after return in except block + print("After return in except") + finally: + # This code is reachable - finally always executes + print("Finally block executes") + return "finally result" # This overrides other returns + + # Dead code after try-except-finally + return "end of function" + + +if __name__ == "__main__": + print(complex_control_flow()) + print(class_method_dead_code()) + print(comprehension_dead_code()) \ No newline at end of file diff --git a/testdata/python/edge_cases/dead_code_examples.py b/testdata/python/edge_cases/dead_code_examples.py new file mode 100644 index 0000000..b519c79 --- /dev/null +++ b/testdata/python/edge_cases/dead_code_examples.py @@ -0,0 +1,174 @@ +""" +Examples of dead code patterns for testing dead code detection. +This file contains various types of unreachable code. +""" + + +def unreachable_after_return(): + """Function with code after return statement.""" + x = 10 + if x > 5: + return "greater than 5" + + # This code is unreachable - dead code + print("This will never execute") + return "fallback" + + +def unreachable_after_raise(): + """Function with code after raise statement.""" + value = None + if value is None: + raise ValueError("Value cannot be None") + + # This code is unreachable - dead code + print("This will never execute") + return value * 2 + + +def unreachable_conditional_branch(): + """Function with unreachable conditional branches.""" + debug_mode = False + + if debug_mode: + print("Debug mode enabled") + else: + print("Normal mode") + + # This condition will never be True - dead code + if debug_mode and not debug_mode: + print("This is impossible") + return "impossible" + + return "normal" + + +def unreachable_after_break(): + """Function with code after break statement.""" + items = [1, 2, 3, 4, 5] + + for item in items: + if item == 3: + break + # This code is unreachable - dead code + print(f"Processing {item}") + item += 1 + + return "done" + + +def unreachable_after_continue(): + """Function with code after continue statement.""" + numbers = [1, 2, 3, 4, 5] + result = [] + + for num in numbers: + if num % 2 == 0: + continue + # This code is unreachable - dead code + print(f"Even number: {num}") + result.append(num) + result.append(num) + + return result + + +def multiple_returns_with_dead_code(): + """Function with multiple return statements and dead code.""" + status = "active" + + if status == "active": + return "User is active" + elif status == "inactive": + return "User is inactive" + else: + return "Unknown status" + + # This code is unreachable - dead code + print("This should never execute") + status = "processed" + return f"Status: {status}" + + +def nested_dead_code(): + """Function with nested dead code patterns.""" + data = {"valid": True} + + if data.get("valid"): + if True: # Always true condition + return "valid data" + # Dead code after return in nested block + print("Never reached in nested block") + + # Dead code - the inner if always returns + print("Never reached in outer block") + + # Dead code - the outer if always returns + return "invalid data" + + +class DeadCodeClass: + """Class with dead code examples.""" + + def __init__(self): + self.active = True + return # Early return in __init__ + # Dead code after return + self.inactive = False + self.setup() + + def setup(self): + """This method is never called due to dead code in __init__.""" + print("Setting up...") + return True + + def method_with_dead_code(self): + """Method with unreachable code.""" + if self.active: + return "active" + + # Dead code - method always returns above + print("This is dead code") + self.active = False + return "inactive" + + +def infinite_loop_with_break(): + """Function with unreachable code after infinite loop.""" + counter = 0 + + while True: + counter += 1 + if counter > 10: + break + + # This code is reachable - NOT dead code + print(f"Counter reached: {counter}") + + while True: + print("Infinite loop") + return "exited" + + # This code is unreachable - dead code + print("After infinite loop") + return "never reached" + + +def early_exit_pattern(): + """Function with early exit patterns.""" + import sys + + condition = False + if not condition: + sys.exit(1) + + # This code is unreachable if condition is always False - dead code + print("After sys.exit") + return "completed" + + +if __name__ == "__main__": + # Test the functions + print(unreachable_after_return()) + print(unreachable_conditional_branch()) + # Note: unreachable_after_raise() would raise an exception \ No newline at end of file diff --git a/testdata/python/simple/dead_code_simple.py b/testdata/python/simple/dead_code_simple.py new file mode 100644 index 0000000..004e3a7 --- /dev/null +++ b/testdata/python/simple/dead_code_simple.py @@ -0,0 +1,66 @@ +""" +Simple examples of dead code for testing. +""" + + +def simple_dead_code(): + """Simple function with dead code after return.""" + name = "test" + return f"Hello, {name}" + + # Dead code - unreachable + print("This line will never execute") + name = "updated" + + +def conditional_dead_code(): + """Function with dead code in conditional.""" + always_true = True + + if always_true: + return "always returns here" + + # Dead code - condition is always true + print("This is unreachable") + return "never reached" + + +def loop_with_dead_code(): + """Function with dead code after loop break.""" + for i in range(5): + if i == 2: + break + # Dead code after break + print(f"Processing {i}") + print(f"Number: {i}") + + return "loop completed" + + +def exception_dead_code(): + """Function with dead code after exception.""" + data = None + + if data is None: + raise ValueError("Data is required") + + # Dead code - exception always raised + print("Processing data") + return len(data) + + +def nested_return_dead_code(): + """Function with nested returns and dead code.""" + status = "ok" + + if status == "ok": + if True: + return "success" + # Dead code in nested block + print("Never reached nested") + + # Dead code in outer block + print("Never reached outer") + + # Dead code at function level + return "failure" \ No newline at end of file