Skip to content

Commit

Permalink
Merge pull request #1740 from RubyBrewsday/main
Browse files Browse the repository at this point in the history
use Warning#relative_path for location path when reporting in codeclimate format
  • Loading branch information
presidentbeef committed Nov 16, 2022
2 parents 2101e97 + fa96a97 commit 3e11305
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/brakeman/report/report_codeclimate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def file_path(warning)
if tracker.options[:path_prefix]
(Pathname.new(tracker.options[:path_prefix]) + Pathname.new(warning.file.relative)).to_s
else
warning.file
warning.relative_path
end
end
end
1 change: 1 addition & 0 deletions test/tests/report_generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_codeclimate_sanity
report = @@report.to_codeclimate

assert report.is_a? String
refute report.include? Dir.pwd # Ensure output does not include absolute paths
end

def test_csv_sanity
Expand Down

0 comments on commit 3e11305

Please sign in to comment.