Skip to content
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Unreleased]
* No unreleased changes
### Fixed
* CI: fix crashes when brakeman parsing fails

## 6.1.0 / 2022-04-28
### Fixed
Expand Down
19 changes: 18 additions & 1 deletion lib/tasks/ci/brakeman.rake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,24 @@ namespace :ci do

brakeman = NdrDevSupport::RakeCI::BrakemanHelper.new
brakeman.commit = @commit
brakeman.run(strict: true)
begin
brakeman.run(strict: true)
rescue StandardError => e
warn <<~MESSAGE
Error: Brakeman failed with #{e.class}: #{e}
There is probably a ruby syntax error in one of the files. To find it, run:
$ brakeman -I --debug
For the full backtrace, run
$ rake ci:brakeman --trace
MESSAGE
@attachments << {
color: 'danger',
title: 'Brakeman Error',
text: 'Brakeman run failed. Run brakeman -I --debug',
footer: 'bundle exec rake ci:brakeman:strict'
}
next
end

@metrics.concat(brakeman.metrics)
@attachments.concat(brakeman.attachments)
Expand Down