lib/rubocop/cop/base.rb in rubocop-1.63.1 vs lib/rubocop/cop/base.rb in rubocop-1.63.2

- old
+ new

@@ -184,10 +184,12 @@ # Adds an offense that has no particular location. # No correction can be applied to global offenses def add_global_offense(message = nil, severity: nil) severity = find_severity(nil, severity) message = find_message(nil, message) - current_offenses << Offense.new(severity, Offense::NO_LOCATION, message, name, :unsupported) + range = Offense::NO_LOCATION + status = enabled_line?(range.line) ? :unsupported : :disabled + current_offenses << Offense.new(severity, range, message, name, status) end # Adds an offense on the specified range (or node with an expression) # Unless that offense is disabled for this range, a corrector will be yielded # to provide the cop the opportunity to autocorrect the offense.