gitlab-styles 4.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +18 -0
  3. data/.gitlab-ci.yml +4 -15
  4. data/.gitlab/merge_request_templates/Release.md +4 -4
  5. data/.rubocop.yml +3 -1
  6. data/Gemfile +3 -2
  7. data/README.md +1 -0
  8. data/gitlab-styles.gemspec +5 -4
  9. data/lib/gitlab/styles/rubocop.rb +5 -0
  10. data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +1 -1
  11. data/lib/gitlab/styles/rubocop/cop/code_reuse/active_record.rb +131 -0
  12. data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +6 -3
  13. data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +1 -1
  14. data/lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb +1 -1
  15. data/lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb +132 -0
  16. data/lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb +64 -0
  17. data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +1 -1
  18. data/lib/gitlab/styles/rubocop/cop/rspec/base.rb +18 -0
  19. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb +65 -0
  20. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb +65 -0
  21. data/lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb +10 -5
  22. data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +3 -2
  23. data/lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb +10 -13
  24. data/lib/gitlab/styles/rubocop/model_helpers.rb +1 -1
  25. data/lib/gitlab/styles/rubocop/rspec/helpers.rb +17 -0
  26. data/lib/gitlab/styles/version.rb +1 -1
  27. data/rubocop-all.yml +1 -0
  28. data/rubocop-bundler.yml +1 -0
  29. data/rubocop-code_reuse.yml +24 -0
  30. data/rubocop-default.yml +2 -0
  31. data/rubocop-gemspec.yml +1 -0
  32. data/rubocop-layout.yml +6 -0
  33. data/rubocop-lint.yml +63 -5
  34. data/rubocop-metrics.yml +1 -0
  35. data/rubocop-migrations.yml +22 -0
  36. data/rubocop-naming.yml +1 -0
  37. data/rubocop-performance.yml +48 -0
  38. data/rubocop-rails.yml +79 -0
  39. data/rubocop-rspec.yml +14 -0
  40. data/rubocop-security.yml +1 -0
  41. data/rubocop-style.yml +90 -1
  42. metadata +26 -17
  43. data/.rubocop_todo.yml +0 -7
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Checks for ambiguous block association with method when param passed without
2
3
  # parentheses.
3
4
  Lint/AmbiguousBlockAssociation:
@@ -18,6 +19,10 @@ Lint/AmbiguousRegexpLiteral:
18
19
  Lint/AssignmentInCondition:
19
20
  Enabled: false
20
21
 
22
+ # Checks for places where binary operator has identical operands
23
+ Lint/BinaryOperatorWithIdenticalOperands:
24
+ Enabled: true
25
+
21
26
  # Default values in optional keyword arguments and optional ordinal arguments
22
27
  # should not refer back to the name of the argument.
23
28
  Lint/CircularArgumentReference:
@@ -31,6 +36,22 @@ Lint/Debugger:
31
36
  Lint/DeprecatedClassMethods:
32
37
  Enabled: true
33
38
 
39
+ # Algorithmic constants for OpenSSL::Cipher and OpenSSL::Digest deprecated since OpenSSL version 2.2.0.
40
+ # Prefer passing a string instead.
41
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintdeprecatedopensslconstant
42
+ Lint/DeprecatedOpenSSLConstant:
43
+ Enabled: true
44
+
45
+ # Checks that there are no repeated conditions used in if 'elsif'.
46
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintduplicateelsifcondition
47
+ Lint/DuplicateElsifCondition:
48
+ Enabled: true
49
+
50
+ # Checks that there are no repeated exceptions used in 'rescue' expressions.
51
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintduplicaterescueexception
52
+ Lint/DuplicateRescueException:
53
+ Enabled: true
54
+
34
55
  # Check for immutable argument given to each_with_object.
35
56
  Lint/EachWithObjectArgument:
36
57
  Enabled: true
@@ -39,6 +60,11 @@ Lint/EachWithObjectArgument:
39
60
  Lint/ElseLayout:
40
61
  Enabled: true
41
62
 
63
+ # Checks for the presence of if, elsif and unless branches without a body.
64
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintemptyconditionalbody
65
+ Lint/EmptyConditionalBody:
66
+ Enabled: true
67
+
42
68
  # Checks for empty ensure block.
43
69
  Lint/EmptyEnsure:
44
70
  Enabled: true
@@ -55,6 +81,11 @@ Lint/EnsureReturn:
55
81
  Lint/FlipFlop:
