Class: RuboCop::PendingCopsReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/pending_cops_reporter.rb

Overview

Reports information about pending cops that are not explicitly configured.

This class is responsible for displaying warnings when new cops have been added to RuboCop but have not yet been enabled or disabled in the user’s configuration. It provides a centralized way to determine whether such warnings should be shown, based on global flags or configuration settings.

Constant Summary collapse

PENDING_BANNER =
<<~BANNER
  The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.

  Please also note that you can opt-in to new cops by default by adding this to your config:
    AllCops:
      NewCops: enable
BANNER

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.disable_pending_copsObject

Returns the value of attribute disable_pending_cops.



20
21
22
# File 'lib/rubocop/pending_cops_reporter.rb', line 20

def disable_pending_cops
  @disable_pending_cops
end

.enable_pending_copsObject

Returns the value of attribute enable_pending_cops.



20
21
22
# File 'lib/rubocop/pending_cops_reporter.rb', line 20

def enable_pending_cops
  @enable_pending_cops
end

Class Method Details

.warn_if_needed(config) ⇒ Object



22
23
24
25
26
27
# File 'lib/rubocop/pending_cops_reporter.rb', line 22

def warn_if_needed(config)
  return if possible_new_cops?(config)

  pending_cops = pending_cops_only_qualified(config.pending_cops)
  warn_on_pending_cops(pending_cops) unless pending_cops.empty?
end