You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update formatters to output [Correctable] for correctable offenses.
Some cops only are able to correct in specific situations, but it is unclear from the output which offenses are auto-correctable and which aren't. This adds a tag to the output for offenses which are correctable but not corrected yet.
*[#9187](https://github.com/rubocop-hq/rubocop/pull/9187): Update formatters to output `[Correctable]` for correctable offenses. ([@dvandersluis][])
'Favor the ternary operator (`?:`) or multi-line constructs over ' \
179
179
'single-line `if/then/else/end` constructs.',
180
180
''].join("\n"))
@@ -226,7 +226,7 @@ def and_with_args
226
226
# should get 2 offenses reported.
227
227
expect($stdout.string).toeq(<<~RESULT)
228
228
#{abs('example.rb')}:7:121: C: Layout/LineLength: Line is too long. [132/120]
229
-
#{abs('example.rb')}:9:5: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
229
+
#{abs('example.rb')}:9:5: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
230
230
RESULT
231
231
end
232
232
@@ -313,9 +313,9 @@ def and_with_args
313
313
# 2 real cops were disabled, and 1 that was incorrect
314
314
# 2 real cops was enabled, but only 1 had been disabled correctly
315
315
expect($stdout.string).toeq(<<~RESULT)
316
-
#{abs('example.rb')}:8:21: W: Lint/RedundantCopEnableDirective: Unnecessary enabling of Layout/LineLength.
316
+
#{abs('example.rb')}:8:21: W: [Correctable] Lint/RedundantCopEnableDirective: Unnecessary enabling of Layout/LineLength.
317
317
#{abs('example.rb')}:9:121: C: Layout/LineLength: Line is too long. [132/120]
318
-
#{abs('example.rb')}:11:5: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
318
+
#{abs('example.rb')}:11:5: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
319
319
RESULT
320
320
end
321
321
@@ -355,9 +355,9 @@ def and_with_args
355
355
OUTPUT
356
356
expect($stdout.string)
357
357
.toeq(<<~RESULT)
358
-
#{abs('example.rb')}:3:150: C: Migration/DepartmentName: Department name is missing.
358
+
#{abs('example.rb')}:3:150: C: [Correctable] Migration/DepartmentName: Department name is missing.
359
359
#{abs('example.rb')}:4:121: C: Layout/LineLength: Line is too long. [130/120]
360
-
#{abs('example.rb')}:5:28: C: Migration/DepartmentName: Department name is missing.
360
+
#{abs('example.rb')}:5:28: C: [Correctable] Migration/DepartmentName: Department name is missing.
361
361
RESULT
362
362
end
363
363
end
@@ -377,9 +377,9 @@ def and_with_args
377
377
expect($stderr.string).toeq('')
378
378
expect($stdout.string).toeq(<<~RESULT)
379
379
#{abs('example.rb')}:3:121: C: Layout/LineLength: Line is too long. [130/120]
380
-
#{abs('example.rb')}:4:1: W: Lint/RedundantCopDisableDirective: Unnecessary disabling of all cops.
381
-
#{abs('example.rb')}:5:12: W: Lint/RedundantCopDisableDirective: Unnecessary disabling of `Layout/LineLength`, `Metrics/ClassLength`.
382
-
#{abs('example.rb')}:6:8: W: Lint/RedundantCopDisableDirective: Unnecessary disabling of all cops.
380
+
#{abs('example.rb')}:4:1: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of all cops.
381
+
#{abs('example.rb')}:5:12: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of `Layout/LineLength`, `Metrics/ClassLength`.
382
+
#{abs('example.rb')}:6:8: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of all cops.
383
383
RESULT
384
384
end
385
385
@@ -744,8 +744,8 @@ def meow_at_4am?
744
744
expect($stdout.string)
745
745
.toeq(<<~RESULT)
746
746
== example.rb ==
747
-
C: 9: 3: Layout/IndentationWidth: Use 2 (not 0) spaces for indented_internal_methods indentation.
748
-
C: 15: 3: Layout/IndentationWidth: Use 2 (not 0) spaces for indented_internal_methods indentation.
747
+
C: 9: 3: [Correctable] Layout/IndentationWidth: Use 2 (not 0) spaces for indented_internal_methods indentation.
748
+
C: 15: 3: [Correctable] Layout/IndentationWidth: Use 2 (not 0) spaces for indented_internal_methods indentation.
C: 3: 1: Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
1230
+
C: 3: 1: [Correctable] Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
0 commit comments