56
82
  Enabled: true
57
83
 
84
+ # Checks for the presence of precise comparison of floating point numbers.
85
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintfloatcomparison
86
+ Lint/FloatComparison:
87
+ Enabled: true
88
+
58
89
  # Catches floating-point literals too large or small for Ruby to represent.
59
90
  Lint/FloatOutOfRange:
60
91
  Enabled: true
@@ -81,10 +112,21 @@ Lint/LiteralAsCondition:
81
112
  Lint/LiteralInInterpolation:
82
113
  Enabled: true
83
114
 
84
- # This cop checks for uses of *begin...end while/until something*.
115
+ # Checks for uses of *begin...end while/until something*.
85
116
  Lint/Loop:
86
117
  Enabled: false
87
118
 
119
+ # Checks for the presence of constructors and lifecycle callbacks without calls to super.
120
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintmissingsuper
121
+ Lint/MissingSuper:
122
+ Enabled: false
123
+
124
+ # Do not mix named captures and numbered captures in a Regexp literal
125
+ # because numbered capture is ignored if they’re mixed.
126
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintmixedregexpcapturetypes
127
+ Lint/MixedRegexpCaptureTypes:
128
+ Enabled: true
129
+
88
130
  # Do not use nested method definitions.
89
131
  Lint/NestedMethodDefinition:
90
132
  Enabled: true
@@ -93,6 +135,11 @@ Lint/NestedMethodDefinition:
93
135
  Lint/NextWithoutAccumulator:
94
136
  Enabled: true
95
137
 
138
+ # Looks for references of Regexp captures that are out of range and thus always returns nil.
139
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintoutofrangeregexpref
140
+ Lint/OutOfRangeRegexpRef:
141
+ Enabled: true
142
+
96
143
  # Checks for method calls with a space before the opening parenthesis.
97
144
  Lint/ParenthesesAsGroupedExpression:
98
145
  Enabled: true
@@ -126,6 +173,11 @@ Lint/RescueException:
126
173
  Lint/SafeNavigationWithEmpty:
127
174
  Enabled: true
128
175
 
176
+ # Checks for self-assignments.
177
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintselfassignment
178
+ Lint/SelfAssignment:
179
+ Enabled: true
180
+
129
181
  # Checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception.
130
182
  Lint/ShadowedException:
131
183
  Enabled: false
@@ -143,6 +195,11 @@ Lint/StructNewOverride:
143
195
  Lint/SuppressedException:
144
196
  Enabled: false
145
197
 
198
+ # Checks for top level return with arguments.
199
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#linttoplevelreturnwithargument
200
+ Lint/TopLevelReturnWithArgument:
201
+ Enabled: true
202
+
146
203
  # Do not use prefix `_` for a variable that is used.
147
204
  Lint/UnderscorePrefixedVariableName:
148
205
  Enabled: true
@@ -155,6 +212,11 @@ Lint/UnifiedInteger:
155
212
  Lint/UnreachableCode:
156
213
  Enabled: true
157
214
 
215
+ # Checks for loops that will have at most one iteration.
216
+ # https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintunreachableloop
217
+ Lint/UnreachableLoop:
218
+ Enabled: true
219
+
158
220
  # This cop checks for unused block arguments.
159
221
  Lint/UnusedBlockArgument:
160
222
  Enabled: false
@@ -172,10 +234,6 @@ Lint/UselessAccessModifier:
172
234
  Lint/UselessAssignment:
173
235
  Enabled: true
174
236
 
175
- # Checks for comparison of something with itself.
176
- Lint/UselessComparison:
177
- Enabled: true
178
-
179
237
  # Checks for useless `else` in `begin..end` without `rescue`.
180
238
  Lint/UselessElseWithoutRescue:
181
239
  Enabled: true
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # A calculated magnitude based on number of assignments,
2
3
  # branches, and conditions.
3
4
  Metrics/AbcSize:
