aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/style.rb
diff options
context:
space:
mode:
authorGautham Goli2017-04-23 04:09:13 +0530
committerGautham Goli2017-05-02 23:26:12 +0530
commitc3330c289d0cc774b8154a0cee0f52fbd4b867aa (patch)
tree80ed27ae97960cc9d99984675f2d7ea4b6c030d0 /Library/Homebrew/cmd/style.rb
parenta4568a8697e9ff4a3d8f62e37ee929e22f10d07d (diff)
downloadbrew-c3330c289d0cc774b8154a0cee0f52fbd4b867aa.tar.bz2
Add `--only-cops`,`--except-cops` options for brew audit
Also refactor audit cops into two "departments" - FormulaAudit - FormulaAuditStrict
Diffstat (limited to 'Library/Homebrew/cmd/style.rb')
-rw-r--r--Library/Homebrew/cmd/style.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index d89c9b72f..4410f0feb 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -56,8 +56,18 @@ module Homebrew
]
args << "--auto-correct" if fix
+ if options[:exclude].eql?(:FormulaAuditStrict) && !(options.key?(:except) || options.key?(:only))
+ args << "--except" << :FormulaAuditStrict
+ end
+
+ if options[:except]
+ cops_to_exclude = options[:except].select { |cop| RuboCop::Cop::Cop.registry.names.include?(cop) }
+ args << "--except" << cops_to_exclude.join(" ") unless cops_to_exclude.empty?
+ end
+
if options[:only]
- args << "--only" << RuboCop::Cop::Cop.registry.with_department(options[:only]).names.join(" ")
+ cops_to_include = options[:only].select { |cop| RuboCop::Cop::Cop.registry.names.include?(cop) }
+ args << "--only" << cops_to_include.join(" ") unless cops_to_include.empty?
end
if files.nil?