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

Fix YAML configuration file 'formats' processing #316

Merged
merged 1 commit into from
Oct 13, 2019
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ threshold_score: 10 # default is 0
deduplicate_symlinks: true # default is false
suppress_ratings: true # default is false
no_browser: true # default is false
format: console # Available values are: html, json, console, lint. Default value is html.
formats: # Available values are: html, json, console, lint. Default value is html.
- console
minimum_score: 95 # default is 0
paths: # Files to analyse.
- 'app/controllers/'
Expand Down
2 changes: 1 addition & 1 deletion lib/rubycritic/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def to_h
argv_hash = argv_options.to_h

file_hash.merge(argv_hash) do |_, file_option, argv_option|
argv_option.nil? ? file_option : argv_option
Array(argv_option).empty? ? file_option : argv_option
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rubycritic/cli/options/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def no_browser
end

def formats
formats = options['formats'] || []
formats = Array(options['formats'])
formats.select do |format|
%w[html json console lint].include?(format)
end
end.map(&:to_sym)
end

def minimum_score
Expand Down