@@ -0,0 +1,22 @@
1
+ ---
2
+ # Checks for methods that may lead to batch type issues on a table that's been
3
+ # explicitly denied because of its size.
4
+ #
5
+ # Even though these methods perform functions to avoid
6
+ # downtime, using it with tables with millions of rows still causes a
7
+ # significant delay in the deploy process and is best avoided.
8
+ #
9
+ # See https://gitlab.com/gitlab-com/infrastructure/issues/1602 for more
10
+ # information.
11
+ # The default can be changed as follows:
12
+ # Migration/UpdateLargeTable:
13
+ # DeniedTables:
14
+ # - :usage_data
15
+ # - :version_checks
16
+ # DeniedMethods:
17
+ # - :add_column_with_default
18
+ # - :change_column_type_concurrently
19
+ # - :rename_column_concurrently
20
+ # - :update_column_in_batches
21
+ Migration/UpdateLargeTable:
22
+ Enabled: false
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Check the naming of accessor methods for get_/set_.
2
3
  Naming/AccessorMethodName:
3
4
  Enabled: false
@@ -1,3 +1,15 @@
1
+ ---
2
+ # Used to identify usages of ancestors.include? and change them to use ⇐ instead.
3
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performanceancestorsinclude
4
+ Performance/AncestorsInclude:
5
+ Enabled: true
6
+
7
+ # Identifies places where numeric argument to BigDecimal should be converted to string.
8
+ # Initializing from String is faster than from Numeric for BigDecimal.
9
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancebigdecimalwithnumericargument
10
+ Performance/BigDecimalWithNumericArgument:
11
+ Enabled: true
12
+
1
13
  # Use `caller(n..n)` instead of `caller`.
2
14
  Performance/Caller:
3
15
  Enabled: false
@@ -31,17 +43,53 @@ Performance/RedundantMerge:
31
43
  Enabled: true
32
44
  MaxKeyValuePairs: 1
33
45
 
46
+ # Identifies places where sort { |a, b| a <=> b } can be replaced with sort.
47
+ # https://docs.rubocop.org/rubocop-performance/1.7/cops_performance.html#performanceredundantsortblock
48
+ Performance/RedundantSortBlock:
49
+ Enabled: true
50
+
51
+ # Checks for redundant String#chars.
52
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performanceredundantstringchars
53
+ Performance/RedundantStringChars:
54
+ Enabled: true
55
+
56
+ # Identifies places where reverse.first(n) and reverse.first can be replaced by last(n).reverse and last.
57
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancereversefirst
58
+ Performance/ReverseFirst:
59
+ Enabled: true
60
+
61
+ # Identifies places where sort { |a, b| b <=> a } can be replaced by a faster sort.reverse.
62
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancesortreverse
63
+ Performance/SortReverse:
64
+ Enabled: true
65
+
66
+ # Identifies places where gsub(/a+/, 'a') and gsub!(/a+/, 'a') can be replaced by squeeze('a') and squeeze!('a').
67
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancesqueeze
68
+ Performance/Squeeze:
69
+ Enabled: true
70
+
34
71
  # Use `start_with?` instead of a regex match anchored to the beginning of a
35
72
  # string.
36
73
  Performance/StartWith:
37
74
  Enabled: true
38
75
 
76
+ # Identifies unnecessary use of a regex where String#include? would suffice.
77
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancestringinclude
78
+ Performance/StringInclude:
79
+ Enabled: true
80
+
39
81
  # Use `tr` instead of `gsub` when you are replacing the same number of
40
82
  # characters. Use `delete` instead of `gsub` when you are deleting
41
83
  # characters.
42
84
  Performance/StringReplacement:
43
85
  Enabled: true
44
86
 
87
+ # Identifies places where custom code finding the sum of elements in some
88
+ # Enumerable object can be replaced by Enumerable#sum method.
89
+ # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancesum
90
+ Performance/Sum:
91
+ Enabled: true
92
+
45
93
  # Checks for `.times.map` calls.
46
94
  Performance/TimesMap:
47
95
  Enabled: true
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Enables Rails cops.
2
3
  Rails:
3
4
  Enabled: true
@@ -7,6 +8,18 @@ Rails/ActionFilter:
7
8
  Enabled: true
8
9
  EnforcedStyle: action
9
10
 
11
+ # Checks that Active Record callbacks are declared in the order in which they will be executed.
12
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsactiverecordcallbacksorder
13
+ Rails/ActiveRecordCallbacksOrder:
14
+ Enabled: true
15
+
16
+ # Enforces that there is only one call to after_commit
17
+ # (and its aliases - after_create_commit, after_update_commit, and after_destroy_commit)
18
+ # with the same callback name per model.
19
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsaftercommitoverride
20
+ Rails/AfterCommitOverride:
21
+ Enabled: true
22
+
10
23
  # Check that models subclass ApplicationRecord.
