rubocop 0.25.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubocop might be problematic. Click here for more details.

Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +37 -0
  4. data/README.md +2 -2
  5. data/assets/output.html.erb +190 -0
  6. data/config/default.yml +14 -2
  7. data/config/disabled.yml +7 -0
  8. data/config/enabled.yml +132 -5
  9. data/lib/rubocop.rb +5 -0
  10. data/lib/rubocop/cop/commissioner.rb +4 -10
  11. data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
  12. data/lib/rubocop/cop/lint/end_in_method.rb +3 -8
  13. data/lib/rubocop/cop/lint/ensure_return.rb +2 -2
  14. data/lib/rubocop/cop/lint/space_before_first_arg.rb +8 -1
  15. data/lib/rubocop/cop/lint/useless_assignment.rb +35 -0
  16. data/lib/rubocop/cop/lint/useless_setter_call.rb +2 -3
  17. data/lib/rubocop/cop/metrics/block_nesting.rb +3 -3
  18. data/lib/rubocop/cop/metrics/class_length.rb +1 -2
  19. data/lib/rubocop/cop/mixin/access_modifier_node.rb +5 -1
  20. data/lib/rubocop/cop/mixin/autocorrect_alignment.rb +2 -2
  21. data/lib/rubocop/cop/mixin/configurable_naming.rb +2 -2
  22. data/lib/rubocop/cop/mixin/method_complexity.rb +2 -4
  23. data/lib/rubocop/cop/mixin/statement_modifier.rb +1 -3
  24. data/lib/rubocop/cop/rails/delegate.rb +1 -1
  25. data/lib/rubocop/cop/rails/validation.rb +25 -2
  26. data/lib/rubocop/cop/style/alias.rb +1 -1
  27. data/lib/rubocop/cop/style/and_or.rb +12 -2
  28. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +19 -12
  29. data/lib/rubocop/cop/style/documentation.rb +1 -1
  30. data/lib/rubocop/cop/style/dot_position.rb +20 -0
  31. data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +5 -1
  32. data/lib/rubocop/cop/style/encoding.rb +4 -4
  33. data/lib/rubocop/cop/style/format_string.rb +12 -2
  34. data/lib/rubocop/cop/style/if_unless_modifier.rb +8 -11
  35. data/lib/rubocop/cop/style/infinite_loop.rb +57 -0
  36. data/lib/rubocop/cop/style/multiline_block_chain.rb +15 -16
  37. data/lib/rubocop/cop/style/multiline_if_then.rb +10 -0
  38. data/lib/rubocop/cop/style/nested_ternary_operator.rb +3 -3
  39. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +3 -1
  40. data/lib/rubocop/cop/style/predicate_name.rb +23 -5
  41. data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
  42. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  43. data/lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb +4 -8
  44. data/lib/rubocop/cop/style/space_inside_hash_literal_braces.rb +9 -11
  45. data/lib/rubocop/cop/style/space_inside_range_literal.rb +58 -0
  46. data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
  47. data/lib/rubocop/cop/style/symbol_proc.rb +71 -0
  48. data/lib/rubocop/cop/style/tab.rb +11 -3
  49. data/lib/rubocop/cop/style/unneeded_capital_w.rb +6 -2
  50. data/lib/rubocop/cop/style/variable_name.rb +4 -14
  51. data/lib/rubocop/cop/style/while_until_modifier.rb +12 -8
  52. data/lib/rubocop/cop/variable_force.rb +17 -30
  53. data/lib/rubocop/cop/variable_force/assignment.rb +15 -23
  54. data/lib/rubocop/cop/variable_force/locatable.rb +29 -8
  55. data/lib/rubocop/cop/variable_force/scope.rb +34 -23
  56. data/lib/rubocop/cop/variable_force/variable.rb +7 -10
  57. data/lib/rubocop/formatter/disabled_config_formatter.rb +3 -2
  58. data/lib/rubocop/formatter/formatter_set.rb +1 -0
  59. data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
  60. data/lib/rubocop/formatter/html_formatter.rb +90 -0
  61. data/lib/rubocop/formatter/progress_formatter.rb +1 -1
  62. data/lib/rubocop/options.rb +1 -0
  63. data/lib/rubocop/processed_source.rb +10 -1
  64. data/lib/rubocop/string_util.rb +153 -0
  65. data/lib/rubocop/target_finder.rb +1 -1
  66. data/lib/rubocop/version.rb +1 -1
  67. data/relnotes/v0.26.0.md +89 -0
  68. data/rubocop.gemspec +1 -0
  69. data/spec/rubocop/cli_spec.rb +60 -34
  70. data/spec/rubocop/config_loader_spec.rb +19 -15
  71. data/spec/rubocop/cop/commissioner_spec.rb +2 -2
  72. data/spec/rubocop/cop/lint/block_alignment_spec.rb +74 -58
  73. data/spec/rubocop/cop/lint/space_before_first_arg_spec.rb +7 -0
  74. data/spec/rubocop/cop/lint/useless_assignment_spec.rb +173 -0
  75. data/spec/rubocop/cop/rails/validation_spec.rb +9 -2
  76. data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +26 -0
  77. data/spec/rubocop/cop/style/and_or_spec.rb +52 -61
  78. data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +26 -8
  79. data/spec/rubocop/cop/style/case_indentation_spec.rb +8 -8
  80. data/spec/rubocop/cop/style/def_with_parentheses_spec.rb +6 -2
  81. data/spec/rubocop/cop/style/dot_position_spec.rb +39 -0
  82. data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +12 -2
  83. data/spec/rubocop/cop/style/encoding_spec.rb +16 -28
  84. data/spec/rubocop/cop/style/format_string_spec.rb +12 -0
  85. data/spec/rubocop/cop/style/infinite_loop_spec.rb +48 -0
  86. data/spec/rubocop/cop/style/method_def_parentheses_spec.rb +3 -1
  87. data/spec/rubocop/cop/style/multiline_if_then_spec.rb +9 -0
  88. data/spec/rubocop/cop/style/percent_literal_delimiters_spec.rb +21 -1
  89. data/spec/rubocop/cop/style/predicate_name_spec.rb +44 -13
  90. data/spec/rubocop/cop/style/redundant_begin_spec.rb +32 -0
  91. data/spec/rubocop/cop/style/space_inside_range_literal_spec.rb +52 -0
  92. data/spec/rubocop/cop/style/symbol_proc_spec.rb +76 -0
  93. data/spec/rubocop/cop/style/tab_spec.rb +30 -0
  94. data/spec/rubocop/cop/style/trailing_whitespace_spec.rb +2 -1
  95. data/spec/rubocop/cop/style/unneeded_capital_w_spec.rb +18 -5
  96. data/spec/rubocop/cop/style/variable_name_spec.rb +5 -5
  97. data/spec/rubocop/cop/style/when_then_spec.rb +3 -1
  98. data/spec/rubocop/cop/style/while_until_do_spec.rb +4 -2
  99. data/spec/rubocop/cop/util_spec.rb +1 -9
  100. data/spec/rubocop/cop/variable_force/assignment_spec.rb +2 -15
  101. data/spec/rubocop/cop/variable_force/locatable_spec.rb +2 -37
  102. data/spec/rubocop/cop/variable_force/scope_spec.rb +156 -49
  103. data/spec/rubocop/cop/variable_force/variable_spec.rb +2 -1
  104. data/spec/rubocop/cop/variable_force_spec.rb +2 -1
  105. data/spec/rubocop/formatter/emacs_style_formatter_spec.rb +2 -1
  106. data/spec/rubocop/formatter/html_formatter_spec.rb +145 -0
  107. data/spec/rubocop/formatter/simple_text_formatter_spec.rb +18 -6
  108. data/spec/rubocop/options_spec.rb +1 -0
  109. data/spec/rubocop/path_util_spec.rb +6 -4
  110. data/spec/rubocop/processed_source_spec.rb +17 -1
  111. data/spec/rubocop/string_util_spec.rb +46 -0
  112. metadata +33 -4
  113. data/spec/support/ast_helper.rb +0 -15
