aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/rubocops/extend
diff options
context:
space:
mode:
authorGautham Goli2017-07-30 20:14:59 +0530
committerGautham Goli2017-08-06 02:28:58 +0530
commitaffd9055c2aaaf3535ed1cb778b65a4bee5ef0e2 (patch)
tree60d758895d96ff2cbe538b8f6f8f71329f46ba07 /Library/Homebrew/rubocops/extend
parent7a17a166ecd3145b501cb190d9b4cc1e6dba31ba (diff)
downloadbrew-affd9055c2aaaf3535ed1cb778b65a4bee5ef0e2.tar.bz2
audit: Port classname and template comments audit rules from line_problems method to rubocop
Diffstat (limited to 'Library/Homebrew/rubocops/extend')
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index 4be0c0fe3..e7a23ecae 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -302,6 +302,15 @@ module RuboCop
end
end
+ # Yields to a block with comment text as parameter
+ def audit_comments
+ @processed_source.comments.each do |comment_node|
+ @offensive_node = comment_node
+ @offense_source_range = :expression
+ yield comment_node.text
+ end
+ end
+
# Returns the begin position of the node's line in source code
def line_start_column(node)
node.source_range.source_buffer.line_range(node.loc.line).begin_pos
@@ -312,6 +321,11 @@ module RuboCop
node.source_range.begin_pos
end
+ # Returns the ending position of the node in source code
+ def end_column(node)
+ node.source_range.end_pos
+ end
+
# Returns the line number of the node
def line_number(node)
node.loc.line