11
24
  Rails/ApplicationRecord:
12
25
  Enabled: false
@@ -43,6 +56,12 @@ Rails/FindBy:
43
56
  - 'app/**/*.rb'
44
57
  - 'lib/**/*.rb'
45
58
 
59
+ # Enforces that ActiveRecord#find is used instead of where.take!, find_by!, and find_by_id!
60
+ # to retrieve a single record by primary key when you expect it to be found.
61
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsfindbyid
62
+ Rails/FindById:
63
+ Enabled: true
64
+
46
65
  # Prefer `all.find_each` over `all.find`.
47
66
  Rails/FindEach:
48
67
  Enabled: true
@@ -57,6 +76,26 @@ Rails/HasAndBelongsToMany:
57
76
  Rails/HttpPositionalArguments:
58
77
  Enabled: true
59
78
 
79
+ # Checks that Active Support’s inquiry method is not used.
80
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsinquiry
81
+ Rails/Inquiry:
82
+ Enabled: true
83
+
84
+ # Enforces that mailer names end with Mailer suffix.
85
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmailername
86
+ Rails/MailerName:
87
+ Enabled: true
88
+
89
+ # Identifies places where defining routes with match can be replaced with a specific HTTP method.
90
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsmatchroute
91
+ Rails/MatchRoute:
92
+ Enabled: true
93
+
94
+ # Enforces the use of collection.exclude?(obj) over !collection.include?(obj).
95
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsnegateinclude
96
+ Rails/NegateInclude:
97
+ Enabled: true
98
+
60
99
  # Checks for calls to puts, print, etc.
61
100
  Rails/Output:
62
101
  Enabled: true
@@ -71,6 +110,16 @@ Rails/Output:
71
110
  Rails/OutputSafety:
72
111
  Enabled: false
73
112
 
113
+ # Enforces the use of pluck over map.
114
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluck
115
+ Rails/Pluck:
116
+ Enabled: true
117
+
118
+ # Identifies places where pluck is used in where query methods and can be replaced with select.
119
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railspluckinwhere
120
+ Rails/PluckInWhere:
121
+ Enabled: true
122
+
74
123
  # Checks for incorrect grammar when using methods like `3.day.ago`.
75
124
  Rails/PluralizationGrammar:
76
125
  Enabled: true
@@ -87,10 +136,30 @@ Rails/ReadWriteAttribute:
87
136
  Rails/RelativeDateConstant:
88
137
  Enabled: false
89
138
 
139
+ # Looks for inline rendering within controller actions.
140
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderinline
141
+ Rails/RenderInline:
142
+ Enabled: true
143
+
144
+ # Identifies places where render text: can be replaced with render plain:.
145
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsrenderplaintext
146
+ Rails/RenderPlainText:
147
+ Enabled: true
148
+
90
149
  # Checks the arguments of ActiveRecord scopes.
91
150
  Rails/ScopeArgs:
92
151
  Enabled: true
93
152
 
153
+ # Enforces that short forms of I18n methods are used: t instead of translate and l instead of localize.
154
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railsshorti18n
155
+ Rails/ShortI18n:
156
+ Enabled: true
157
+
158
+ # Checks SQL heredocs to use .squish.
159
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railssquishedsqlheredocs
160
+ Rails/SquishedSQLHeredocs:
161
+ Enabled: true
162
+
94
163
  # This cop checks for the use of Time methods without zone.
95
164
  Rails/TimeZone:
96
165
  Enabled: false
@@ -98,3 +167,13 @@ Rails/TimeZone:
98
167
  # This cop checks for the use of old-style attribute validation macros.
99
168
  Rails/Validation:
100
169
  Enabled: true
170
+
171
+ # Enforces consistent style when using exists?.
172
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswhereexists
173
+ Rails/WhereExists:
174
+ Enabled: true
175
+
176
+ # Identifies places where manually constructed SQL in where can be replaced with where.not(...).
177
+ # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswherenot
178
+ Rails/WhereNot:
179
+ Enabled: true
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # Check that instances are not being stubbed globally.
2
3
  RSpec/AnyInstance:
3
4
  Enabled: false
@@ -36,6 +37,14 @@ RSpec/EmptyExampleGroup:
36
37
  - it_should_email!
37
38
  - it_should_not_email!
38
39
 