@@ -9,16 +9,24 @@ module RuboCop
9
9
 
10
10
  def investigate(processed_source)
11
11
  processed_source.lines.each_with_index do |line, index|
12
- match = line.match(/^( *)\t/)
12
+ match = line.match(/^( *)[\t ]*\t/)
13
13
  next unless match
14
14
 
15
15
  spaces = match.captures[0]
16
16
 
17
17
  range = source_range(processed_source.buffer,
18
18
  index + 1,
19
- spaces.length)
19
+ (spaces.length)...(match.end(0)))
20
20
 
21
- add_offense(nil, range, MSG)
21
+ add_offense(range, range, MSG)
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def autocorrect(range)
28
+ @corrections << lambda do |corrector|
29
+ corrector.replace(range, range.source.gsub(/\t/, ' '))
22
30
  end
23
31
  end
24
32
  end
@@ -17,8 +17,12 @@ module RuboCop
17
17
  private
18
18
 
19
19
  def on_percent_literal(node)
20
- return unless node.children.none? { |x| x.type == :dstr }
21
-
20
+ node.children.each do |string|
21
+ if string.type == :dstr ||
22
+ string.loc.expression.source =~ StringHelp::ESCAPED_CHAR_REGEXP
23
+ return
24
+ end
25
+ end
22
26
  add_offense(node, :expression)
