Class: Homebrew::DevCmd::StyleCmd Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::DevCmd::StyleCmd
- Defined in:
- dev-cmd/style.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/style_cmd.rbi
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Defined Under Namespace
Classes: Args
Instance Method Summary collapse
- #args ⇒ Homebrew::DevCmd::StyleCmd::Args private
- #changed_ruby_or_shell_files ⇒ Array<String> private
- #run ⇒ void private
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::DevCmd::StyleCmd::Args
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 |
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/style_cmd.rbi', line 10 def args; end |
#changed_ruby_or_shell_files ⇒ Array<String>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'dev-cmd/style.rb', line 88 def changed_ruby_or_shell_files changed_files = Utils.popen_read("git", "diff", "--name-only", "main") raise UsageError, "No files have been changed from the `main` branch!" if changed_files.blank? changed_files.split("\n").filter_map do |file| next if !file.end_with?(".rb", ".sh", ".yml", ".rbi") && file != "bin/brew" Pathname(file) end.select(&:exist?) end |
#run ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'dev-cmd/style.rb', line 47 def run Homebrew.install_bundler_gems!(groups: ["style"]) if args.changed? && !args.no_named? raise UsageError, "`--changed` and named arguments are mutually exclusive!" end target = if args.changed? changed_ruby_or_shell_files elsif args.no_named? nil else args.named.to_paths end if target.blank? && args.changed? opoo "No style checks are available for the changed files!" return end only_cops = args.only_cops except_cops = args.except_cops = { fix: args.fix?, reset_cache: args.reset_cache?, debug: args.debug?, verbose: args.verbose?, } if only_cops [:only_cops] = only_cops elsif except_cops [:except_cops] = except_cops else [:except_cops] = %w[FormulaAuditStrict] end Homebrew.failed = !Style.check_style_and_print(target, **) end |