40
+ # Checks if there is an empty line after let blocks.
41
+ RSpec/EmptyLineAfterLetBlock:
42
+ Enabled: true
43
+
44
+ # Checks if there is an empty line after shared example blocks.
45
+ RSpec/EmptyLineAfterSharedExample:
46
+ Enabled: true
47
+
39
48
  # Checks for long example.
40
49
  RSpec/ExampleLength:
41
50
  Enabled: false
@@ -134,6 +143,11 @@ RSpec/SingleLineHook:
134
143
  - 'spec/factories/*'
135
144
  - 'spec/requests/api/v3/*'
136
145
 
146
+ # Checks that message expectations do not have a configured response.
147
+ # https://docs.rubocop.org/rubocop-rspec/1.44/cops_rspec.html#rspecstubbedmock
148
+ RSpec/StubbedMock:
149
+ Enabled: false
150
+
137
151
  # Checks for stubbed test subjects.
138
152
  RSpec/SubjectStub:
139
153
  Enabled: false
@@ -1,3 +1,4 @@
1
+ ---
1
2
  # This cop checks for the use of JSON class methods which have potential
2
3
  # security issues.
3
4
  Security/JSONLoad:
@@ -1,3 +1,9 @@
1
+ ---
2
+ # Checks for grouping of accessors in class and module bodies.
3
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleaccessorgrouping
4
+ Style/AccessorGrouping:
5
+ Enabled: true
6
+
1
7
  # Use alias_method instead of alias.
2
8
  Style/Alias:
3
9
  EnforcedStyle: prefer_alias_method
@@ -8,6 +14,11 @@ Style/Alias:
8
14
  Style/AndOr:
9
15
  Enabled: true
10
16
 
17
+ # Enforces the use of Array() instead of explicit Array check or [*var]
18
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylearraycoercion
19
+ Style/ArrayCoercion:
20
+ Enabled: true
21
+
11
22
  # Use `Array#join` instead of `Array#*`.
12
23
  Style/ArrayJoin:
13
24
  Enabled: true
@@ -24,6 +35,11 @@ Style/Attr:
24
35
  Style/BeginBlock:
25
36
  Enabled: true
26
37
 
38
+ # Checks for places where attr_reader and attr_writer for the same method can be combined into single attr_accessor.
39
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylebisectedattraccessor
40
+ Style/BisectedAttrAccessor:
41
+ Enabled: true
42
+
27
43
  # Do not use block comments.
28
44
  Style/BlockComments:
29
45
  Enabled: true
@@ -33,10 +49,15 @@ Style/BlockComments:
33
49
  Style/BlockDelimiters:
34
50
  Enabled: true
35
51
 
36
- # This cop checks for uses of the case equality operator(===).
52
+ # Checks for uses of the case equality operator(===).
37
53
  Style/CaseEquality:
38
54
  Enabled: false
39
55
 
56
+ # Identifies places where if-elsif constructions can be replaced with case-when.
57
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylecaselikeif
58
+ Style/CaseLikeIf:
59
+ Enabled: true
60
+
40
61
  # Checks for uses of character literals.
41
62
  Style/CharacterLiteral:
42
63
  Enabled: true
@@ -95,6 +116,12 @@ Style/EndBlock:
95
116
  Style/EvenOdd:
96
117
  Enabled: true
97
118
 
119
+ # Enforces the use of explicit block argument to avoid writing block literal that
120
+ # just passes its arguments to another block.
121
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleexplicitblockargument
122
+ Style/ExplicitBlockArgument:
123
+ Enabled: true
124
+
98
125
  # Enforces consistency when using exponential notation for numbers in the code
99
126
  Style/ExponentialNotation:
100
127
  Enabled: true
@@ -111,6 +138,13 @@ Style/FormatStringToken:
111
138
  Style/FrozenStringLiteralComment:
112
139
  Enabled: true
113
140
 
141
+ # Enforces the use of $stdout/$stderr/$stdin instead of STDOUT/STDERR/STDIN. STDOUT/STDERR/STDIN are constants,
142
+ # and while you can actually reassign (possibly to redirect some stream) constants in Ruby,
143
+ # you’ll get an interpreter warning if you do so.
144
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleglobalstdstream
145
+ Style/GlobalStdStream:
146
+ Enabled: true
147
+
114
148
  # Do not introduce global variables.
115
149
  Style/GlobalVars:
116
150
  Enabled: true
@@ -118,10 +152,20 @@ Style/GlobalVars:
118
152
  - 'lib/backup/**/*'