23
27
  end
24
28
 
@@ -18,25 +18,15 @@ module RuboCop
18
18
  check_name(node, name, node.loc.name)
19
19
  end
20
20
 
21
- # TODO: Why is this checking invocations of setter rather than
22
- # definitions? Also, this is not variable.
23
- def on_send(node)
24
- return unless setter_call_on_self?(node)
25
- _receiver, method_name, = *node
26
- attribute_name = method_name.to_s.sub(/=$/, '').to_sym
27
- check_name(node, attribute_name, node.loc.selector)
21
+ def on_cvasgn(node)
22
+ name, = *node
23
+ check_name(node, name, node.loc.name)
28
24
  end
29
25
 
30
26
  private
31
27
 
32
28
  def message(style)
33
- format('Use %s for variables.', style)
34
- end
35
-
36
- def setter_call_on_self?(send_node)
37
- receiver, method_name, = *send_node
38
- return false unless receiver && receiver.type == :self
39
- method_name.to_s.end_with?('=')
29
+ format('Use %s for variable names.', style)
40
30
  end
41
31
  end
42
32
  end
@@ -9,18 +9,22 @@ module RuboCop
9
9
  class WhileUntilModifier < Cop
10
10
  include StatementModifier
11
11
 
12
- def investigate(processed_source)
13
- return unless processed_source.ast
14
- on_node([:while, :until], processed_source.ast) do |node|
15
- # discard modifier while/until
16
- next unless node.loc.end
17
- next unless fit_within_line_as_modifier_form?(node)
18
- add_offense(node, :keyword, message(node.loc.keyword.source))
19
- end
12
+ def on_while(node)
13
+ check(node)
14
+ end
15
+
16
+ def on_until(node)
17
+ check(node)
20
18
  end
21
19
 
22
20
  private
23
21
 
22
+ def check(node)
23
+ return unless node.loc.end
24
+ return unless fit_within_line_as_modifier_form?(node)
25
+ add_offense(node, :keyword, message(node.loc.keyword.source))
26
+ end
27
+
24
28
  def message(keyword)
25
29
  "Favor modifier `#{keyword}` usage when having a single-line body."
26
30
  end
@@ -51,11 +51,14 @@ module RuboCop
51
51
  ZERO_ARITY_SUPER_TYPE = :zsuper
52
52
 
53
53
  TWISTED_SCOPE_TYPES = [:block, :class, :sclass, :defs].freeze
54
- SCOPE_TYPES = (TWISTED_SCOPE_TYPES + [:top_level, :module, :def]).freeze
54
+ SCOPE_TYPES = (TWISTED_SCOPE_TYPES + [:module, :def]).freeze
55
55
 
56
- def self.wrap_with_top_level_node(node)
57
- # This is a custom node type, not defined in Parser.
58
- Parser::AST::Node.new(:top_level, [node])
56
+ def self.wrap_with_top_level_scope_node(root_node)
57
+ if root_node.begin_type?
58
+ root_node
59
+ else
60
+ Astrolabe::Node.new(:begin, [root_node])
61
+ end
59
62
  end
60
63
 
