Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Merged
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/reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def mass_threshold

def new_violation(issue)
hashes = flay.hashes[issue.structural_hash]
Violation.new(language_strategy.base_points, issue, hashes, reports)
Violation.new(language_strategy.base_points, issue, hashes)
end

def flay_options
Expand Down
12 changes: 3 additions & 9 deletions lib/cc/engine/analyzers/violation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ module Analyzers
class Violation
attr_reader :issue

def initialize(base_points, issue, hashes, reports)
def initialize(base_points, issue, hashes)
@base_points = base_points
@issue = issue
@hashes = hashes
@reports = reports
end

def format
Expand All @@ -33,7 +32,7 @@ def report_name

private

attr_reader :base_points, :hashes, :reports
attr_reader :base_points, :hashes

def current_sexp
@location ||= sorted_hashes.first
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where it uses sorted_hashes

Expand All @@ -44,12 +43,7 @@ def sorted_hashes
end

def other_sexps
@_other_sexps ||= hashes.drop(1).reject do |hash|
report_name = "#{hash.file}-#{hash.line}"
reports.include?(report_name).tap do
reports.add(report_name)
end
end
@other_locations ||= sorted_hashes.drop(1)
end

def name
Expand Down
5 changes: 0 additions & 5 deletions spec/cc/engine/analyzers/javascript/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@

result = run_engine(engine_conf).strip
issues = result.split("\0")

first_issue = issues.first
json = JSON.parse(first_issue)

expect(json["other_locations"].length).to eq(0)
expect(issues.length).to eq 1
end

Expand Down