Skip to content

Commit 5349292

Browse files
committed
Remove remaining Metrics/ references and Fingerprint functionality
1 parent 1235ced commit 5349292

File tree

6 files changed

+6
-127
lines changed

6 files changed

+6
-127
lines changed

lib/cc/engine/category_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ def category
1616
"Lint" => "Style",
1717
"Lint/Eval" => "Security",
1818
"Metrics" => "Complexity",
19-
"Metrics/LineLength" => "Style",
2019
"Performance" => "Bug Risk",
2120
"Rails" => "Bug Risk",
2221
"Rails/ActionFilter" => "Style",
2322
"Rails/Delegate" => "Clarity",
2423
"Rails/HasAndBelongsToMany" => "Style",
2524
"Rails/TimeZone" => "Style",
2625
"Rails/Validation" => "Style",
26+
"Standard/SemanticBlocks" => "Style",
2727
"Style" => "Style",
2828
"Migrations/RemoveIndex" => "Performance"
2929
}.freeze

lib/cc/engine/fingerprint.rb

Lines changed: 0 additions & 44 deletions
This file was deleted.

lib/cc/engine/issue.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def initialize(issue, path)
1414
@path = path
1515
end
1616

17-
# rubocop:disable Metrics/MethodLength
1817
def to_json(*_)
1918
hash = {
2019
type: "Issue",
@@ -29,13 +28,8 @@ def to_json(*_)
2928
}
3029
hash[:content] = {body: content_body} if content_body.present?
3130

32-
if (fingerprint = Fingerprint.new(path, cop_name, message).compute)
33-
hash[:fingerprint] = fingerprint
34-
end
35-
3631
hash.to_json
3732
end
38-
# rubocop:enable Metrics/MethodLength
3933

4034
def check_name
4135
"Rubocop/#{cop_name}"

lib/cc/engine/standard.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
require "cc/engine/category_parser"
99
require "cc/engine/file_list_resolver"
1010
require "cc/engine/issue"
11-
require "cc/engine/fingerprint" # TODO: delete? what's fingerprint?
1211
require "active_support"
1312
require "active_support/core_ext"
1413

spec/cc/engine/fingerprint_spec.rb

Lines changed: 0 additions & 54 deletions
This file was deleted.

spec/cc/engine/issue_spec.rb

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module CC::Engine
1212
location.last_column = 99
1313

1414
offense = OpenStruct.new
15-
offense.cop_name = "Metrics/CyclomaticComplexity"
16-
offense.message = "Cyclomatic complexity for complex_method is too high [10/5]"
15+
offense.cop_name = "Standard/SemanticBlocks"
16+
offense.message = "Prefer `{...}` over `do...end` for functional blocks."
1717
offense.location = location
1818
offense
1919
end
@@ -23,9 +23,9 @@ module CC::Engine
2323
attributes = JSON.parse(issue.to_json)
2424

2525
expect(attributes["type"]).to eq("Issue")
26-
expect(attributes["check_name"]).to eq("Rubocop/Metrics/CyclomaticComplexity")
27-
expect(attributes["description"]).to eq("Cyclomatic complexity for complex_method is too high [10/5]")
28-
expect(attributes["categories"]).to eq(["Complexity"])
26+
expect(attributes["check_name"]).to eq("Rubocop/Standard/SemanticBlocks")
27+
expect(attributes["description"]).to eq("Prefer `{...}` over `do...end` for functional blocks.")
28+
expect(attributes["categories"]).to eq(["Style"])
2929
expect(attributes["remediation_points"]).to eq(50_000)
3030
expect(attributes["location"]["path"]).to eq("app/models/user.rb")
3131
expect(attributes["location"]["positions"]["begin"]["line"]).to eq(10)
@@ -36,22 +36,6 @@ module CC::Engine
3636
"This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum."
3737
)
3838
end
39-
40-
it "sets a fingerprint for method/class offenses" do
41-
offense.cop_name = "Metrics/AbcSize"
42-
issue = Issue.new(offense, "app/models/user.rb")
43-
attributes = JSON.parse(issue.to_json)
44-
45-
expect(attributes).to have_key("fingerprint")
46-
end
47-
48-
it "does not set a fingerprint for other offenses" do
49-
offense.cop_name = "Style/AlignParameters"
50-
issue = Issue.new(offense, "app/models/user.rb")
51-
attributes = JSON.parse(issue.to_json)
52-
53-
expect(attributes).not_to have_key("fingerprint")
54-
end
5539
end
5640

5741
describe "#remediation points" do

0 commit comments

Comments
 (0)