61
64
  def variable_table
@@ -67,10 +70,10 @@ module RuboCop
67
70
  root_node = processed_source.ast
68
71
  return unless root_node
69
72
 
70
- # Wrap the root node with :top_level scope node.
71
- top_level_node = self.class.wrap_with_top_level_node(root_node)
73
+ # Wrap the root node with begin node if it's a standalone node.
74
+ root_node = self.class.wrap_with_top_level_scope_node(root_node)
72
75
 
73
- inspect_variables_in_scope(top_level_node)
76
+ inspect_variables_in_scope(root_node)
74
77
  end
75
78
 
76
79
  # This is called for each scope recursively.
@@ -81,10 +84,9 @@ module RuboCop
81
84
  end
82
85
 
83
86
  def process_children(origin_node)
84
- origin_node.children.each do |child|
85
- next unless child.is_a?(Parser::AST::Node)
86
- next if scanned_node?(child)
87
- process_node(child)
87
+ origin_node.each_child_node do |child_node|
88
+ next if scanned_node?(child_node)
89
+ process_node(child_node)
88
90
  end
89
91
  end
90
92
 
@@ -245,15 +247,10 @@ module RuboCop
245
247
  end
246
248
 
247
249
  def process_rescue(node)
248
- resbody_nodes = node.children.select do |child|
249
- next false unless child.is_a?(Parser::AST::Node)
250
- child.type == :resbody
251
- end
250
+ resbody_nodes = node.each_child_node(:resbody)
252
251
 
253
252
  contain_retry = resbody_nodes.any? do |resbody_node|
254
- scan(resbody_node) do |node_in_resbody|
255
- break true if node_in_resbody.type == :retry
256
- end
253
+ resbody_node.each_descendant.any?(&:retry_type?)
257
254
  end
258
255
 
259
256
  # Treat begin..rescue..end with retry as a loop.
@@ -309,9 +306,9 @@ module RuboCop
309
306
  referenced_variable_names_in_loop = []
310
307
  assignment_nodes_in_loop = []
311
308
 
312
- # #scan does not consider scope,
309
+ # #each_descendant does not consider scope,
313
310
  # but we don't need to care about it here.
314
- scan(loop_node) do |node|
311
+ loop_node.each_descendant do |node|
315
312
  case node.type
316
313
  when :lvar
317
314
  referenced_variable_names_in_loop << node.children.first
@@ -328,16 +325,6 @@ module RuboCop
328
325
  [referenced_variable_names_in_loop, assignment_nodes_in_loop]
329
326
  end
330
327
 
331
- # Simple recursive scan
332
- def scan(node, &block)
333
- node.children.each do |child|
334
- next unless child.is_a?(Parser::AST::Node)
335
- yield child
336
- scan(child, &block)
337
- end
338
- nil
339
- end
340
-
341
328
  # Use Node#equal? for accurate check.
342
329
  def scanned_node?(node)
343
330
  scanned_nodes.any? do |scanned_node|
@@ -65,37 +65,29 @@ module RuboCop
65
65
  end
66
66
 
67
67
  def meta_assignment_node
68
- if instance_variable_defined?(:@meta_assignment_node)
69
- return @meta_assignment_node
68
+ unless instance_variable_defined?(:@meta_assignment_node)
69
+ @meta_assignment_node =
70
+ operator_assignment_node || multiple_assignment_node
70
71
  end
71
72
 
72
- @meta_assignment_node = nil
73
-
74
- return unless parent_node
75
-
76
- if OPERATOR_ASSIGNMENT_TYPES.include?(parent_node.type) &&
77
- parent_node.children.index(@node) == 0
78
- return @meta_assignment_node = parent_node
79
- end
80
-
81
- return unless grantparent_node
82
-
83
- if parent_node.type == MULTIPLE_LEFT_HAND_SIDE_TYPE &&
84
- grantparent_node.type == MULTIPLE_ASSIGNMENT_TYPE
85
- return @meta_assignment_node = grantparent_node
86
- end
87
-
88
- nil
73
+ @meta_assignment_node
89
74
  end
90
75
 
91
76
  private
92
77
 
