Class: RuboCop::TodoAudit Private
- Inherits:
-
Object
- Object
- RuboCop::TodoAudit
- Defined in:
- lib/rubocop/todo_audit.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Audits .rubocop_todo.yml for Exclude entries that are no longer
needed: files a cop would not flag anymore, or files that no longer
exist. Used by the --report-unused-todo-entries option.
Defined Under Namespace
Classes: Entry
Instance Method Summary collapse
-
#initialize(config_store, options) ⇒ TodoAudit
constructor
private
A new instance of TodoAudit.
- #todo_file ⇒ Object private
-
#unused_entries ⇒ Array<Entry>?
private
The unused entries, or
nilwhen there is no todo file to audit.
Constructor Details
#initialize(config_store, options) ⇒ TodoAudit
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TodoAudit.
11 12 13 14 |
# File 'lib/rubocop/todo_audit.rb', line 11 def initialize(config_store, ) @config_store = config_store @options = end |
Instance Method Details
#todo_file ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/rubocop/todo_audit.rb', line 28 def todo_file CLI::Command::AutoGenerateConfig::AUTO_GENERATED_FILE end |
#unused_entries ⇒ Array<Entry>?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the unused entries, or nil when there is
no todo file to audit.
18 19 20 21 22 23 24 25 26 |
# File 'lib/rubocop/todo_audit.rb', line 18 def unused_entries return nil unless todo_path entries = todo_exclude_entries return [] if entries.empty? offending_cops = offending_cops_without_todo(entries) entries.reject { |entry| offending_cops[absolute(entry.path)]&.include?(entry.cop_name) } end |