This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
lib/cc/engine/analyzers/python
spec/cc/engine/analyzers/python Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,20 @@ module Python
1212 class Main < CC ::Engine ::Analyzers ::Base
1313 LANGUAGE = "python"
1414 DEFAULT_PATHS = [ "**/*.py" ]
15- DEFAULT_MASS_THRESHOLD = 40
16- BASE_POINTS = 1000
15+ DEFAULT_MASS_THRESHOLD = 32
16+ BASE_POINTS = 1_500_000
17+ POINTS_PER_OVERAGE = 50_000
18+
19+ def calculate_points ( mass )
20+ BASE_POINTS + ( overage ( mass ) * POINTS_PER_OVERAGE )
21+ end
1722
1823 private
1924
25+ def overage ( mass )
26+ mass - mass_threshold
27+ end
28+
2029 def process_file ( path )
2130 Node . new ( ::CC ::Engine ::Analyzers ::Python ::Parser . new ( File . binread ( path ) , path ) . parse . syntax_tree , path ) . format
2231 end
Original file line number Diff line number Diff line change 2828 "path" => "foo.py" ,
2929 "lines" => { "begin" => 1 , "end" => 1 } ,
3030 } )
31- expect ( json [ "remediation_points" ] ) . to eq ( 6_000 )
31+ expect ( json [ "remediation_points" ] ) . to eq ( 1_600_000 )
3232 expect ( json [ "other_locations" ] ) . to eq ( [
3333 { "path" => "foo.py" , "lines" => { "begin" => 2 , "end" => 2 } } ,
3434 { "path" => "foo.py" , "lines" => { "begin" => 3 , "end" => 3 } }
5656 "path" => "foo.py" ,
5757 "lines" => { "begin" => 1 , "end" => 1 } ,
5858 } )
59- expect ( json [ "remediation_points" ] ) . to eq ( 6_000 )
59+ expect ( json [ "remediation_points" ] ) . to eq ( 1_600_000 )
6060 expect ( json [ "other_locations" ] ) . to eq ( [
6161 { "path" => "foo.py" , "lines" => { "begin" => 2 , "end" => 2 } } ,
6262 { "path" => "foo.py" , "lines" => { "begin" => 3 , "end" => 3 } }
You can’t perform that action at this time.
0 commit comments