mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
style: add --reset-cache option
This commit is contained in:
parent
2256e547d9
commit
c181c9995e
@ -27,6 +27,8 @@ module Homebrew
|
||||
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."
|
||||
switch "--reset-cache",
|
||||
description: "Reset the RuboCop cache."
|
||||
comma_array "--only-cops",
|
||||
description: "Specify a comma-separated <cops> list to check for violations of only the "\
|
||||
"listed RuboCop cops."
|
||||
@ -51,7 +53,11 @@ module Homebrew
|
||||
except_cops = args.except_cops
|
||||
|
||||
options = {
|
||||
fix: args.fix?, display_cop_names: args.display_cop_names?, debug: args.debug?, verbose: args.verbose?
|
||||
fix: args.fix?,
|
||||
display_cop_names: args.display_cop_names?,
|
||||
reset_cache: args.reset_cache?,
|
||||
debug: args.debug?,
|
||||
verbose: args.verbose?,
|
||||
}
|
||||
if only_cops
|
||||
options[:only_cops] = only_cops
|
||||
|
@ -40,6 +40,7 @@ module Homebrew
|
||||
fix: false,
|
||||
except_cops: nil, only_cops: nil,
|
||||
display_cop_names: false,
|
||||
reset_cache: false,
|
||||
debug: false, verbose: false)
|
||||
raise ArgumentError, "Invalid output type: #{output_type.inspect}" unless [:print, :json].include?(output_type)
|
||||
|
||||
@ -54,6 +55,7 @@ module Homebrew
|
||||
fix: fix,
|
||||
except_cops: except_cops, only_cops: only_cops,
|
||||
display_cop_names: display_cop_names,
|
||||
reset_cache: reset_cache,
|
||||
debug: debug, verbose: verbose)
|
||||
end
|
||||
|
||||
@ -71,7 +73,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def run_rubocop(files, output_type,
|
||||
fix: false, except_cops: nil, only_cops: nil, display_cop_names: false,
|
||||
fix: false, except_cops: nil, only_cops: nil, display_cop_names: false, reset_cache: false,
|
||||
debug: false, verbose: false)
|
||||
Homebrew.install_bundler_gems!
|
||||
require "rubocop"
|
||||
@ -130,6 +132,8 @@ module Homebrew
|
||||
|
||||
cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" }
|
||||
|
||||
FileUtils.rm_rf cache_env["XDG_CACHE_HOME"] if reset_cache
|
||||
|
||||
case output_type
|
||||
when :print
|
||||
args << "--debug" if debug
|
||||
|
@ -1207,6 +1207,8 @@ including core code and all formulae.
|
||||
Fix style violations automatically using RuboCop's auto-correct feature.
|
||||
* `--display-cop-names`:
|
||||
Include the RuboCop cop name for each violation in the output.
|
||||
* `--reset-cache`:
|
||||
Reset the RuboCop cache.
|
||||
* `--only-cops`:
|
||||
Specify a comma-separated *`cops`* list to check for violations of only the listed RuboCop cops.
|
||||
* `--except-cops`:
|
||||
|
@ -1662,6 +1662,10 @@ Fix style violations automatically using RuboCop\'s auto\-correct feature\.
|
||||
Include the RuboCop cop name for each violation in the output\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-reset\-cache\fR
|
||||
Reset the RuboCop cache\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-only\-cops\fR
|
||||
Specify a comma\-separated \fIcops\fR list to check for violations of only the listed RuboCop cops\.
|
||||
.
|
||||
|
Loading…
x
Reference in New Issue
Block a user