93
- def parent_node
94
- ancestor_nodes_in_scope.last
78
+ def operator_assignment_node
79
+ return nil unless node.parent
80
+ return nil unless OPERATOR_ASSIGNMENT_TYPES.include?(node.parent.type)
81
+ return nil unless node.parent.children.index(node) == 0
82
+ node.parent
95
83
  end
96
84
 
97
- def grantparent_node
98
- ancestor_nodes_in_scope[-2]
85
+ def multiple_assignment_node
86
+ grandparent_node = node.parent ? node.parent.parent : nil
87
+ return nil unless grandparent_node
88
+ return nil unless grandparent_node.type == MULTIPLE_ASSIGNMENT_TYPE
89
+ return nil unless node.parent.type == MULTIPLE_LEFT_HAND_SIDE_TYPE
90
+ grandparent_node
99
91
  end
100
92
  end
101
93
  end
@@ -27,6 +27,25 @@ module RuboCop
27
27
  branch_point_node
28
28
  end
29
29
 
30
+ def run_exclusively_with?(other)
31
+ return false unless branch_point_node.equal?(other.branch_point_node)
32
+ return false if branch_body_node.equal?(other.branch_body_node)
33
+
34
+ # Main body of rescue is always run:
35
+ #
36
+ # begin
37
+ # # main
38
+ # rescue
39
+ # # resbody
40
+ # end
41
+ if branch_point_node.type == :rescue &&
42
+ (branch_body_name == 'main' || other.branch_body_name == 'main')
43
+ return false
44
+ end
45
+
46
+ true
47
+ end
48
+
30
49
  def branch_id
31
50
  return nil unless inside_of_branch?
32
51
  @branch_id ||= [branch_point_node.object_id, branch_type].join('_')
@@ -57,12 +76,6 @@ module RuboCop
57
76
  @branch_body_node
58
77
  end
59
78
 
60
- def ancestor_nodes_in_scope
61
- @ancestor_nodes_in_scope ||= scope.ancestors_of_node(@node)
62
- end
63
-
64
- private
65
-
66
79
  def branch_body_name
67
80
  case branch_point_node.type
68
81
  when :if
@@ -83,6 +96,8 @@ module RuboCop
83
96
  "Invalid body index #{body_index} of #{branch_point_node.type}"
84
97
  end
85
98
 
99
+ private
100
+
86
101
  def if_body_name
87
102
  case body_index
88
103
  when 1 then 'true'
@@ -128,9 +143,9 @@ module RuboCop
128
143
  end
129
144
 
130
145
  def set_branch_point_and_body_nodes!
131
- ancestors_and_self_nodes = ancestor_nodes_in_scope + [@node]
146
+ self_and_ancestor_nodes = [node] + ancestor_nodes_in_scope
132
147
 
133
- ancestors_and_self_nodes.reverse.each_cons(2) do |child, parent|
148
+ self_and_ancestor_nodes.each_cons(2) do |child, parent|
134
149
  next unless branch?(parent, child)
135
150
  @branch_point_node = parent
136
151
  @branch_body_node = child
@@ -138,6 +153,12 @@ module RuboCop
138
153
  end
139
154
  end
140
155
 
156
+ def ancestor_nodes_in_scope
157
+ node.each_ancestor.take_while do |ancestor_node|
158
+ !ancestor_node.equal?(scope.node)
159
+ end
160
+ end
161
+
141
162
  def branch?(parent_node, child_node)
142
163
  child_index = parent_node.children.index(child_node)
143
164
 
@@ -7,6 +7,14 @@ module RuboCop
7
7
  # This is a place where local variables belong to.
8
8
  # A scope instance holds a scope node and variable entries.
9
9
  class Scope
10
+ OUTER_SCOPE_CHILD_INDICES = {
11
+ defs: 0..0,
12
+ module: 0..0,
13
+ class: 0..1,
14
+ sclass: 0..0,
15
+ block: 0..0
16
+ }
17
+
10
18
  attr_reader :node, :variables
11
19
 
12
20
  def initialize(node)
@@ -34,7 +42,7 @@ module RuboCop
34
42
 
35
43
  def body_node
36
44
  child_index = case @node.type
37
- when :top_level then 0
45
+ when :begin then 0
38
46
  when :module, :sclass then 1
