lib/rubocop/cop/cop.rb in rubocop-0.84.0 vs lib/rubocop/cop/cop.rb in rubocop-0.85.0

- old
+ new

@@ -144,21 +144,28 @@ def duplicate_location?(location) @offenses.any? { |o| o.location == location } end - def correct(node) + def correct(node) # rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength reason = reason_to_not_correct(node) return reason if reason @corrected_nodes[node] = true + if support_autocorrect? correction = autocorrect(node) - return :uncorrected unless correction - @corrections << Correction.new(correction, node, self) - :corrected + if correction + @corrections << Correction.new(correction, node, self) + :corrected + elsif disable_uncorrectable? + disable_uncorrectable(node) + :corrected_with_todo + else + :uncorrected + end elsif disable_uncorrectable? disable_uncorrectable(node) :corrected_with_todo end end @@ -209,11 +216,12 @@ end alias name cop_name def relevant_file?(file) - file_name_matches_any?(file, 'Include', true) && - !file_name_matches_any?(file, 'Exclude', false) + file == RuboCop::AST::ProcessedSource::STRING_SOURCE_NAME || + file_name_matches_any?(file, 'Include', true) && + !file_name_matches_any?(file, 'Exclude', false) end def excluded_file?(file) !relevant_file?(file) end