Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Ignore file support (fixes #18) #10

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions guard-brakeman.gemspec
Expand Up @@ -4,6 +4,7 @@ Gem::Specification.new do |s|
s.name = 'guard-brakeman'
s.version = '0.7.1'
s.platform = Gem::Platform::RUBY
s.license = 'MIT'
s.authors = ['Neil Matatall', 'Justin Collins']
s.homepage = 'https://github.com/guard/guard-brakeman'
s.summary = 'Guard gem for Brakeman'
Expand Down
15 changes: 6 additions & 9 deletions lib/guard/brakeman.rb
Expand Up @@ -56,8 +56,9 @@ def start
#
def run_all
@tracker.run_checks
print_failed(@tracker.checks)
throw :task_has_failed if @tracker.checks.all_warnings.any?
::Brakeman.filter_warnings @tracker, @scanner_opts
print_failed(@tracker)
throw :task_has_failed if @tracker.filtered_warnings.any?
end

# Gets called when watched paths and files have changes.
Expand All @@ -67,7 +68,6 @@ def run_all
#
def run_on_changes paths
return run_all unless @tracker.checks

info "\n\nrescanning #{paths}, running all checks"
report = ::Brakeman::rescan(@tracker, paths)
print_changed(report)
Expand All @@ -76,13 +76,10 @@ def run_on_changes paths

private

def print_failed report
def print_failed tracker
info "\n------ brakeman warnings --------\n"

icon = report.all_warnings.count > 0 ? :failed : :success

all_warnings = report.all_warnings

all_warnings = tracker.filtered_warnings
icon = all_warnings.count > 0 ? :failed : :success
message = "#{all_warnings.count} brakeman findings"

if @options[:output_files]
Expand Down