diff options
| author | Gautham Goli | 2017-08-30 15:48:41 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-09-04 15:05:43 +0530 |
| commit | 337d5c64708f3ad1d7074e17b1cd5be24e0ee488 (patch) | |
| tree | e398d4f2aba4e0e7ca2571eb73e50f79c9240163 /Library/Homebrew/rubocops/extend | |
| parent | b582ed513b3b28197369cb3cf808e9c4025ee581 (diff) | |
| download | brew-337d5c64708f3ad1d7074e17b1cd5be24e0ee488.tar.bz2 | |
audit: Fetch formula name from file path rather than class name in cops
Diffstat (limited to 'Library/Homebrew/rubocops/extend')
| -rw-r--r-- | Library/Homebrew/rubocops/extend/formula_cop.rb | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb index c8288ef9f..75d043f30 100644 --- a/Library/Homebrew/rubocops/extend/formula_cop.rb +++ b/Library/Homebrew/rubocops/extend/formula_cop.rb @@ -14,7 +14,7 @@ module RuboCop return unless formula_class?(node) return unless respond_to?(:audit_formula) class_node, parent_class_node, @body = *node - @formula_name = class_name(class_node) + @formula_name = Pathname.new(@file_path).basename(".rb").to_s audit_formula(node, class_node, parent_class_node, @body) end @@ -404,12 +404,7 @@ module RuboCop # Returns true if the formula is versioned def versioned_formula? - formula_file_name.include?("@") || @formula_name.match(/AT\d+/) - end - - # Returns filename of the formula without the extension - def formula_file_name - File.basename(processed_source.buffer.name, ".rb") + @formula_name.include?("@") end # Returns printable component name |
