diff options
| author | Gautham Goli | 2017-07-30 20:14:59 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-06 18:36:09 +0530 |
| commit | bc2bcef1ba084e271ecdfd523a96e6db477e6475 (patch) | |
| tree | f6fd7401f5a24d8d259855c593a03917b1186373 /Library/Homebrew/rubocops/extend | |
| parent | f57a172cd2177ba4209c4945b0d483e002e01619 (diff) | |
| download | brew-bc2bcef1ba084e271ecdfd523a96e6db477e6475.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.rb | 14 |
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 |