39
47
  when :def, :class, :block then 2
40
48
  when :defs then 3
@@ -43,35 +51,38 @@ module RuboCop
43
51
  @node.children[child_index]
44
52
  end
45
53
 
46
- def ancestors_of_node(target_node)
47
- ASTScanner.scan(@node) do |scanning_node, ancestor_nodes|
48
- return ancestor_nodes[1..-1] if scanning_node.equal?(target_node)
49
- end
50
-
51
- fail "Node #{target_node} is not found in scope #{@node}"
54
+ def each_node(&block)
55
+ return to_enum(__method__) unless block_given?
56
+ scan_node(node, &block)
52
57
  end
53
58
 
54
- # This class provides a ways to scan AST with tracking ancestor nodes.
55
- class ASTScanner
56
- def self.scan(node, &block)
57
- new.scan(node, &block)
58
- end
59
+ private
59
60
 
60
- def initialize
61
- @ancestor_nodes = []
61
+ def scan_node(node, &block)
62
+ node.each_child_node do |child_node|
63
+ next if belong_to_another_scope?(child_node)
64
+ yield child_node
65
+ scan_node(child_node, &block)
62
66
  end
67
+ end
63
68
 
64
- def scan(node, &block)
65
- @ancestor_nodes.push(node)
69
+ def belong_to_another_scope?(node)
70
+ belong_to_outer_scope?(node) || belong_to_inner_scope?(node)
71
+ end
66
72
 
67
- node.children.each do |child|
68
- next unless child.is_a?(Parser::AST::Node)
69
- yield child, @ancestor_nodes
70
- scan(child, &block)
71
- end
73
+ def belong_to_outer_scope?(target_node)
74
+ return false unless target_node.parent.equal?(node)
75
+ indices = OUTER_SCOPE_CHILD_INDICES[target_node.parent.type]
76
+ return false unless indices
77
+ indices.include?(target_node.sibling_index)
78
+ end
72
79
 
73
- @ancestor_nodes.pop
74
- end
80
+ def belong_to_inner_scope?(target_node)
81
+ return false if target_node.parent.equal?(node)
82
+ return false unless SCOPE_TYPES.include?(target_node.parent.type)
83
+ indices = OUTER_SCOPE_CHILD_INDICES[target_node.parent.type]
84
+ return true unless indices
85
+ !indices.include?(target_node.sibling_index)
75
86
  end
76
87
  end
77
88
  end
@@ -46,17 +46,14 @@ module RuboCop
46
46
  @assignments.reverse_each do |assignment|
47
47
  next if consumed_branch_ids.include?(assignment.branch_id)
48
48
 
49
- assignment.reference!
50
-
51
- if assignment.inside_of_branch?
52
- break if assignment.branch_id == reference.branch_id
53
-
54
- unless assignment.reference_penetrable?
55
- consumed_branch_ids << assignment.branch_id
56
- end
57
- else
58
- break
49
+ unless assignment.run_exclusively_with?(reference)
50
+ assignment.reference!
59
51
  end
52
+
53
+ break unless assignment.inside_of_branch?
54
+ break if assignment.branch_id == reference.branch_id
55
+ next if assignment.reference_penetrable?
56
+ consumed_branch_ids << assignment.branch_id
60
57
  end
61
58
  end
62
59
 
@@ -16,7 +16,7 @@ module RuboCop
16
16
 
17
17
  @config_to_allow_offenses = {}
18
18
 
19
- COPS = Cop::Cop.all.group_by { |c| c.cop_name }
19
+ COPS = Cop::Cop.all.group_by(&:cop_name)
20
20
 
21
21
  class << self
22
22
  attr_accessor :config_to_allow_offenses
@@ -55,7 +55,8 @@ module RuboCop
55
55
  default_cfg = RuboCop::ConfigLoader.default_configuration[cop_name]
56
56
  return unless default_cfg
57
57
 
58
- params = default_cfg.keys - %w(Description Enabled) - cfg.keys
58
+ params = default_cfg.keys - %w(Description StyleGuide Enabled) -
59
+ cfg.keys
59
60
  return if params.empty?
60
61
 
61
62
  output.puts "# Configuration parameters: #{params.join(', ')}."