rubocop-highlands 1.0.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 (65) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +2 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +68 -0
  6. data/config/default.yml +39 -0
  7. data/config/rubocop-bundler.yml +8 -0
  8. data/config/rubocop-gemspec.yml +9 -0
  9. data/config/rubocop-highlands.yml +100 -0
  10. data/config/rubocop-layout.yml +560 -0
  11. data/config/rubocop-lint.yml +301 -0
  12. data/config/rubocop-metrics.yml +47 -0
  13. data/config/rubocop-naming.yml +85 -0
  14. data/config/rubocop-performance.yml +141 -0
  15. data/config/rubocop-rails.yml +208 -0
  16. data/config/rubocop-rspec.yml +331 -0
  17. data/config/rubocop-security.yml +17 -0
  18. data/config/rubocop-style.yml +983 -0
  19. data/lib/rubocop-highlands.rb +11 -0
  20. data/lib/rubocop/cop/highlands/class_name.rb +47 -0
  21. data/lib/rubocop/cop/highlands/class_or_module_declared_in_wrong_file.rb +138 -0
  22. data/lib/rubocop/cop/highlands/const_assigned_in_wrong_file.rb +74 -0
  23. data/lib/rubocop/cop/highlands/continuation_slash.rb +25 -0
  24. data/lib/rubocop/cop/highlands/default_scope.rb +20 -0
  25. data/lib/rubocop/cop/highlands/factory_attr_references_class.rb +74 -0
  26. data/lib/rubocop/cop/highlands/factory_class_use_string.rb +39 -0
  27. data/lib/rubocop/cop/highlands/mass_assignment_accessible_modifier.rb +18 -0
  28. data/lib/rubocop/cop/highlands/module_method_in_wrong_file.rb +104 -0
  29. data/lib/rubocop/cop/highlands/no_timeout.rb +19 -0
  30. data/lib/rubocop/cop/highlands/opt_arg_parameters.rb +38 -0
  31. data/lib/rubocop/cop/highlands/phrase_bundle_keys.rb +67 -0
  32. data/lib/rubocop/cop/highlands/risky_activerecord_invocation.rb +63 -0
  33. data/lib/rubocop/cop/highlands/rspec_describe_or_context_under_namespace.rb +114 -0
  34. data/lib/rubocop/cop/highlands/rspec_environment_modification.rb +58 -0
  35. data/lib/rubocop/cop/highlands/simple_modifier_conditional.rb +23 -0
  36. data/lib/rubocop/cop/highlands/simple_unless.rb +19 -0
  37. data/lib/rubocop/cop/highlands/spec_constant_assignment.rb +55 -0
  38. data/lib/rubocop/cop/highlands/unsafe_yaml_marshal.rb +47 -0
  39. data/lib/rubocop/highlands.rb +16 -0
  40. data/lib/rubocop/highlands/inflections.rb +14 -0
  41. data/lib/rubocop/highlands/inject.rb +20 -0
  42. data/lib/rubocop/highlands/rails_autoloading.rb +55 -0
  43. data/lib/rubocop/highlands/version.rb +8 -0
  44. data/rubocop-highlands.gemspec +31 -0
  45. data/spec/rubocop/cop/highlands/class_name_spec.rb +78 -0
  46. data/spec/rubocop/cop/highlands/class_or_module_declared_in_wrong_file_spec.rb +174 -0
  47. data/spec/rubocop/cop/highlands/const_assigned_in_wrong_file_spec.rb +178 -0
  48. data/spec/rubocop/cop/highlands/continuation_slash_spec.rb +162 -0
  49. data/spec/rubocop/cop/highlands/default_scope_spec.rb +38 -0
  50. data/spec/rubocop/cop/highlands/factory_attr_references_class_spec.rb +160 -0
  51. data/spec/rubocop/cop/highlands/factory_class_use_string_spec.rb +26 -0
  52. data/spec/rubocop/cop/highlands/mass_assignment_accessible_modifier_spec.rb +28 -0
  53. data/spec/rubocop/cop/highlands/module_method_in_wrong_file_spec.rb +181 -0
  54. data/spec/rubocop/cop/highlands/no_timeout_spec.rb +30 -0
  55. data/spec/rubocop/cop/highlands/opt_arg_parameter_spec.rb +103 -0
  56. data/spec/rubocop/cop/highlands/phrase_bundle_keys_spec.rb +74 -0
  57. data/spec/rubocop/cop/highlands/risky_activerecord_invocation_spec.rb +54 -0
  58. data/spec/rubocop/cop/highlands/rspec_describe_or_context_under_namespace_spec.rb +284 -0
  59. data/spec/rubocop/cop/highlands/rspec_environment_modification_spec.rb +64 -0
  60. data/spec/rubocop/cop/highlands/simple_modifier_conditional_spec.rb +122 -0
  61. data/spec/rubocop/cop/highlands/simple_unless_spec.rb +36 -0
  62. data/spec/rubocop/cop/highlands/spec_constant_assignment_spec.rb +80 -0
  63. data/spec/rubocop/cop/highlands/unsafe_yaml_marshal_spec.rb +50 -0
  64. data/spec/spec_helper.rb +35 -0
  65. metadata +151 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0ec60728e554461d628ddaf68007905fd8fe43500468cf87691283ce6e25c6e2
