Class: RuboCop::Cop::Custom::RegexRules
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Custom::RegexRules
- Defined in:
- lib/umbrellio_utils/rubocop/cop/custom/regex_rules.rb
Instance Method Summary collapse
Instance Method Details
#on_new_investigation ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/umbrellio_utils/rubocop/cop/custom/regex_rules.rb', line 7 def on_new_investigation return if processed_source.blank? rules.each do |rule| next unless applies_to_file?(rule) regex = Regexp.new(rule["regex"]) processed_source.raw_source.each_line.with_index(1) do |line, lineno| next unless (match = regex.match(line)) range = range_for_match(lineno, match) add_offense(range, message: rule["message"]) end end end |