File tree Expand file tree Collapse file tree 4 files changed +23
-15
lines changed Expand file tree Collapse file tree 4 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ def mass_threshold
36
36
engine_config . mass_threshold_for ( self . class ::LANGUAGE ) || self . class ::DEFAULT_MASS_THRESHOLD
37
37
end
38
38
39
- def calculate_points ( issue )
40
- self . class ::BASE_POINTS * issue . mass
39
+ def calculate_points ( mass )
40
+ self . class ::BASE_POINTS * mass
41
41
end
42
42
43
43
private
Original file line number Diff line number Diff line change @@ -14,16 +14,16 @@ class Main < CC::Engine::Analyzers::Base
14
14
DEFAULT_PATHS = [ "**/*.py" ]
15
15
DEFAULT_MASS_THRESHOLD = 32
16
16
BASE_POINTS = 1_500_000
17
- POINTS_PER_OVERAGE = 30_000
17
+ POINTS_PER_OVERAGE = 50_000
18
18
19
- def calculate_points ( issue )
20
- BASE_POINTS + ( overage ( issue ) * POINTS_PER_OVERAGE )
19
+ def calculate_points ( mass )
20
+ BASE_POINTS + ( overage ( mass ) * POINTS_PER_OVERAGE )
21
21
end
22
22
23
23
private
24
24
25
- def overage ( issue )
26
- issue . mass - mass_threshold
25
+ def overage ( mass )
26
+ mass - mass_threshold
27
27
end
28
28
29
29
def process_file ( path )
Original file line number Diff line number Diff line change @@ -22,14 +22,14 @@ class Main < CC::Engine::Analyzers::Base
22
22
POINTS_PER_OVERAGE = 100_000
23
23
TIMEOUT = 300
24
24
25
- def calculate_points ( issue )
26
- BASE_POINTS + ( overage ( issue ) * POINTS_PER_OVERAGE )
25
+ def calculate_points ( mass )
26
+ BASE_POINTS + ( overage ( mass ) * POINTS_PER_OVERAGE )
27
27
end
28
28
29
29
private
30
30
31
- def overage ( issue )
32
- issue . mass - mass_threshold
31
+ def overage ( mass )
32
+ mass - mass_threshold
33
33
end
34
34
35
35
def process_file ( file )
Original file line number Diff line number Diff line change @@ -32,10 +32,18 @@ def report_name
32
32
"#{ current_sexp . file } -#{ current_sexp . line } "
33
33
end
34
34
35
+ def mass
36
+ flay_score / occurrences # ABH Reverse engineer the actual mass.
37
+ end
38
+
35
39
private
36
40
37
41
attr_reader :language_strategy , :hashes
38
42
43
+ def flay_score
44
+ issue . mass
45
+ end
46
+
39
47
def current_sexp
40
48
@location ||= sorted_hashes . first
41
49
end
@@ -57,7 +65,7 @@ def check_name
57
65
end
58
66
59
67
def calculate_points
60
- language_strategy . calculate_points ( issue )
68
+ language_strategy . calculate_points ( mass )
61
69
end
62
70
63
71
def format_location
@@ -96,13 +104,13 @@ def fingerprint
96
104
end
97
105
98
106
def description
99
- description = "#{ check_name } found in #{ occurrences } other location"
100
- description += "s" if occurrences > 1
107
+ description = "#{ check_name } found in #{ occurrences - 1 } other location"
108
+ description += "s" if occurrences > 2
101
109
description
102
110
end
103
111
104
112
def occurrences
105
- other_sexps . count
113
+ other_sexps . count + 1
106
114
end
107
115
end
108
116
end
You can’t perform that action at this time.
0 commit comments