File tree 2 files changed +13
-4
lines changed
lib/cc/engine/analyzers/python
spec/cc/engine/analyzers/python
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,20 @@ module Python
12
12
class Main < CC ::Engine ::Analyzers ::Base
13
13
LANGUAGE = "python"
14
14
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
17
22
18
23
private
19
24
25
+ def overage ( mass )
26
+ mass - mass_threshold
27
+ end
28
+
20
29
def process_file ( path )
21
30
Node . new ( ::CC ::Engine ::Analyzers ::Python ::Parser . new ( File . binread ( path ) , path ) . parse . syntax_tree , path ) . format
22
31
end
Original file line number Diff line number Diff line change 28
28
"path" => "foo.py" ,
29
29
"lines" => { "begin" => 1 , "end" => 1 } ,
30
30
} )
31
- expect ( json [ "remediation_points" ] ) . to eq ( 6_000 )
31
+ expect ( json [ "remediation_points" ] ) . to eq ( 1_600_000 )
32
32
expect ( json [ "other_locations" ] ) . to eq ( [
33
33
{ "path" => "foo.py" , "lines" => { "begin" => 2 , "end" => 2 } } ,
34
34
{ "path" => "foo.py" , "lines" => { "begin" => 3 , "end" => 3 } }
56
56
"path" => "foo.py" ,
57
57
"lines" => { "begin" => 1 , "end" => 1 } ,
58
58
} )
59
- expect ( json [ "remediation_points" ] ) . to eq ( 6_000 )
59
+ expect ( json [ "remediation_points" ] ) . to eq ( 1_600_000 )
60
60
expect ( json [ "other_locations" ] ) . to eq ( [
61
61
{ "path" => "foo.py" , "lines" => { "begin" => 2 , "end" => 2 } } ,
62
62
{ "path" => "foo.py" , "lines" => { "begin" => 3 , "end" => 3 } }
You can’t perform that action at this time.
0 commit comments