diff options
| author | Gautham Goli | 2017-06-30 10:58:24 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-06-30 20:25:12 +0530 |
| commit | 8c167b23cce58a155da34c14ebe994601534ff2f (patch) | |
| tree | 28760489a3c695267cd01be9dd0b209807b9a815 | |
| parent | 0077e4f20ef9d107a0ca8c5ab75cac552163fb45 (diff) | |
| download | brew-8c167b23cce58a155da34c14ebe994601534ff2f.tar.bz2 | |
audit: Don't run audit methods when `--only-cops` is passed
| -rw-r--r-- | Library/Homebrew/cmd/style.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index c6201e371..51937c3e5 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -94,7 +94,11 @@ module Homebrew RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym) end - args << "--only" << cops_to_include.join(",") unless cops_to_include.empty? + if cops_to_include.empty? + odie "RuboCops #{options[:only_cops].join(",")} were not found" + end + + args << "--only" << cops_to_include.join(",") end if files.nil? diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 5b2edfcf6..443a45816 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -75,16 +75,18 @@ module Homebrew only_cops = ARGV.value("only-cops").to_s.split(",") except_cops = ARGV.value("except-cops").to_s.split(",") + if !only_cops.empty? && !except_cops.empty? odie "--only-cops and --except-cops cannot be used simultaneously!" - elsif (!only_cops.empty? || !except_cops.empty?) && strict - odie "--only-cops/--except-cops and --strict cannot be used simultaneously" + elsif (!only_cops.empty? || !except_cops.empty?) && (strict || ARGV.value("only")) + odie "--only-cops/--except-cops and --strict/--only cannot be used simultaneously" end options = { fix: ARGV.flag?("--fix"), realpath: true } if !only_cops.empty? options[:only_cops] = only_cops + ARGV.push("--only=style") elsif !except_cops.empty? options[:except_cops] = except_cops elsif !strict |
