Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rubocop/cop_todo.rb')
-rw-r--r--rubocop/cop_todo.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/rubocop/cop_todo.rb b/rubocop/cop_todo.rb
index a36afc08673..943f3375461 100644
--- a/rubocop/cop_todo.rb
+++ b/rubocop/cop_todo.rb
@@ -26,10 +26,14 @@ module RuboCop
@cop_class&.support_autocorrect?
end
+ def generate?
+ previously_disabled || grace_period || files.any?
+ end
+
def to_yaml
yaml = []
yaml << '---'
- yaml << '# Cop supports --auto-correct.' if autocorrectable?
+ yaml << '# Cop supports --autocorrect.' if autocorrectable?
yaml << "#{cop_name}:"
if previously_disabled
@@ -39,8 +43,12 @@ module RuboCop
end
yaml << " #{RuboCop::Formatter::GracefulFormatter.grace_period_key_value}" if grace_period
- yaml << ' Exclude:'
- yaml.concat files.sort.map { |file| " - '#{file}'" }
+
+ if files.any?
+ yaml << ' Exclude:'
+ yaml.concat files.sort.map { |file| " - '#{file}'" }
+ end
+
yaml << ''
yaml.join("\n")