4
+ data.tar.gz: c498844ec35fc70fe7ffb4dfcefa6825f898b14bcb3485e0a09fdc39cd097088
5
+ SHA512:
6
+ metadata.gz: d50770b3152d5eb2447a4815f0d975859086b901c1d3d329267dd3f4eeec69b3ae8d1f24d7dd4d81157f9f8ea139886a76a36e329e3c9b66e33e655e032ea9b5
7
+ data.tar.gz: c867e4ade00482905e45d3e27caed8935d621bb3f3366cef00789487a9f71cdd58614f89672ef1ba7ddd1347c3034b4364587207dd74cb7d0721f5240baf72c5
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ # 1.0.0
2
+ * First release of rubocop-highlands
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'pry'
7
+ end
data/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Church of the Highlands
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # RuboCop Church of the Highlands
2
+
3
+ Church of the Highlands specific analysis for [RuboCop](https://github.com/rubocop-hq/rubocop).
4
+
5
+ It contains Church of the Highlands' internally used configuration for
6
+ [RuboCop](https://github.com/rubocop-hq/rubocop) and
7
+ [RuboCop RSpec](https://github.com/backus/rubocop-rspec). It also includes a handful custom rules
8
+ that are not currently addressed by other projects.
9
+
10
+ ## Installation
11
+
12
+ Just put this in your `Gemfile` it depends on the appropriate version of rubocop and rubocop-rspec.
13
+
14
+ ```
15
+ gem 'rubocop-highlands'
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You need to tell RuboCop to load the Highlands extension. There are three
21
+ ways to do this:
22
+
23
+ ### RuboCop configuration file
24
+ First Create a new file `.rubocop_highlands.yml` in the same directory as your `.rubocop.yml`
25
+ this file should contain
26
+ ```
27
+ require:
28
+ - rubocop-highlands
29
+ ```
30
+
31
+ Next add the following to `.rubocop.yml`
32
+ or add before `.rubocop_todo.yml` in your existing `inherit_from`
33
+
34
+ ```
35
+ inherit_from:
36
+ - .rubocop_highlands.yml
37
+ - .rubocop_todo.yml
38
+ ```
39
+
40
+ You need to inherit `.rubocop_highlands.yml` from another file because of Rubocop order of operations.
41
+ It runs `inherit_from` before `require` commands. If the configuration is not in a separate file
42
+ you could potentially experience a bunch of warnings from `.rubocop_todo.yml` for non-existant
43
+ `Highlands` rules.
44
+
45
+ Now you can run `rubocop` and it will automatically load the RuboCop Highlands
46
+ cops together with the standard cops.
47
+
48
+ ### Command line
49
+
50
+ ```bash
51
+ rubocop --require rubocop-highlands
52
+ ```
53
+
54
+ ## The Cops
55
+
56
+ All cops are located under
57
+ [`lib/rubocop/cop/highlands`](lib/rubocop/cop/highlands), and contain
58
+ examples/documentation.
59
+
60
+ In your `.rubocop.yml`, you may treat the Church of the Highlands cops just like any other
61
+ cop. For example:
62
+
63
+ ```yaml
64
+ Highlands/PhraseBundleKeys:
65
+ Exclude:
66
+ - spec/my_poorly_named_spec_file.rb
67
+ ```
68
+
@@ -0,0 +1,39 @@
1
+ Rails:
2
+ Enabled: true
3
+
4
+ ##############
5
+ # Global rules
6
+
7
+ AllCops:
8
+ Exclude:
9
+ - '.chefrepo/**/*'
10
+ - '.vagrant/**/*'
11
+ - '.git/**/*'
12
+ - 'node_modules/**/*'
13
+ - 'tungsten/**/*'
14
+ - 'tungsten-support/**/*'
15
+ - 'vendor/**/*'
16
+ - Vagrantfile
17
+ - Guardfile
18
+ RSpec:
19
+ Patterns:
20
+ - _spec.rb
21
+ - "(?:^|/)spec/"
22
+ RSpec/FactoryBot:
23
+ Patterns:
24
+ - spec/factories/**/*.rb
25
+ - features/support/factories/**/*.rb
26
+
27
+ inherit_from:
28
+ - './rubocop-highlands.yml'
29
+ - './rubocop-bundler.yml'
30
+ - './rubocop-gemspec.yml'
31
+ - './rubocop-layout.yml'
32
+ - './rubocop-lint.yml'
33
+ - './rubocop-metrics.yml'
34
+ - './rubocop-naming.yml'
35
+ - './rubocop-performance.yml'
36
+ - './rubocop-rails.yml'
37
+ - './rubocop-rspec.yml'
38
+ - './rubocop-security.yml'
39
+ - './rubocop-style.yml'
@@ -0,0 +1,8 @@
1
+ Bundler/DuplicatedGem:
2
+ Enabled: true
3
+
4
+ Bundler/InsecureProtocolSource:
5
+ Enabled: false
6
+
7
+ Bundler/OrderedGems:
8
+ Enabled: false
@@ -0,0 +1,9 @@
1
+ Gemspec/OrderedDependencies:
2
+ Enabled: false
3
+
4
+ Gemspec/RequiredRubyVersion:
5
+ Description: Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of
6
+ .rubocop.yml are equal.
7
+ Enabled: false
8
+ Include:
9
+ - '**/*.gemspec'
@@ -0,0 +1,100 @@
1
+ # All of these rules are implemented in this gem.
2
+ # They are custom built for use inside Highlands and address issues that we have experienced in
3
+ # testing and production.
4
+
5
+ Highlands/ClassName:
6
+ Description: Use :class_name => "Model" instead of :class_name => Model.name
7
+ to avoid a long cascade of autoloading.
8
+ Enabled: true
9
+
10
+ Highlands/ClassOrModuleDeclaredInWrongFile:
11
+ Description: Declare a class or module in the file that matches its namespace and name.
12
+ Enabled: true
13
+ Include:
14
+ - 'app/**/*'
15
+ - 'lib/**/*'
16
+
17
+ Highlands/ConstAssignedInWrongFile:
18
+ Description: Assign a const in a file that matches the namespace in which it is scoped.
19
+ Enabled: true
20
+ Include:
21
+ - 'app/**/*'
22
+ - 'lib/**/*'
23
+
24
+ Highlands/ContinuationSlash:
25
+ Description: Slash continuation should be reserved for string continatuion. Many times it is
26
+ used to get around other existing rules.
27
+ Enabled: true
28
+
29
+ Highlands/DefaultScope:
30
+ Description: Avoid `default_scope`. Default scopes make it difficult to
31
+ refactor data access patterns since the scope becomes part of every query unless
32
+ explicitly excluded, even when it is unnecessary or incidental to the desired logic.
33
+ Enabled: true
34
+
35
+ Highlands/FactoryAttrReferencesClass:
36
+ Description: Cop to enforce "attr { CONST }" instead of "attr CONST" in factories,
37
+ because the latter forces autoload, which slows down spec startup time and
38
+ Zeus reload time after touching a model.
39
+ Enabled: true
40
+
41
+ Highlands/FactoryClassUseString:
42
+ Description: Cop to tell developers to use :class => "MyClass" instead of :class => MyClass,
43
+ because the latter slows down reloading zeus.
44
+ Enabled: true
45
+
46
+ Highlands/MassAssignmentAccessibleModifier:
47
+ Description: Do no override and objects mass assignment restrictions.
48
+ Enabled: true
49
+
50
+ Highlands/ModuleMethodInWrongFile:
51
+ Description: Define a module method in the file that defines the module, not a file that
52
+ happens to use the module as a namespace.
53
+ Enabled: true
54
+ Include:
55
+ - 'app/**/*'
56
+ - 'lib/**/*'
57
+
58
+ Highlands/NoTimeout:
59
+ Description: Do not use Timeout.timeout. In combination with Rails autoloading,
60
+ timeout can cause Segmentation Faults in version of Ruby we use.
61
+ It can also cause logic errors since it can raise in
62
+ any callee scope. Use client library timeouts and monitoring to
63
+ ensure proper timing behavior for web requests.
64
+ Enabled: true
65
+
66
+ Highlands/OptArgParameters:
67
+ Description: Do not use default arguments. Use an options hash instead.
68
+ Enabled: true
69
+ StyleGuide: https://github.com/highlands/ruby#no-default-args
70
+
71
+ Highlands/PhraseBundleKeys:
72
+ Description: Checks for phrase bundle keys that do not match their respective translation keys.
73
+ Enabled: true
74
+
75
+ Highlands/RiskyActiverecordInvocation:
76
+ Description: Disallow ActiveRecord calls that use interpolated or added strings as arguments.
77
+ Enabled: true
78
+
79
+ Highlands/RspecEnvironmentModification:
80
+ Description: Disallow Rails.env from being stubbed in half measure ways or from being reassigned
81
+ Use `stub_env` instead.
82
+ Enabled: true
83
+
84
+ Highlands/SimpleModifierConditional:
85
+ Enabled: true
86
+ StyleGuide: https://github.com/highlands/ruby#only-simple-if-unless
87
+
88
+ Highlands/SimpleUnless:
89
+ Enabled: true
90
+ StyleGuide: https://github.com/highlands/ruby#unless-with-multiple-conditions
91
+
92
+ Highlands/SpecConstantAssignment:
93
+ Description: Constant assignment in specs polute global namespace and are a cause of spurious
94
+ specs. They should be avoided. Also modifing existing constants is bad too, use stub_const
95
+ instead
96
+ Enabled: true
97
+
98
+ Highlands/UnsafeYamlMarshal:
99
+ Description: Avoid use of YAML/Marshal methods that can trigger RCE on untrusted input.
100
+ Enabled: true
@@ -0,0 +1,560 @@
1
+ # Type 'Style' (166):
2
+ # Supports --auto-correct
3
+ Layout/AccessModifierIndentation:
4
+ Description: Check indentation of private/protected visibility modifiers.
5
+ # Highlands: https://github.com/highlands/ruby#access-modifiers
6
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#indent-public-private-protected
7
+ Enabled: true
8
+ EnforcedStyle: indent
9
+ SupportedStyles:
10
+ - outdent
11
+ - indent
12
+
13
+ # Supports --auto-correct
14
+ Layout/AlignArray:
15
+ Description: Align the elements of an array literal if they span more than one line.
16
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#align-multiline-arrays
17
+ Enabled: true
18
+
19
+ # Supports --auto-correct
20
+ Layout/AlignHash:
21
+ Description: Align the elements of a hash literal if they span more than one line.
22
+ Enabled: true
23
+ EnforcedHashRocketStyle: key
24
+ EnforcedColonStyle: key
25
+ EnforcedLastArgumentHashStyle: always_inspect
26
+ SupportedLastArgumentHashStyles:
27
+ - always_inspect
28
+ - always_ignore
29
+ - ignore_implicit
30
+ - ignore_explicit
31
+
32
+ # Supports --auto-correct
33
+ Layout/AlignParameters:
34
+ Description: Align the parameters of a method call if they span more than one line.
35
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-double-indent
36
+ Enabled: true
37
+ EnforcedStyle: with_first_parameter
38
+ SupportedStyles:
39
+ - with_first_parameter
40
+ - with_fixed_indentation
41
+
42
+ # Supports --auto-correct
43
+ Layout/BlockAlignment:
44
+ Description: Align block ends correctly.
45
+ Enabled: true
46
+
47
+ # Supports --auto-correct
48
+ Layout/BlockEndNewline:
49
+ Description: Put end statement of multiline block on its own line.
50
+ Enabled: true
51
+
52
+ # Supports --auto-correct
53
+ Layout/CaseIndentation:
54
+ Description: Indentation of when in a case/when/[else/]end.
55
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#indent-when-to-case
56
+ Enabled: true
57
+ EnforcedStyle: case
58
+ IndentOneStep: false
59
+
60
+ Layout/ClassStructure:
61
+ Enabled: false
62
+ Categories:
63
+ module_inclusion:
64
+ - include
65
+ - prepend
66
+ - extend
67
+ ExpectedOrder:
68
+ - module_inclusion
69
+ - constants
70
+ - public_class_methods
71
+ - initializer
72
+ - instance_methods
73
+ - protected_methods
74
+ - private_methods
75
+
76
+ Layout/ClosingHeredocIndentation:
77
+ Enabled: false
78
+
79
+ # Supports --auto-correct
80
+ Layout/ClosingParenthesisIndentation:
81
+ Description: Checks the indentation of hanging closing parentheses.
82
+ Enabled: true
83
+
84
+ # Supports --auto-correct
85
+ Layout/CommentIndentation:
86
+ Description: Indentation of comments.
87
+ Enabled: true
88
+
89
+ Layout/ConditionPosition:
90
+ Description: Checks for condition placed in a confusing position relative to the keyword.
91
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#same-line-condition
92
+ Enabled: true
93
+
94
+ # Supports --auto-correct
95
+ Layout/DefEndAlignment:
96
+ Description: Align ends corresponding to defs correctly.
97
+ Enabled: true
98
+ EnforcedStyleAlignWith: start_of_line
99
+ AutoCorrect: false
100
+
101
+ # Use trailing commas, because there are safer in ruby.
102
+ Layout/DotPosition:
103
+ Enabled: true
104
+ EnforcedStyle: trailing
105
+
106
+ # Supports --auto-correct
107
+ Layout/ElseAlignment:
108
+ Description: Align elses and elsifs correctly.
109
+ Enabled: true
110
+
111
+ Layout/EmptyComment:
112
+ Description: 'Checks empty comment.'
113
+ Enabled: true
114
+
115
+ Layout/EmptyLineAfterMagicComment:
116
+ Enabled: true
117
+
118
+ # Supports --auto-correct
119
+ Layout/EmptyLineBetweenDefs:
120
+ Description: Use empty lines between defs.
121
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#empty-lines-between-methods
122
+ Enabled: true
123
+ AllowAdjacentOneLineDefs: false
124
+
125
+ # Supports --auto-correct
126
+ Layout/EmptyLines:
127
+ Description: Don't use several empty lines in a row.
128
+ Enabled: true
129
+
130
+ Layout/EmptyLineAfterGuardClause:
131
+ Enabled: false
132
+
133
+ # Supports --auto-correct
134
+ Layout/EmptyLinesAroundAccessModifier:
135
+ Description: Keep blank lines around access modifiers.
136
+ Enabled: true
137
+
138
+ Layout/EmptyLinesAroundArguments:
139
+ Description: "Keeps track of empty lines around method arguments."
140
+ Enabled: false
141
+
142
+ Layout/EmptyLinesAroundBeginBody:
143
+ Enabled: true
144
+
145
+ # Supports --auto-correct
146
+ Layout/EmptyLinesAroundBlockBody:
147
+ Description: Keeps track of empty lines around block bodies.
148
+ Enabled: true
149
+ EnforcedStyle: no_empty_lines
150
+ SupportedStyles:
151
+ - empty_lines
152
+ - no_empty_lines
153
+
154
+ # Supports --auto-correct
155
+ Layout/EmptyLinesAroundClassBody:
156
+ Description: Keeps track of empty lines around class bodies.
157
+ Enabled: true
158
+ EnforcedStyle: no_empty_lines
159
+ SupportedStyles:
160
+ - beginning_only
161
+ - empty_lines
162
+ - end_only
163
+ - no_empty_lines
164
+
165
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
166
+ Enabled: false
167
+
168
+ # Supports --auto-correct
169
+ Layout/EmptyLinesAroundMethodBody:
170
+ Description: Keeps track of empty lines around method bodies.
171
+ Enabled: true
172
+
173
+ # Supports --auto-correct
174
+ Layout/EmptyLinesAroundModuleBody:
175
+ Description: Keeps track of empty lines around module bodies.
176
+ Enabled: true
177
+ EnforcedStyle: no_empty_lines
178
+ SupportedStyles:
179
+ - empty_lines
180
+ - no_empty_lines
181
+
182
+ # Supports --auto-correct
183
+ Layout/EndAlignment:
184
+ Description: Align ends correctly.
185
+ # The value `keyword` means that `end` should be aligned with the matching
186
+ # keyword (if, while, etc.).
187
+ # The value `variable` means that in assignments, `end` should be aligned
188
+ # with the start of the variable on the left hand side of `=`. In all other
189
+ # situations, `end` should still be aligned with the keyword.
190
+ # The value `start_of_line` means that `end` should be aligned with the start
191
+ # of the line which the matching keyword appears on.
192
+ Enabled: true
193
+ EnforcedStyleAlignWith: keyword
194
+ AutoCorrect: false
195
+
196
+ Layout/EndOfLine:
197
+ Description: Use Unix-style line endings.
198
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#crlf
199
+ Enabled: false
200
+
201
+ # Supports --auto-correct
202
+ Layout/ExtraSpacing:
203
+ Description: Do not use unnecessary spacing.
204
+ Enabled: true
205
+ AllowForAlignment: true
206
+
207
+ # Supports --auto-correct
208
+ Layout/FirstArrayElementLineBreak:
209
+ Description: Checks for a line break before the first element in a multi-line array.
210
+ Enabled: true
211
+
212
+ # Supports --auto-correct
213
+ Layout/FirstHashElementLineBreak:
214
+ Description: Checks for a line break before the first element in a multi-line hash.
215
+ Enabled: true
216
+
217
+ # Supports --auto-correct
218
+ Layout/FirstMethodArgumentLineBreak:
219
+ Description: Checks for a line break before the first argument in a multi-line method
220
+ call.
221
+ Enabled: false
222
+
223
+ # Supports --auto-correct
224
+ Layout/FirstMethodParameterLineBreak:
225
+ Description: Checks for a line break before the first parameter in a multi-line method
226
+ parameter definition.
227
+ Enabled: false
228
+
229
+ # Supports --auto-correct
230
+ Layout/FirstParameterIndentation:
231
+ Description: Checks the indentation of the first parameter in a method call.
232
+ Enabled: true
233
+ EnforcedStyle: consistent
234
+ SupportedStyles:
235
+ - consistent
236
+ - consistent_relative_to_receiver
237
+ - special_for_inner_method_call
238
+ - special_for_inner_method_call_in_parentheses
239
+
240
+ # Supports --auto-correct
241
+ Layout/IndentArray:
242
+ Description: Checks the indentation of the first element in an array literal.
243
+ Enabled: true
244
+ EnforcedStyle: consistent
245
+
246
+ # Supports --auto-correct
247
+ Layout/IndentAssignment:
248
+ Description: Checks the indentation of the first line of the right-hand-side of a
249
+ multi-line assignment.
250
+ Enabled: true
251
+ IndentationWidth:
252
+
253
+ # Supports --auto-correct
254
+ Layout/IndentHash:
255
+ Description: Checks the indentation of the first key in a hash literal.
256
+ Enabled: true
257
+ EnforcedStyle: consistent
258
+ SupportedStyles:
259
+ - special_inside_parentheses
260
+ - consistent
261
+
262
+ Layout/IndentHeredoc:
263
+ Enabled: false
264
+
265
+ # Supports --auto-correct
266
+ Layout/IndentationConsistency:
267
+ Description: Keep indentation straight.
268
+ Enabled: true
269
+ EnforcedStyle: normal
270
+ SupportedStyles:
271
+ - normal
272
+ - rails
273
+
274
+ # Supports --auto-correct
275
+ Layout/IndentationWidth:
276
+ Description: Use 2 spaces for indentation.
277
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-indentation
278
+ Enabled: true
279
+ Width: 2
280
+
281
+ # Supports --auto-correct
282
+ Layout/InitialIndentation:
283
+ Description: Checks the indentation of the first non-blank non-comment line in a file.
284
+ Enabled: true
285
+
286
+ Layout/LeadingBlankLines:
287
+ Enabled: true
288
+
289
+ # Supports --auto-correct
290
+ Layout/LeadingCommentSpace:
291
+ Description: Comments should start with a space.
292
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#hash-space
293
+ Enabled: true
294
+
295
+ # Supports --auto-correct
296
+ Layout/MultilineArrayBraceLayout:
297
+ Description: Checks that the closing brace in an array literal is symmetrical with
298
+ respect to the opening brace and the array elements.
299
+ Enabled: true
300
+
301
+ # Supports --auto-correct
302
+ Layout/MultilineAssignmentLayout:
303
+ Description: Check for a newline after the assignment operator in multi-line assignments.
304
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#indent-conditional-assignment
305
+ Enabled: false
306
+ SupportedTypes:
307
+ - block
308
+ - case
309
+ - class
310
+ - if
311
+ - kwbegin
312
+ - module
313
+ EnforcedStyle: new_line
314
+ SupportedStyles:
315
+ - same_line
316
+ - new_line
317
+
318
+ # Supports --auto-correct
319
+ Layout/MultilineBlockLayout:
320
+ Description: Ensures newlines after multiline block do statements.
321
+ Enabled: true
322
+
323
+ Layout/MultilineHashBraceLayout:
324
+ Description: >-
325
+ Checks that the closing brace in a hash literal is
326
+ symmetrical with respect to the opening brace and the
327
+ hash elements.
328
+ Enabled: true
329
+
330
+ Layout/MultilineMethodCallBraceLayout:
331
+ Description: >-
332
+ Checks that the closing brace in a method call is
333
+ symmetrical with respect to the opening brace and the
334
+ method arguments.
335
+ Enabled: true
336
+ EnforcedStyle: symmetrical
337
+
338
+ # Supports --auto-correct
339
+ Layout/MultilineMethodCallIndentation:
340
+ Description: Checks indentation of method calls with the dot operator that span more
341
+ than one line.
342
+ Enabled: true
343
+ EnforcedStyle: indented
344
+ SupportedStyles:
345
+ - aligned
346
+ - indented
347
+ IndentationWidth:
348
+
349
+ Layout/MultilineMethodDefinitionBraceLayout:
350
+ Description: >-
351
+ Checks that the closing brace in a method definition is
352
+ symmetrical with respect to the opening brace and the
353
+ method parametters.
354
+ Enabled: true
355
+
356
+ # The default (aligned) would force multi line operations to look like this
357
+ # balance = Balance.
358
+ # where(cond).
359
+ # where(cond).
360
+ # first
361
+ Layout/MultilineOperationIndentation:
362
+ Enabled: false
363
+ EnforcedStyle: indented
364
+
365
+ # Supports --auto-correct
366
+ Layout/RescueEnsureAlignment:
367
+ Description: Align rescues and ensures correctly.
368
+ Enabled: true
369
+
370
+ # Supports --auto-correct
371
+ Layout/SpaceAfterColon:
372
+ Description: Use spaces after colons.
373
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
374
+ Enabled: true
375
+
376
+ # Supports --auto-correct
377
+ Layout/SpaceAfterComma:
378
+ Description: Use spaces after commas.
379
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
380
+ Enabled: true
381
+
382
+ # Supports --auto-correct
383
+ Layout/SpaceAfterMethodName:
384
+ Description: Do not put a space between a method name and the opening parenthesis
385
+ in a method definition.
386
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#parens-no-spaces
387
+ Enabled: true
388
+
389
+ # Supports --auto-correct
390
+ Layout/SpaceAfterNot:
391
+ Description: Tracks redundant space after the ! operator.
392
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-space-bang
393
+ Enabled: true
394
+
395
+ # Supports --auto-correct
396
+ Layout/SpaceAfterSemicolon:
397
+ Description: Use spaces after semicolons.
398
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
399
+ Enabled: true
400
+
401
+ # Supports --auto-correct
402
+ Layout/SpaceAroundBlockParameters:
403
+ Description: Checks the spacing inside and after block parameters pipes.
404
+ Enabled: true
405
+ EnforcedStyleInsidePipes: no_space
406
+
407
+ # Supports --auto-correct
408
+ Layout/SpaceAroundEqualsInParameterDefault:
409
+ Description: Checks that the equals signs in parameter default assignments have or
410
+ don't have surrounding space depending on configuration.
411
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-around-equals
412
+ Enabled: true
413
+ EnforcedStyle: space
414
+ SupportedStyles:
415
+ - space
416
+ - no_space
417
+
418
+ Layout/SpaceAroundKeyword:
419
+ Description: 'Use a space around keywords if appropriate.'
420
+ Enabled: true
421
+
422
+ # Supports --auto-correct
423
+ Layout/SpaceAroundOperators:
424
+ Description: Use a single space around operators.
425
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
426
+ Enabled: true
427
+ AllowForAlignment: true
428
+
429
+ # Supports --auto-correct
430
+ Layout/SpaceBeforeBlockBraces:
431
+ Description: Checks that the left block brace has or doesn't have space before it.
432
+ Enabled: true
433
+ EnforcedStyle: space
434
+ SupportedStyles:
435
+ - space
436
+ - no_space
437
+
438
+ # Supports --auto-correct
439
+ Layout/SpaceBeforeComma:
440
+ Description: No spaces before commas.
441
+ Enabled: true
442
+
443
+ # Supports --auto-correct
444
+ Layout/SpaceBeforeComment:
445
+ Description: Checks for missing space between code and a comment on the same line.
446
+ Enabled: true
447
+
448
+ # Supports --auto-correct
449
+ Layout/SpaceBeforeFirstArg:
450
+ Description: Put a space between a method name and the first argument in a method
451
+ call without parentheses.
452
+ Enabled: true
453
+
454
+ # Supports --auto-correct
455
+ Layout/SpaceBeforeSemicolon:
456
+ Description: No spaces before semicolons.
457
+ Enabled: true
458
+
459
+ Layout/SpaceInLambdaLiteral:
460
+ Enabled: false
461
+
462
+ Layout/SpaceInsideArrayPercentLiteral:
463
+ Enabled: false
464
+
465
+ # Supports --auto-correct
466
+ Layout/SpaceInsideBlockBraces:
467
+ Description: Checks that block braces have or don't have surrounding space. For blocks
468
+ taking parameters, checks that the left brace has or doesn't have trailing space.
469
+ Enabled: true
470
+ EnforcedStyle: space
471
+ SupportedStyles:
472
+ - space
473
+ - no_space
474
+ EnforcedStyleForEmptyBraces: no_space
475
+ SpaceBeforeBlockParameters: true
476
+
477
+ Layout/SpaceInsideParens:
478
+ Description: 'No spaces after ( or before ).'
479
+ StyleGuide: '#spaces-braces'
480
+ Enabled: true
481
+
482
+ Layout/SpaceInsideArrayLiteralBrackets:
483
+ EnforcedStyle: no_space
484
+ SupportedStyles:
485
+ - space
486
+ - no_space
487
+ # 'compact' normally requires a space inside the brackets, with the exception
488
+ # that successive left brackets or right brackets are collapsed together
489
+ - compact
490
+ EnforcedStyleForEmptyBrackets: no_space
491
+ SupportedStylesForEmptyBrackets:
492
+ - space
493
+ - no_space
494
+ Enabled: true
495
+
496
+ Layout/SpaceInsideReferenceBrackets:
497
+ EnforcedStyleForEmptyBrackets: no_space
498
+ SupportedStyles:
499
+ - space
500
+ - no_space
501
+ Enabled: true
502
+
503
+ # Supports --auto-correct
504
+ Layout/SpaceInsideHashLiteralBraces:
505
+ Description: Use spaces inside hash literal braces - or don't.
506
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
507
+ Enabled: true
508
+ EnforcedStyle: space
509
+ EnforcedStyleForEmptyBraces: no_space
510
+ SupportedStyles:
511
+ - space
512
+ - no_space
513
+
514
+ # Supports --auto-correct
515
+ Layout/SpaceInsideParens:
516
+ Description: No spaces after ( or before ).
517
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-spaces-braces
518
+ Enabled: true
519
+
520
+ Layout/SpaceInsidePercentLiteralDelimiters:
521
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
522
+ Enabled: true
523
+
524
+ # Supports --auto-correct
525
+ Layout/SpaceInsideRangeLiteral:
526
+ Description: No spaces inside range literals.
527
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-space-inside-range-literals
528
+ Enabled: true
529
+
530
+ # Supports --auto-correct
531
+ Layout/SpaceInsideStringInterpolation:
532
+ Description: Checks for padding/surrounding spaces inside string interpolation.
533
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#string-interpolation
534
+ Enabled: true
535
+ EnforcedStyle: no_space
536
+ SupportedStyles:
537
+ - space
538
+ - no_space
539
+
540
+ # Supports --auto-correct
541
+ Layout/Tab:
542
+ Description: No hard tabs.
543
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-indentation
544
+ Enabled: true
545
+
546
+ # Supports --auto-correct
547
+ Layout/TrailingBlankLines:
548
+ Description: Checks trailing blank lines and final newline.
549
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#newline-eof
550
+ Enabled: true
551
+ EnforcedStyle: final_newline
552
+ SupportedStyles:
553
+ - final_newline
554
+ - final_blank_line
555
+
556
+ # Supports --auto-correct
557
+ Layout/TrailingWhitespace:
558
+ Description: Avoid trailing whitespace.
559
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-trailing-whitespace
560
+ Enabled: true