aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/rubocops
diff options
context:
space:
mode:
authorGautham Goli2017-07-29 16:36:32 +0530
committerGautham Goli2017-07-29 16:36:32 +0530
commite1cb0b43d7e3095de97b63c4776f9709120b7fad (patch)
tree61881aa40822d6b69b2da43fd5bc8921438a553b /Library/Homebrew/rubocops
parenta49d99a2d6a22f9db1540cb546ac2d7be2fb5703 (diff)
downloadbrew-e1cb0b43d7e3095de97b63c4776f9709120b7fad.tar.bz2
audit: Port dependency rules from line_problems to rubocop and add tests
Diffstat (limited to 'Library/Homebrew/rubocops')
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb3
-rw-r--r--Library/Homebrew/rubocops/lines_cop.rb20
2 files changed, 22 insertions, 1 deletions
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index 7165ee354..e42d6ee19 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -124,7 +124,8 @@ module RuboCop
case type
when :required
- type_match = !node.method_args.nil? && node.method_args.first.str_type?
+ type_match = !node.method_args.nil? &&
+ (node.method_args.first.str_type? || node.method_args.first.sym_type?)
if type_match && !name_match
name_match = node_equals?(node.method_args.first, name)
end
diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb
new file mode 100644
index 000000000..22039869b
--- /dev/null
+++ b/Library/Homebrew/rubocops/lines_cop.rb
@@ -0,0 +1,20 @@
+require_relative "./extend/formula_cop"
+
+module RuboCop
+ module Cop
+ module FormulaAudit
+ # This cop checks for various miscellaneous Homebrew coding styles
+ class Lines < FormulaCop
+ def audit_formula(_node, _class_node, _parent_class_node, _body_node)
+ [:automake, :autoconf, :libtool].each do |dependency|
+ next unless depends_on?(dependency)
+ problem ":#{dependency} is deprecated. Usage should be \"#{dependency}\""
+ end
+
+ problem ':apr is deprecated. Usage should be "apr-util"' if depends_on?(:apr)
+ problem ":tex is deprecated" if depends_on?(:tex)
+ end
+ end
+ end
+ end
+end