aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/rubocops/extend
diff options
context:
space:
mode:
authorGautham Goli2017-10-25 16:05:29 +0530
committerGautham Goli2017-10-26 15:35:14 +0530
commit09326909afa83893fa92edfd47820e736f5bf334 (patch)
treea57f13b6ae0effe85a3a8dbdceb745be04e83856 /Library/Homebrew/rubocops/extend
parent0cec599b28c23fb6bade4202fd455d54c07dfd27 (diff)
downloadbrew-09326909afa83893fa92edfd47820e736f5bf334.tar.bz2
lines_cop: Fix detection of negated expression
Diffstat (limited to 'Library/Homebrew/rubocops/extend')
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index 2e9a7657e..1e7160bbd 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -316,8 +316,10 @@ module RuboCop
end
# Check if negation is present in the given node
- def negated?(node)
- method_called?(node, :!)
+ def expression_negated?(node)
+ return false if node.parent.nil?
+ return false unless node.parent.method_name.equal?(:!)
+ offending_node(node.parent)
end
# Return all the caveats' string nodes in an array