Class: RuboCop::Cop::Cask::Discontinued + + + +
+-
+
- Inherits: +
-
+ Base
+
+
-
+
- Object + +
- Base + +
- RuboCop::Cop::Cask::Discontinued + +
+
-
+
- Extended by: +
- AutoCorrector +
-
+
- Includes: +
- CaskHelp +
-
+
- Defined in: +
- rubocops/cask/discontinued.rb +
Overview
This cop corrects caveats { discontinued }
to deprecate!
.
+ Constant Summary + collapse +
+ +-
+
+
- MESSAGE = + + +
"Use `deprecate!` instead of `caveats { discontinued }`."
+
+
+ Instance Method Summary + collapse +
+ +-
+
+
+
-
+
+
+ #on_cask_stanza_block(stanza_block) ⇒ Object
+
+
+
+
+
+
+
+
+
+
+
+ ++ +
+
+
+
Methods included from CaskHelp
+#find_end_line, #inner_stanzas, #on_block, #on_cask, #on_system_methods
+ + + + +Instance Method Details
+ + ++ + #on_cask_stanza_block(stanza_block) ⇒ Object + + + + + +
+ + + +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27+ |
+
+ # File 'rubocops/cask/discontinued.rb', line 14 + +def on_cask_stanza_block(stanza_block) + stanza_block.stanzas.select(&:caveats?).each do |stanza| + find_discontinued_method_call(stanza.stanza_node) do |node| + if caveats_constains_only_discontinued?(node.parent) + add_offense(node.parent, message: MESSAGE) do |corrector| + corrector.replace(node.parent.source_range, + "deprecate! date: \"#{Date.today}\", because: :discontinued") + end + else + add_offense(node, message: MESSAGE) + end + end + end +end+ |
+