Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

include mass in description #77

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cc/engine/analyzers/violation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def fingerprint
def description
description = "#{check_name} found in #{occurrences} other location"
description += "s" if occurrences > 1
description
description += " (mass = #{issue.mass})"
end

def occurrences
Expand Down
4 changes: 2 additions & 2 deletions spec/cc/engine/analyzers/javascript/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

expect(json["type"]).to eq("issue")
expect(json["check_name"]).to eq("Identical code")
expect(json["description"]).to eq("Identical code found in 2 other locations")
expect(json["description"]).to eq("Identical code found in 2 other locations (mass = 99)")
expect(json["categories"]).to eq(["Duplication"])
expect(json["location"]).to eq({
"path" => "foo.js",
Expand All @@ -48,7 +48,7 @@

expect(json["type"]).to eq("issue")
expect(json["check_name"]).to eq("Similar code")
expect(json["description"]).to eq("Similar code found in 2 other locations")
expect(json["description"]).to eq("Similar code found in 2 other locations (mass = 33)")
expect(json["categories"]).to eq(["Duplication"])
expect(json["location"]).to eq({
"path" => "foo.js",
Expand Down
7 changes: 1 addition & 6 deletions spec/cc/engine/analyzers/php/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

expect(json["type"]).to eq("issue")
expect(json["check_name"]).to eq("Identical code")
expect(json["description"]).to eq("Identical code found in 1 other location")
expect(json["description"]).to eq("Identical code found in 1 other location (mass = 44)")
expect(json["categories"]).to eq(["Duplication"])
expect(json["location"]).to eq({
"path" => "foo.php",
Expand Down Expand Up @@ -91,11 +91,6 @@
end
end

def printed_issue
issue = {"type":"issue","check_name":"Identical code","description":"Similar code found in 1 other location","categories":["Duplication"],"location":{"path":"foo.php","lines":{"begin":2,"end":6}},"remediation_points":176000,"other_locations":[{"path":"foo.php","lines":{"begin":10,"end":14}}],"content":{"body": read_up}}
issue.to_json + "\0\n"
end

def engine_conf
CC::Engine::Analyzers::EngineConfig.new({
'config' => {
Expand Down
4 changes: 2 additions & 2 deletions spec/cc/engine/analyzers/python/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

expect(json["type"]).to eq("issue")
expect(json["check_name"]).to eq("Identical code")
expect(json["description"]).to eq("Identical code found in 2 other locations")
expect(json["description"]).to eq("Identical code found in 2 other locations (mass = 54)")
expect(json["categories"]).to eq(["Duplication"])
expect(json["location"]).to eq({
"path" => "foo.py",
Expand All @@ -48,7 +48,7 @@

expect(json["type"]).to eq("issue")
expect(json["check_name"]).to eq("Similar code")
expect(json["description"]).to eq("Similar code found in 2 other locations")
expect(json["description"]).to eq("Similar code found in 2 other locations (mass = 18)")
expect(json["categories"]).to eq(["Duplication"])
expect(json["location"]).to eq({
"path" => "foo.py",
Expand Down
2 changes: 1 addition & 1 deletion spec/cc/engine/analyzers/ruby/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module CC::Engine::Analyzers

expect(json["type"]).to eq("issue")
expect(json["check_name"]).to eq("Similar code")
expect(json["description"]).to eq("Similar code found in 1 other location")
expect(json["description"]).to eq("Similar code found in 1 other location (mass = 36)")
expect(json["categories"]).to eq(["Duplication"])
expect(json["location"]).to eq({
"path" => "foo.rb",
Expand Down