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

dev-cmd/style: Properly clean up the --display-cop-names option #15196

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/tests.yml
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install shellcheck and shfmt
run: brew install shellcheck shfmt

- run: brew style --display-cop-names
- run: brew style

- run: brew typecheck

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
run: brew install-bundler-gems --groups=sorbet

- name: Run brew style on homebrew-core
run: brew style --display-cop-names homebrew/core
run: brew style homebrew/core

- name: Set up all Homebrew taps
run: |
Expand All @@ -105,22 +105,22 @@ jobs:

- name: Run brew style on official taps
run: |
brew style --display-cop-names homebrew/bundle \
homebrew/services \
homebrew/test-bot
brew style homebrew/bundle \
homebrew/services \
homebrew/test-bot

brew style --display-cop-names homebrew/aliases\
homebrew/autoupdate\
homebrew/command-not-found \
homebrew/formula-analytics \
homebrew/portable-ruby
brew style homebrew/aliases \
homebrew/autoupdate\
homebrew/command-not-found \
homebrew/formula-analytics \
homebrew/portable-ruby

- name: Run brew style on cask taps
run: |
brew style --display-cop-names homebrew/cask \
homebrew/cask-drivers \
homebrew/cask-fonts \
homebrew/cask-versions
brew style homebrew/cask \
homebrew/cask-drivers \
homebrew/cask-fonts \
homebrew/cask-versions

formula-audit:
name: formula audit
Expand Down
7 changes: 2 additions & 5 deletions Library/Homebrew/dev-cmd/audit.rb
Expand Up @@ -60,7 +60,8 @@ def self.audit_args
switch "--fix",
description: "Fix style violations automatically using RuboCop's auto-correct feature."
switch "--display-cop-names",
description: "Include the RuboCop cop name for each violation in the output."
description: "Include the RuboCop cop name for each violation in the output. This is the default.",
hidden: true
switch "--display-filename",
description: "Prefix every line of output with the file or formula name being audited, to " \
"make output easy to grep."
Expand Down Expand Up @@ -92,9 +93,6 @@ def self.audit_args
conflicts "--only", "--except"
conflicts "--only-cops", "--except-cops", "--strict"
conflicts "--only-cops", "--except-cops", "--only"
conflicts "--display-cop-names", "--skip-style"
conflicts "--display-cop-names", "--only-cops"
conflicts "--display-cop-names", "--except-cops"
conflicts "--formula", "--cask"
conflicts "--installed", "--all"

Expand Down Expand Up @@ -208,7 +206,6 @@ def self.audit
spdx_license_data: spdx_license_data,
spdx_exception_data: spdx_exception_data,
style_offenses: style_offenses&.for_path(f.path),
display_cop_names: args.display_cop_names?,
}.compact

audit_proc = proc { FormulaAuditor.new(f, **options).tap(&:audit) }
Expand Down
12 changes: 6 additions & 6 deletions Library/Homebrew/dev-cmd/style.rb
Expand Up @@ -24,7 +24,8 @@ def style_args
switch "--fix",
description: "Fix style violations automatically using RuboCop's auto-correct feature."
switch "--display-cop-names",
description: "Include the RuboCop cop name for each violation in the output."
description: "Include the RuboCop cop name for each violation in the output.",
hidden: true
switch "--reset-cache",
description: "Reset the RuboCop cache."
switch "--formula", "--formulae",
Expand Down Expand Up @@ -58,11 +59,10 @@ def style
except_cops = args.except_cops

options = {
fix: args.fix?,
display_cop_names: args.display_cop_names?,
reset_cache: args.reset_cache?,
debug: args.debug?,
verbose: args.verbose?,
fix: args.fix?,
reset_cache: args.reset_cache?,
debug: args.debug?,
verbose: args.verbose?,
}
if only_cops
options[:only_cops] = only_cops
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/style.rb
Expand Up @@ -101,7 +101,6 @@ def self.run_rubocop(files, output_type,
end

args += ["--extra-details"] if verbose
args += ["--display-cop-names"] if display_cop_names || verbose

if except_cops
except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
Expand Down