119
153
  - 'lib/tasks/**/*'
120
154
 
155
+ # Checks for presence or absence of braces around hash literal as a last array item depending on configuration.
156
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashaslastarrayitem
157
+ Style/HashAsLastArrayItem:
158
+ Enabled: true
159
+
121
160
  # Checks for uses of each_key and each_value Hash methods.
122
161
  Style/HashEachMethods:
123
162
  Enabled: true
124
163
 
164
+ # Checks for places where case-when represents a simple 1:1 mapping and can be replaced with a hash lookup.
165
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylehashlikecase
166
+ Style/HashLikeCase:
167
+ Enabled: false
168
+
125
169
  # Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
126
170
  # over 1.8 syntax `{ :a => 1, :b => 2 }`.
127
171
  Style/HashSyntax:
@@ -161,6 +205,11 @@ Style/InverseMethods:
161
205
  Style/LambdaCall:
162
206
  Enabled: true
163
207
 
208
+ # Checks for places where keyword arguments can be used instead of boolean arguments when defining methods.
209
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleoptionalbooleanparameter
210
+ Style/OptionalBooleanParameter:
211
+ Enabled: false
212
+
164
213
  # Use `strip` instead of `lstrip.rstrip`.
165
214
  Style/Strip:
166
215
  Enabled: true
@@ -248,10 +297,25 @@ Style/PreferredHashMethods:
248
297
  Style/RedundantCapitalW:
249
298
  Enabled: true
250
299
 
300
+ # Checks for redundant assignment before returning.
301
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantassignment
302
+ Style/RedundantAssignment:
303
+ Enabled: true
304
+
251
305
  # Checks for an obsolete RuntimeException argument in raise/fail.
252
306
  Style/RedundantException:
253
307
  Enabled: true
254
308
 
309
+ # Identifies places where fetch(key) { value } can be replaced by fetch(key, value).
310
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfetchblock
311
+ Style/RedundantFetchBlock:
312
+ Enabled: true
313
+
314
+ # Checks for the presence of superfluous .rb extension in the filename provided to require and require_relative.
315
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantfileextensioninrequire
316
+ Style/RedundantFileExtensionInRequire:
317
+ Enabled: true
318
+
255
319
  # Checks for parentheses that seem not to serve any purpose.
256
320
  Style/RedundantParentheses:
257
321
  Enabled: true
@@ -260,6 +324,16 @@ Style/RedundantParentheses:
260
324
  Style/RedundantPercentQ:
261
325
  Enabled: false
262
326
 
327
+ # Checks for unnecessary single-element Regexp character classes.
328
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpcharacterclass
329
+ Style/RedundantRegexpCharacterClass:
330
+ Enabled: true
331
+
332
+ # Checks for redundant escapes inside Regexp literals.
333
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleredundantregexpescape
334
+ Style/RedundantRegexpEscape:
335
+ Enabled: true
336
+
263
337
  # Use `sort` instead of `sort_by { |x| x }`.
264
338
  Style/RedundantSortBy:
265
339
  Enabled: true
@@ -268,16 +342,31 @@ Style/RedundantSortBy:
268
342
  Style/Semicolon:
269
343
  Enabled: true
270
344
 
345
+ # Sometimes using dig method ends up with just a single argument. In such cases, dig should be replaced with [].
346
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylesingleargumentdig
347
+ Style/SingleArgumentDig:
348
+ Enabled: true
349
+
271
350
  # Checks for proper usage of fail and raise.
272
351
  Style/SignalException:
273
352
  EnforcedStyle: only_raise
274
353
  Enabled: true
275
354
 
355
+ # Checks that arrays are sliced with endless ranges instead of ary[start..-1] on Ruby 2.6+.
356
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#styleslicingwithrange
357
+ Style/SlicingWithRange:
358
+ Enabled: true
359
+
276
360
  # Check for the usage of parentheses around stabby lambda arguments.
277
361
  Style/StabbyLambdaParentheses:
278
362
  EnforcedStyle: require_parentheses
279
363
  Enabled: true
280
364
 
365
+ # Checks for places where string concatenation can be replaced with string interpolation.
366
+ # https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylestringconcatenation
367
+ Style/StringConcatenation:
368
+ Enabled: true
369
+
281
370
  # Checks if uses of quotes match the configured preference.
282
371
  Style/StringLiterals:
283
372
  Enabled: false