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

Commit 91af8e9

Browse files
committed
Merge pull request #39 from codeclimate/gd-other-locations
Don't show snippet in other locations
2 parents dbd3a3f + 8b66e4c commit 91af8e9

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

lib/cc/engine/analyzers/reporter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def mass_threshold
6666

6767
def new_violation(issue)
6868
hashes = flay.hashes[issue.structural_hash]
69-
Violation.new(language_strategy.base_points, issue, hashes, reports)
69+
Violation.new(language_strategy.base_points, issue, hashes)
7070
end
7171

7272
def flay_options

lib/cc/engine/analyzers/violation.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ module Analyzers
66
class Violation
77
attr_reader :issue
88

9-
def initialize(base_points, issue, hashes, reports)
9+
def initialize(base_points, issue, hashes)
1010
@base_points = base_points
1111
@issue = issue
1212
@hashes = hashes
13-
@reports = reports
1413
end
1514

1615
def format
@@ -33,7 +32,7 @@ def report_name
3332

3433
private
3534

36-
attr_reader :base_points, :hashes, :reports
35+
attr_reader :base_points, :hashes
3736

3837
def current_sexp
3938
@location ||= sorted_hashes.first
@@ -44,12 +43,7 @@ def sorted_hashes
4443
end
4544

4645
def other_sexps
47-
@_other_sexps ||= hashes.drop(1).reject do |hash|
48-
report_name = "#{hash.file}-#{hash.line}"
49-
reports.include?(report_name).tap do
50-
reports.add(report_name)
51-
end
52-
end
46+
@other_locations ||= sorted_hashes.drop(1)
5347
end
5448

5549
def name

spec/cc/engine/analyzers/javascript/main_spec.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@
6565

6666
result = run_engine(engine_conf).strip
6767
issues = result.split("\0")
68-
69-
first_issue = issues.first
70-
json = JSON.parse(first_issue)
71-
72-
expect(json["other_locations"].length).to eq(0)
7368
expect(issues.length).to eq 1
7469
end
7570

0 commit comments

Comments
 (0)