diff --git a/lib/cc/engine/analyzers/python/main.rb b/lib/cc/engine/analyzers/python/main.rb index 6ec2ca50..fb4b8013 100644 --- a/lib/cc/engine/analyzers/python/main.rb +++ b/lib/cc/engine/analyzers/python/main.rb @@ -12,11 +12,20 @@ module Python class Main < CC::Engine::Analyzers::Base LANGUAGE = "python" DEFAULT_PATHS = ["**/*.py"] - DEFAULT_MASS_THRESHOLD = 40 - BASE_POINTS = 1000 + DEFAULT_MASS_THRESHOLD = 32 + BASE_POINTS = 1_500_000 + POINTS_PER_OVERAGE = 50_000 + + def calculate_points(mass) + BASE_POINTS + (overage(mass) * POINTS_PER_OVERAGE) + end private + def overage(mass) + mass - mass_threshold + end + def process_file(path) Node.new(::CC::Engine::Analyzers::Python::Parser.new(File.binread(path), path).parse.syntax_tree, path).format end diff --git a/spec/cc/engine/analyzers/python/main_spec.rb b/spec/cc/engine/analyzers/python/main_spec.rb index d6496f93..bcf80b98 100644 --- a/spec/cc/engine/analyzers/python/main_spec.rb +++ b/spec/cc/engine/analyzers/python/main_spec.rb @@ -28,7 +28,7 @@ "path" => "foo.py", "lines" => { "begin" => 1, "end" => 1 }, }) - expect(json["remediation_points"]).to eq(6_000) + expect(json["remediation_points"]).to eq(1_600_000) expect(json["other_locations"]).to eq([ {"path" => "foo.py", "lines" => { "begin" => 2, "end" => 2} }, {"path" => "foo.py", "lines" => { "begin" => 3, "end" => 3} } @@ -56,7 +56,7 @@ "path" => "foo.py", "lines" => { "begin" => 1, "end" => 1 }, }) - expect(json["remediation_points"]).to eq(6_000) + expect(json["remediation_points"]).to eq(1_600_000) expect(json["other_locations"]).to eq([ {"path" => "foo.py", "lines" => { "begin" => 2, "end" => 2} }, {"path" => "foo.py", "lines" => { "begin" => 3, "end" => 3} }