Skip to content

Commit

Permalink
Added --quiet to switch off headers for fragrant files
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrutherford committed Jul 6, 2009
1 parent f4dac2b commit cf7c5f7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions features/options.feature
Expand Up @@ -32,6 +32,7 @@ Feature: Reek can be controlled using command-line options
Options:
-a, --[no-]show-all Show all smells, including those masked by config settings
-q, --quiet Suppress headings for smell-free source files
-h, --help Show this message
-f, --format FORMAT Specify the format of smell warnings
-c, --context-first Sort by context; sets the format string to "%m%c %w (%s)"
Expand Down
13 changes: 13 additions & 0 deletions features/reports.feature
Expand Up @@ -37,4 +37,17 @@ Feature: Correctly formatted reports
"""

Scenario Outline: --quiet turns off headers for fragrant files
When I run reek --quiet spec/samples/three_clean_files/*.rb
Then it succeeds
And it reports:
"""
"""

Examples:
| option |
| -q |
| --quiet |

6 changes: 5 additions & 1 deletion lib/reek/options.rb
Expand Up @@ -11,7 +11,8 @@ class Options
def self.default_options
{
:format => CTX_SORT,
:show_all => false
:show_all => false,
:quiet => false
}
end

Expand Down Expand Up @@ -69,6 +70,9 @@ def self.set_show_all_option(opts, config)
opts.on("-a", "--[no-]show-all", "Show all smells, including those masked by config settings") do |opt|
config[:show_all] = opt
end
opts.on("-q", "--quiet", "Suppress headings for smell-free source files") do
config[:quiet] = true
end
end

def self.set_help_option(opts)
Expand Down
1 change: 1 addition & 0 deletions lib/reek/report.rb
Expand Up @@ -53,6 +53,7 @@ def length
# Creates a formatted report of all the +Smells::SmellWarning+ objects recorded in
# this report, with a heading.
def full_report(desc)
return if @warnings.empty? and Options[:quiet]
result = header(desc, @warnings.length)
result += ":\n#{to_s}" if should_report
result += "\n"
Expand Down

0 comments on commit cf7c5f7

Please sign in to comment.