Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore file support2 #20

Merged
merged 4 commits into from
Aug 28, 2013
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
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.8.0

Adds support for Brakeman 2.1.0's ability to ignore specified warnings http://brakemanscanner.org/blog/2013/07/17/brakeman-2-dot-1-0-released/

# 0.7.1

"quiet" option only sets brakeman -q flag, it doesn't suppress messages from guard-brakeman anymore.
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Guard::Brakeman allows you to automatically run [Brakeman](http://brakemanscanner.org/) tests when files are modified.

Use guard-brakeman >= 0.4.0 for brakeman >= 1.5.3
--------------
And use < 0.4.0 for brakeman < 1.5.3

## Install

The simplest way to install Guard is to use [Bundler](http://gembundler.com/).
Expand Down Expand Up @@ -53,6 +49,8 @@ Please read the [Guard documentation](http://github.com/guard/guard#readme) for
### List of available options

```ruby
:quiet => false # set the "quiet" option in brakeman (only results will be printed)
:ignore_file => 'config/brakeman.ignore'
:output_files => %w(donkey.html) # write the results to the specified files
:notifications => false # display Growl notifications, defaults to true
:run_on_start => true # run all checks on startup, defaults to false
Expand Down
4 changes: 2 additions & 2 deletions guard-brakeman.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = 'guard-brakeman'
s.version = '0.7.1'
s.version = '0.8.0'
s.platform = Gem::Platform::RUBY
s.license = 'MIT'
s.authors = ['Neil Matatall', 'Justin Collins']
Expand All @@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.rubyforge_project = 'guard-brakeman'

s.add_dependency 'guard', '>= 1.1.0'
s.add_dependency 'brakeman', '>= 1.8.2'
s.add_dependency 'brakeman', '>= 2.1.0'

s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md]
s.require_path = 'lib'
Expand Down
15 changes: 6 additions & 9 deletions lib/guard/brakeman.rb
Original file line number Diff line number Diff line change
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