Class: RuboCop::Cop::Cask::UninstallWildcard Private
- Defined in:
- rubocops/cask/uninstall_wildcard.rb
Overview
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.
This cop checks for uninstall/zap wildcards which match too much,
e.g. quit: "*", which would target every running application.
Constant Summary collapse
- MINIMUM_ID_PARTS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
The fewest parts of an ID any cask uses with a wildcard, e.g. the three of
com.example.*: fewer than this matches too much, ascom.a*would match everycom.apple.*ID. 3- MESSAGE =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
"Include at least %<minimum>d parts of an ID with a wildcard, e.g. `com.example.*`."- WILDCARD_DIRECTIVES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
[:launchctl, :quit, :signal].freeze
- RESTRICT_ON_SEND =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
[:uninstall, :zap].freeze
Instance Method Summary collapse
- #on_send(node) ⇒ void private
Instance Method Details
#on_send(node) ⇒ 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.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'rubocops/cask/uninstall_wildcard.rb', line 20 def on_send(node) node.each_descendant(:pair) do |pair| next unless pair.key.sym_type? next unless WILDCARD_DIRECTIVES.include?(pair.key.value) id_values(pair.value).each do |value| next unless too_broad_wildcard?(value.source) add_offense(value, message: format(MESSAGE, minimum: MINIMUM_ID_PARTS)) end end end |