aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/rubocops/caveats_cop.rb
diff options
context:
space:
mode:
authorGautham Goli2017-05-22 13:09:49 +0530
committerGautham Goli2017-05-31 22:59:48 +0530
commitcf848a14d2de60b425d6e279051a919ff6ad1e43 (patch)
treea1ac4c055cbb96f3b7953a8a3e265dd7d7ff5abf /Library/Homebrew/rubocops/caveats_cop.rb
parentf9e8d8430154e3480d5255e35b802a46f9168b5a (diff)
downloadbrew-cf848a14d2de60b425d6e279051a919ff6ad1e43.tar.bz2
audit: Port audit_caveats method to rubocop and add tests
Diffstat (limited to 'Library/Homebrew/rubocops/caveats_cop.rb')
-rw-r--r--Library/Homebrew/rubocops/caveats_cop.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/rubocops/caveats_cop.rb b/Library/Homebrew/rubocops/caveats_cop.rb
new file mode 100644
index 000000000..3935d5638
--- /dev/null
+++ b/Library/Homebrew/rubocops/caveats_cop.rb
@@ -0,0 +1,16 @@
+require_relative "./extend/formula_cop"
+
+module RuboCop
+ module Cop
+ module FormulaAudit
+ class Caveats < FormulaCop
+ def audit_formula(_node, _class_node, _parent_class_node, _body_node)
+ caveats_strings.each do |n|
+ next unless regex_match_group(n, /\bsetuid\b/i)
+ problem "Don't recommend setuid in the caveats, suggest sudo instead."
+ end
+ end
+ end
+ end
+ end
+end