rubocop 0.24.1 → 0.25.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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +12 -8
- data/.travis.yml +1 -1
- data/CHANGELOG.md +42 -0
- data/Gemfile +2 -0
- data/README.md +27 -6
- data/bin/rubocop +10 -15
- data/config/default.yml +72 -25
- data/config/enabled.yml +57 -25
- data/lib/rubocop.rb +15 -8
- data/lib/rubocop/config_loader.rb +11 -7
- data/lib/rubocop/cop/cop.rb +16 -16
- data/lib/rubocop/cop/ignored_node.rb +11 -4
- data/lib/rubocop/cop/lint/block_alignment.rb +29 -4
- data/lib/rubocop/cop/lint/debugger.rb +8 -1
- data/lib/rubocop/cop/lint/def_end_alignment.rb +5 -1
- data/lib/rubocop/cop/lint/end_alignment.rb +5 -5
- data/lib/rubocop/cop/lint/end_in_method.rb +2 -2
- data/lib/rubocop/cop/lint/useless_setter_call.rb +2 -2
- data/lib/rubocop/cop/{style → metrics}/block_nesting.rb +1 -1
- data/lib/rubocop/cop/{style → metrics}/class_length.rb +4 -4
- data/lib/rubocop/cop/{style → metrics}/cyclomatic_complexity.rb +5 -16
- data/lib/rubocop/cop/{style → metrics}/line_length.rb +1 -1
- data/lib/rubocop/cop/{style → metrics}/method_length.rb +8 -4
- data/lib/rubocop/cop/{style → metrics}/parameter_lists.rb +1 -1
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +61 -0
- data/lib/rubocop/cop/mixin/autocorrect_unless_changing_ast.rb +10 -2
- data/lib/rubocop/cop/mixin/code_length.rb +2 -3
- data/lib/rubocop/cop/mixin/configurable_naming.rb +6 -20
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/if_node.rb +1 -1
- data/lib/rubocop/cop/mixin/method_complexity.rb +32 -0
- data/lib/rubocop/cop/mixin/negative_conditional.rb +1 -1
- data/lib/rubocop/cop/mixin/{check_methods.rb → on_method.rb} +3 -3
- data/lib/rubocop/cop/mixin/on_normal_if_unless.rb +24 -0
- data/lib/rubocop/cop/mixin/percent_literal.rb +2 -1
- data/lib/rubocop/cop/mixin/space_inside.rb +33 -4
- data/lib/rubocop/cop/mixin/statement_modifier.rb +14 -14
- data/lib/rubocop/cop/mixin/string_help.rb +4 -0
- data/lib/rubocop/cop/mixin/surrounding_space.rb +1 -0
- data/lib/rubocop/cop/rails/delegate.rb +2 -2
- data/lib/rubocop/cop/rails/output.rb +4 -2
- data/lib/rubocop/cop/style/accessor_method_name.rb +2 -2
- data/lib/rubocop/cop/style/align_hash.rb +9 -1
- data/lib/rubocop/cop/style/and_or.rb +37 -3
- data/lib/rubocop/cop/style/bare_percent_literals.rb +46 -0
- data/lib/rubocop/cop/style/block_end_newline.rb +56 -0
- data/lib/rubocop/cop/style/character_literal.rb +1 -1
- data/lib/rubocop/cop/style/def_with_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +31 -3
- data/lib/rubocop/cop/style/empty_lines_around_body.rb +6 -2
- data/lib/rubocop/cop/style/end_of_line.rb +3 -14
- data/lib/rubocop/cop/style/if_unless_modifier.rb +3 -6
- data/lib/rubocop/cop/style/if_with_semicolon.rb +6 -7
- data/lib/rubocop/cop/style/indentation_width.rb +3 -8
- data/lib/rubocop/cop/style/method_def_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/method_name.rb +4 -18
- data/lib/rubocop/cop/style/multiline_block_layout.rb +73 -0
- data/lib/rubocop/cop/style/multiline_if_then.rb +4 -4
- data/lib/rubocop/cop/style/negated_if.rb +1 -1
- data/lib/rubocop/cop/style/negated_while.rb +2 -2
- data/lib/rubocop/cop/style/next.rb +12 -0
- data/lib/rubocop/cop/style/one_line_conditional.rb +6 -6
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +22 -8
- data/lib/rubocop/cop/style/percent_q_literals.rb +53 -0
- data/lib/rubocop/cop/style/predicate_name.rb +2 -2
- data/lib/rubocop/cop/style/redundant_begin.rb +2 -2
- data/lib/rubocop/cop/style/redundant_return.rb +2 -2
- data/lib/rubocop/cop/style/rescue_modifier.rb +7 -3
- data/lib/rubocop/cop/style/single_line_methods.rb +2 -2
- data/lib/rubocop/cop/style/space_after_method_name.rb +2 -2
- data/lib/rubocop/cop/style/space_inside_block_braces.rb +14 -10
- data/lib/rubocop/cop/style/space_inside_brackets.rb +5 -1
- data/lib/rubocop/cop/style/string_literals.rb +5 -8
- data/lib/rubocop/cop/style/trailing_comma.rb +15 -3
- data/lib/rubocop/cop/style/trivial_accessors.rb +2 -2
- data/lib/rubocop/cop/style/unneeded_capital_w.rb +2 -4
- data/lib/rubocop/cop/style/unneeded_percent_q.rb +13 -0
- data/lib/rubocop/cop/style/variable_interpolation.rb +14 -2
- data/lib/rubocop/cop/style/variable_name.rb +17 -17
- data/lib/rubocop/cop/style/while_until_modifier.rb +2 -5
- data/lib/rubocop/cop/util.rb +5 -0
- data/lib/rubocop/cop/variable_force.rb +7 -6
- data/lib/rubocop/formatter/base_formatter.rb +2 -2
- data/lib/rubocop/processed_source.rb +5 -22
- data/lib/rubocop/version.rb +1 -1
- data/relnotes/v0.25.0.md +91 -0
- data/rubocop.gemspec +2 -3
- data/spec/project_spec.rb +1 -1
- data/spec/rubocop/cli_spec.rb +70 -44
- data/spec/rubocop/comment_config_spec.rb +6 -6
- data/spec/rubocop/config_loader_spec.rb +19 -13
- data/spec/rubocop/config_spec.rb +3 -3
- data/spec/rubocop/cop/commissioner_spec.rb +1 -1
- data/spec/rubocop/cop/cop_spec.rb +3 -3
- data/spec/rubocop/cop/lint/block_alignment_spec.rb +113 -6
- data/spec/rubocop/cop/lint/debugger_spec.rb +10 -6
- data/spec/rubocop/cop/lint/useless_assignment_spec.rb +12 -0
- data/spec/rubocop/cop/{style → metrics}/block_nesting_spec.rb +1 -1
- data/spec/rubocop/cop/{style → metrics}/class_length_spec.rb +1 -1
- data/spec/rubocop/cop/{style → metrics}/cyclomatic_complexity_spec.rb +1 -1
- data/spec/rubocop/cop/{style → metrics}/if_unless_modifier_spec.rb +2 -2
- data/spec/rubocop/cop/{style → metrics}/line_length_spec.rb +7 -7
- data/spec/rubocop/cop/{style → metrics}/method_length_spec.rb +1 -1
- data/spec/rubocop/cop/{style → metrics}/parameter_lists_spec.rb +1 -1
- data/spec/rubocop/cop/metrics/perceived_complexity_spec.rb +222 -0
- data/spec/rubocop/cop/{style → metrics}/while_until_modifier_spec.rb +2 -2
- data/spec/rubocop/cop/rails/output_spec.rb +8 -2
- data/spec/rubocop/cop/style/align_hash_spec.rb +7 -0
- data/spec/rubocop/cop/style/and_or_spec.rb +245 -43
- data/spec/rubocop/cop/style/bare_percent_literals_spec.rb +132 -0
- data/spec/rubocop/cop/style/block_end_newline_spec.rb +61 -0
- data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +34 -0
- data/spec/rubocop/cop/style/end_of_line_spec.rb +8 -0
- data/spec/rubocop/cop/style/guard_clause_spec.rb +1 -1
- data/spec/rubocop/cop/style/multiline_block_layout_spec.rb +138 -0
- data/spec/rubocop/cop/style/next_spec.rb +32 -3
- data/spec/rubocop/cop/style/percent_literal_delimiters_spec.rb +34 -0
- data/spec/rubocop/cop/style/percent_q_literals_spec.rb +122 -0
- data/spec/rubocop/cop/style/space_inside_block_braces_spec.rb +20 -0
- data/spec/rubocop/cop/style/space_inside_brackets_spec.rb +26 -2
- data/spec/rubocop/cop/style/trailing_comma_spec.rb +112 -0
- data/spec/rubocop/cop/style/unneeded_percent_q_spec.rb +86 -31
- data/spec/rubocop/cop/style/variable_interpolation_spec.rb +21 -1
- data/spec/rubocop/cop/team_spec.rb +14 -9
- data/spec/spec_helper.rb +1 -0
- metadata +47 -50
- data/lib/rubocop/cop/mixin/if_then_else.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 162efdd3846932b1d519b27addb56f9581f28e5a
|
4
|
+
data.tar.gz: 0baf6fe4303cda3f842984b1ce7e7ee25b5e08b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aa5d6a37649a89e441f5db7b9c02e4fcc033d52e457e9afcd8927906c1443d1cf6122adaf1af7c344f9f2154694bd33e0f9e71548ace50e7d30441baf9bd972
|
7
|
+
data.tar.gz: 828617aef1af7dc5260680d67633fef8135d2d884307b9b566a6b193f685fe061d0c47a1b12ef5f90ffe8bf42266a5d087ff518389c0400605bc4347795c2351
|
data/.rubocop_todo.yml
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on 2014-
|
2
|
+
# on 2014-07-27 10:46:47 +0200 using RuboCop version 0.24.1.
|
3
3
|
# The point is for the user to remove these configuration records
|
4
4
|
# one by one as the offenses are removed from the code base.
|
5
5
|
# Note that changes in the inspected code, or installation of new
|
6
6
|
# versions of RuboCop, may require this file to be generated again.
|
7
7
|
|
8
|
-
# Offense count:
|
8
|
+
# Offense count: 8
|
9
9
|
# Configuration parameters: CountComments.
|
10
|
-
|
11
|
-
Max:
|
10
|
+
Metrics/ClassLength:
|
11
|
+
Max: 131
|
12
12
|
|
13
|
-
# Offense count:
|
14
|
-
|
13
|
+
# Offense count: 30
|
14
|
+
Metrics/CyclomaticComplexity:
|
15
15
|
Max: 10
|
16
16
|
|
17
|
-
# Offense count:
|
17
|
+
# Offense count: 124
|
18
18
|
# Configuration parameters: CountComments.
|
19
|
-
|
19
|
+
Metrics/MethodLength:
|
20
20
|
Max: 21
|
21
|
+
|
22
|
+
# Offense count: 22
|
23
|
+
Metrics/PerceivedComplexity:
|
24
|
+
Max: 11
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,45 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.25.0 (15/08/2014)
|
6
|
+
|
7
|
+
### New features
|
8
|
+
|
9
|
+
* [#1259](https://github.com/bbatsov/rubocop/issues/1259): Allow AndOr cop to autocorrect by adding method call parenthesis. ([@vrthra][])
|
10
|
+
* [#1232](https://github.com/bbatsov/rubocop/issues/1232): Add EnforcedStyle option to cop `AndOr` to restrict it to conditionals. ([@vrthra][])
|
11
|
+
* [#835](https://github.com/bbatsov/rubocop/issues/835): New cop `PercentQLiterals` checks if use of `%Q` and `%q` matches configuration. ([@jonas054][])
|
12
|
+
* [#835](https://github.com/bbatsov/rubocop/issues/835): New cop `BarePercentLiterals` checks if usage of `%()` or `%Q()` matches configuration. ([@jonas054][])
|
13
|
+
* [#1079](https://github.com/bbatsov/rubocop/pull/1079): New cop `MultilineBlockLayout` checks if a multiline block has an extpression on the same line as the start of the block. ([@barunio][])
|
14
|
+
* [#1217](https://github.com/bbatsov/rubocop/pull/1217): `Style::EmptyLinesAroundAccessModifier` cop does auto-correction. ([@tamird][])
|
15
|
+
* [#1220](https://github.com/bbatsov/rubocop/issues/1220): New cop `PerceivedComplexity` is similar to `CyclomaticComplexity`, but reports when methods have a high complexity for a human reader. ([@jonas054][])
|
16
|
+
* `Debugger` cop now checks for `binding.pry_remote`. ([@yous][])
|
17
|
+
* [#1238](https://github.com/bbatsov/rubocop/issues/1238): Add `MinBodyLength` option to `Next` cop. ([@bbatsov][])
|
18
|
+
* [#1241](https://github.com/bbatsov/rubocop/issues/1241): `TrailingComma` cop does auto-correction. ([@yous][])
|
19
|
+
* [#1078](https://github.com/bbatsov/rubocop/pull/1078): New cop `BlockEndNewline` checks if the end statement of a multiline block is on its own line. ([@barunio][])
|
20
|
+
* [#1078](https://github.com/bbatsov/rubocop/pull/1078): `BlockAlignment` cop does auto-correction. ([@barunio][])
|
21
|
+
|
22
|
+
### Changes
|
23
|
+
|
24
|
+
* [#1220](https://github.com/bbatsov/rubocop/issues/1220): New namespace `Metrics` created and some `Style` cops moved there. ([@jonas054][])
|
25
|
+
* Drop support for Ruby 1.9.2 in accordance with [the end of the security maintenance extension](https://www.ruby-lang.org/en/news/2014/07/01/eol-for-1-8-7-and-1-9-2/). ([@yujinakayama][])
|
26
|
+
|
27
|
+
### Bugs fixed
|
28
|
+
|
29
|
+
* [#1251](https://github.com/bbatsov/rubocop/issues/1251): Fix `PercentLiteralDelimiters` auto-correct indentation error. ([@hannestyden][])
|
30
|
+
* [#1197](https://github.com/bbatsov/rubocop/issues/1197): Fix false positive for new lambda syntax in `SpaceInsideBlockBraces`. ([@jonas054][])
|
31
|
+
* [#1201](https://github.com/bbatsov/rubocop/issues/1201): Fix error at anonymous keyword splat arguments in some variable cops. ([@yujinakayama][])
|
32
|
+
* Fix false positive in `UnneededPercentQ` for `/%Q(something)/`. ([@jonas054][])
|
33
|
+
* Fix `SpacesInsideBrackets` for `Hash#[]` calls with spaces after left bracket. ([@mcls][])
|
34
|
+
* [#1210](https://github.com/bbatsov/rubocop/issues/1210): Fix false positive in `UnneededPercentQ` for `%Q(\t")`. ([@jonas054][])
|
35
|
+
* Fix false positive in `UnneededPercentQ` for heredoc strings with `%q`/`%Q`. ([@jonas054][])
|
36
|
+
* [#1214](https://github.com/bbatsov/rubocop/issues/1214): Don't destroy code in `AlignHash` autocorrect. ([@jonas054][])
|
37
|
+
* [#1219](https://github.com/bbatsov/rubocop/issues/1219): Don't report bad alignment for `end` or `}` in `BlockAlignment` if it doesn't begin its line. ([@jonas054][])
|
38
|
+
* [#1227](https://github.com/bbatsov/rubocop/issues/1227): Don't permanently change yamler as it can affect other apps. ([@jonas054][])
|
39
|
+
* [#1184](https://github.com/bbatsov/rubocop/issues/1184): Fix a false positive in `Output` cop. ([@bbatsov][])
|
40
|
+
* [#1256](https://github.com/bbatsov/rubocop/issues/1256): Ignore block-pass in `TrailingComma`. ([@tamird][])
|
41
|
+
* [#1255](https://github.com/bbatsov/rubocop/issues/1255): Compare without context in `AutocorrectUnlessChangingAST`. ([@jonas054][])
|
42
|
+
* [#1262](https://github.com/bbatsov/rubocop/issues/1262): Handle regexp and backtick literals in `VariableInterpolation`. ([@bbatsov][])
|
43
|
+
|
5
44
|
## 0.24.1 (03/07/2014)
|
6
45
|
|
7
46
|
### Bugs fixed
|
@@ -1014,3 +1053,6 @@
|
|
1014
1053
|
[@ggilder]: https://github.com/ggilder
|
1015
1054
|
[@salbertson]: https://github.com/salbertson
|
1016
1055
|
[@camilleldn]: https://github.com/camilleldn
|
1056
|
+
[@mcls]: https://github.com/mcls
|
1057
|
+
[@yous]: https://github.com/yous
|
1058
|
+
[@vrthra]: https://github.com/vrthra
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,11 +20,18 @@ Most aspects of its behavior can be tweaked via various
|
|
20
20
|
Apart from reporting problems in your code, RuboCop can also
|
21
21
|
automatically fix some of the problems for you.
|
22
22
|
|
23
|
+
**This documentation tracks the `master` branch of RuboCop. Some of
|
24
|
+
the features and settings discussed here might not be available in
|
25
|
+
older releases (including the current stable release). Please, consult
|
26
|
+
the relevant git repo branch if you need documentation for a specific RuboCop
|
27
|
+
release.**
|
28
|
+
|
23
29
|
- [Installation](#installation)
|
24
30
|
- [Basic Usage](#basic-usage)
|
25
31
|
- [Cops](#cops)
|
26
32
|
- [Style](#style)
|
27
33
|
- [Lint](#lint)
|
34
|
+
- [Metrics](#metrics)
|
28
35
|
- [Rails](#rails)
|
29
36
|
- [Configuration](#configuration)
|
30
37
|
- [Inheritance](#inheritance)
|
@@ -178,6 +185,14 @@ enabled lint cops plus a selection of other cops.
|
|
178
185
|
|
179
186
|
Disabling any of the lint cops is generally a bad idea.
|
180
187
|
|
188
|
+
#### Metrics
|
189
|
+
|
190
|
+
Metrics cops deal with properties of the source code that can be measured,
|
191
|
+
such as class length, method length, etc. Generally speaking, they have a
|
192
|
+
configuration parameter called `Max` and when running
|
193
|
+
`rubocop --auto-gen-config`, this parameter will be set to the highest value
|
194
|
+
found for the inspected code.
|
195
|
+
|
181
196
|
#### Rails
|
182
197
|
|
183
198
|
Rails cops are specific to the Ruby on Rails framework. Unlike style
|
@@ -188,6 +203,13 @@ specifically:
|
|
188
203
|
$ rubocop -R
|
189
204
|
```
|
190
205
|
|
206
|
+
or add the following directive to your `.rubocop.yml`:
|
207
|
+
|
208
|
+
```yaml
|
209
|
+
AllCops:
|
210
|
+
RunRailsCops: true
|
211
|
+
```
|
212
|
+
|
191
213
|
## Configuration
|
192
214
|
|
193
215
|
The behavior of RuboCop can be controlled via the
|
@@ -207,7 +229,7 @@ inherit_from: ../.rubocop.yml
|
|
207
229
|
Style/Encoding:
|
208
230
|
Enabled: false
|
209
231
|
|
210
|
-
|
232
|
+
Metrics/LineLength:
|
211
233
|
Max: 99
|
212
234
|
```
|
213
235
|
|
@@ -311,7 +333,7 @@ Rails/DefaultScope:
|
|
311
333
|
Specific cops can be disabled by setting `Enabled` to `false` for that specific cop.
|
312
334
|
|
313
335
|
```yaml
|
314
|
-
|
336
|
+
Metrics/LineLength:
|
315
337
|
Enabled: false
|
316
338
|
```
|
317
339
|
|
@@ -319,7 +341,7 @@ Cops can customize their severity level. All cops support the `Severity` param.
|
|
319
341
|
Allowed params are `refactor`, `convention`, `warning`, `error` and `fatal`.
|
320
342
|
|
321
343
|
```yaml
|
322
|
-
|
344
|
+
Metrics/CyclomaticComplexity:
|
323
345
|
Severity: warning
|
324
346
|
```
|
325
347
|
|
@@ -339,9 +361,9 @@ One or more individual cops can be disabled locally in a section of a
|
|
339
361
|
file by adding a comment such as
|
340
362
|
|
341
363
|
```ruby
|
342
|
-
# rubocop:disable
|
364
|
+
# rubocop:disable Metrics/LineLength, Style/StringLiterals
|
343
365
|
[...]
|
344
|
-
# rubocop:enable
|
366
|
+
# rubocop:enable Metrics/LineLength, Style/StringLiterals
|
345
367
|
```
|
346
368
|
|
347
369
|
You can also disable *all* cops with
|
@@ -583,7 +605,6 @@ $ rubocop --format offenses
|
|
583
605
|
|
584
606
|
RuboCop supports the following Ruby implementations:
|
585
607
|
|
586
|
-
* MRI 1.9.2 ([until June 2014](https://www.ruby-lang.org/en/news/2013/12/17/maintenance-of-1-8-7-and-1-9-2/))
|
587
608
|
* MRI 1.9.3
|
588
609
|
* MRI 2.0
|
589
610
|
* MRI 2.1
|
data/bin/rubocop
CHANGED
@@ -1,22 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
4
|
+
$LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
require 'rubocop'
|
7
|
+
require 'benchmark'
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
cli = RuboCop::CLI.new
|
10
|
+
result = 0
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
puts "Finished in #{time} seconds" if cli.options[:debug]
|
18
|
-
exit result
|
19
|
-
else
|
20
|
-
puts 'RuboCop supports only Ruby 1.9.2+'
|
21
|
-
exit(-1)
|
12
|
+
time = Benchmark.realtime do
|
13
|
+
result = cli.run
|
22
14
|
end
|
15
|
+
|
16
|
+
puts "Finished in #{time} seconds" if cli.options[:debug]
|
17
|
+
exit result
|
data/config/default.yml
CHANGED
@@ -10,7 +10,16 @@ AllCops:
|
|
10
10
|
# Include gemspec and Rakefile
|
11
11
|
Include:
|
12
12
|
- '**/*.gemspec'
|
13
|
+
- '**/*.podspec'
|
14
|
+
- '**/*.jbuilder'
|
15
|
+
- '**/*.rake'
|
16
|
+
- '**/Gemfile'
|
13
17
|
- '**/Rakefile'
|
18
|
+
- '**/Capfile'
|
19
|
+
- '**/Guardfile'
|
20
|
+
- '**/Podfile'
|
21
|
+
- '**/Thorfile'
|
22
|
+
- '**/Vagrantfile'
|
14
23
|
Exclude:
|
15
24
|
- 'vendor/**/*'
|
16
25
|
# By default, the rails cops are not run. Override in project or home
|
@@ -107,8 +116,21 @@ Style/AlignParameters:
|
|
107
116
|
- with_first_parameter
|
108
117
|
- with_fixed_indentation
|
109
118
|
|
110
|
-
Style/
|
111
|
-
|
119
|
+
Style/AndOr:
|
120
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
121
|
+
# or completely (always).
|
122
|
+
EnforcedStyle: always
|
123
|
+
SupportedStyles:
|
124
|
+
- always
|
125
|
+
- conditionals
|
126
|
+
|
127
|
+
|
128
|
+
# Checks if usage of %() or %Q() matches configuration.
|
129
|
+
Style/BarePercentLiterals:
|
130
|
+
EnforcedStyle: bare_percent
|
131
|
+
SupportedStyles:
|
132
|
+
- percent_q
|
133
|
+
- bare_percent
|
112
134
|
|
113
135
|
Style/BracesAroundHashParameters:
|
114
136
|
EnforcedStyle: no_braces
|
@@ -150,10 +172,6 @@ Style/ClassCheck:
|
|
150
172
|
SupportedStyles:
|
151
173
|
- is_a?
|
152
174
|
- kind_of?
|
153
|
-
|
154
|
-
Style/ClassLength:
|
155
|
-
CountComments: false # count full line comments?
|
156
|
-
Max: 100
|
157
175
|
|
158
176
|
# Align with the style guide.
|
159
177
|
Style/CollectionMethods:
|
@@ -179,10 +197,6 @@ Style/CommentAnnotation:
|
|
179
197
|
- HACK
|
180
198
|
- REVIEW
|
181
199
|
|
182
|
-
# Avoid complex methods.
|
183
|
-
Style/CyclomaticComplexity:
|
184
|
-
Max: 6
|
185
|
-
|
186
200
|
# Multi-line method chaining should be done with leading dots.
|
187
201
|
Style/DotPosition:
|
188
202
|
EnforcedStyle: leading
|
@@ -208,6 +222,9 @@ Style/FileName:
|
|
208
222
|
- '**/Rakefile'
|
209
223
|
- '**/Gemfile'
|
210
224
|
- '**/Capfile'
|
225
|
+
- '**/Vagrantfile'
|
226
|
+
- '**/Podfile'
|
227
|
+
- '**/Thorfile'
|
211
228
|
|
212
229
|
# Checks use of for or each in multiline loops.
|
213
230
|
Style/For:
|
@@ -262,15 +279,14 @@ Style/LambdaCall:
|
|
262
279
|
- call
|
263
280
|
- braces
|
264
281
|
|
265
|
-
Style/LineLength:
|
266
|
-
Max: 80
|
267
|
-
AllowURI: true
|
268
|
-
|
269
282
|
Style/Next:
|
270
283
|
# With `always` all conditions at the end of an iteration needs to be
|
271
|
-
#
|
284
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
272
285
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
273
286
|
EnforcedStyle: skip_modifier_ifs
|
287
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
288
|
+
# needs to have to trigger this cop
|
289
|
+
MinBodyLength: 3
|
274
290
|
SupportedStyles:
|
275
291
|
- skip_modifier_ifs
|
276
292
|
- always
|
@@ -290,10 +306,6 @@ Style/MethodDefParentheses:
|
|
290
306
|
- require_parentheses
|
291
307
|
- require_no_parentheses
|
292
308
|
|
293
|
-
Style/MethodLength:
|
294
|
-
CountComments: false # count full line comments?
|
295
|
-
Max: 10
|
296
|
-
|
297
309
|
Style/MethodName:
|
298
310
|
EnforcedStyle: snake_case
|
299
311
|
SupportedStyles:
|
@@ -303,10 +315,6 @@ Style/MethodName:
|
|
303
315
|
Style/NumericLiterals:
|
304
316
|
MinDigits: 5
|
305
317
|
|
306
|
-
Style/ParameterLists:
|
307
|
-
Max: 5
|
308
|
-
CountKeywordArgs: true
|
309
|
-
|
310
318
|
# Allow safe assignment in conditions.
|
311
319
|
Style/ParenthesesAroundCondition:
|
312
320
|
AllowSafeAssignment: true
|
@@ -323,6 +331,12 @@ Style/PercentLiteralDelimiters:
|
|
323
331
|
'%W': ()
|
324
332
|
'%x': ()
|
325
333
|
|
334
|
+
Style/PercentQLiterals:
|
335
|
+
EnforcedStyle: lower_case_q
|
336
|
+
SupportedStyles:
|
337
|
+
- lower_case_q # Use %q when possible, %Q when necessary
|
338
|
+
- upper_case_q # Always use %Q
|
339
|
+
|
326
340
|
Style/PredicateName:
|
327
341
|
NamePrefixBlacklist:
|
328
342
|
- is_
|
@@ -335,7 +349,6 @@ Style/RaiseArgs:
|
|
335
349
|
- compact # raise Exception.new(msg)
|
336
350
|
- exploded # raise Exception, msg
|
337
351
|
|
338
|
-
|
339
352
|
Style/RedundantReturn:
|
340
353
|
# When true allows code like `return x, y`.
|
341
354
|
AllowMultipleReturnValues: false
|
@@ -356,7 +369,6 @@ Style/SignalException:
|
|
356
369
|
- only_fail
|
357
370
|
- semantic
|
358
371
|
|
359
|
-
|
360
372
|
Style/SingleLineBlockParams:
|
361
373
|
Methods:
|
362
374
|
- reduce:
|
@@ -463,6 +475,34 @@ Style/WhileUntilModifier:
|
|
463
475
|
Style/WordArray:
|
464
476
|
MinSize: 0
|
465
477
|
|
478
|
+
##################### Metrics ##################################
|
479
|
+
|
480
|
+
Metrics/BlockNesting:
|
481
|
+
Max: 3
|
482
|
+
|
483
|
+
Metrics/ClassLength:
|
484
|
+
CountComments: false # count full line comments?
|
485
|
+
Max: 100
|
486
|
+
|
487
|
+
# Avoid complex methods.
|
488
|
+
Metrics/CyclomaticComplexity:
|
489
|
+
Max: 6
|
490
|
+
|
491
|
+
Metrics/LineLength:
|
492
|
+
Max: 80
|
493
|
+
AllowURI: true
|
494
|
+
|
495
|
+
Metrics/MethodLength:
|
496
|
+
CountComments: false # count full line comments?
|
497
|
+
Max: 10
|
498
|
+
|
499
|
+
Metrics/ParameterLists:
|
500
|
+
Max: 5
|
501
|
+
CountKeywordArgs: true
|
502
|
+
|
503
|
+
Metrics/PerceivedComplexity:
|
504
|
+
Max: 7
|
505
|
+
|
466
506
|
##################### Lint ##################################
|
467
507
|
|
468
508
|
# Allow safe assignment in conditions.
|
@@ -509,6 +549,13 @@ Rails/HasAndBelongsToMany:
|
|
509
549
|
Include:
|
510
550
|
- app/models/**/*.rb
|
511
551
|
|
552
|
+
Rails/Output:
|
553
|
+
Include:
|
554
|
+
- app/**/*.rb
|
555
|
+
- config/**/*.rb
|
556
|
+
- db/**/*.rb
|
557
|
+
- lib/**/*.rb
|
558
|
+
|
512
559
|
Rails/ReadWriteAttribute:
|
513
560
|
Include:
|
514
561
|
- app/models/**/*.rb
|
data/config/enabled.yml
CHANGED
@@ -54,12 +54,16 @@ Style/BeginBlock:
|
|
54
54
|
Description: 'Avoid the use of BEGIN blocks.'
|
55
55
|
Enabled: true
|
56
56
|
|
57
|
+
Style/BarePercentLiterals:
|
58
|
+
Description: 'Checks if usage of %() or %Q() matches configuration.'
|
59
|
+
Enabled: true
|
60
|
+
|
57
61
|
Style/BlockComments:
|
58
62
|
Description: 'Do not use block comments.'
|
59
63
|
Enabled: true
|
60
64
|
|
61
|
-
Style/
|
62
|
-
Description: '
|
65
|
+
Style/BlockEndNewline:
|
66
|
+
Description: 'Put end statement of multiline block on its own line.'
|
63
67
|
Enabled: true
|
64
68
|
|
65
69
|
Style/Blocks:
|
@@ -97,10 +101,6 @@ Style/ClassCheck:
|
|
97
101
|
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
98
102
|
Enabled: true
|
99
103
|
|
100
|
-
Style/ClassLength:
|
101
|
-
Description: 'Avoid classes longer than 100 lines of code.'
|
102
|
-
Enabled: true
|
103
|
-
|
104
104
|
Style/ClassMethods:
|
105
105
|
Description: 'Use self when defining module/class methods.'
|
106
106
|
Enabled: true
|
@@ -131,10 +131,6 @@ Style/ConstantName:
|
|
131
131
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
132
132
|
Enabled: true
|
133
133
|
|
134
|
-
Style/CyclomaticComplexity:
|
135
|
-
Description: 'Avoid complex methods.'
|
136
|
-
Enabled: true
|
137
|
-
|
138
134
|
Style/DefWithParentheses:
|
139
135
|
Description: 'Use def with parentheses when there are arguments.'
|
140
136
|
Enabled: true
|
@@ -271,10 +267,6 @@ Style/LineEndConcatenation:
|
|
271
267
|
line end.
|
272
268
|
Enabled: true
|
273
269
|
|
274
|
-
Style/LineLength:
|
275
|
-
Description: 'Limit lines to 80 characters.'
|
276
|
-
Enabled: true
|
277
|
-
|
278
270
|
Style/MethodCallParentheses:
|
279
271
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
280
272
|
Enabled: true
|
@@ -285,10 +277,6 @@ Style/MethodDefParentheses:
|
|
285
277
|
parentheses.
|
286
278
|
Enabled: true
|
287
279
|
|
288
|
-
Style/MethodLength:
|
289
|
-
Description: 'Avoid methods longer than 10 lines of code.'
|
290
|
-
Enabled: true
|
291
|
-
|
292
280
|
Style/MethodName:
|
293
281
|
Description: 'Use the configured style when naming methods.'
|
294
282
|
Enabled: true
|
@@ -301,6 +289,10 @@ Style/MultilineBlockChain:
|
|
301
289
|
Description: 'Avoid multi-line chains of blocks.'
|
302
290
|
Enabled: true
|
303
291
|
|
292
|
+
Style/MultilineBlockLayout:
|
293
|
+
Description: 'Ensures newlines after multiline block do statements.'
|
294
|
+
Enabled: true
|
295
|
+
|
304
296
|
Style/MultilineIfThen:
|
305
297
|
Description: 'Never use then for multi-line if/unless.'
|
306
298
|
Enabled: true
|
@@ -357,10 +349,6 @@ Style/OpMethod:
|
|
357
349
|
Description: 'When defining binary operators, name the argument other.'
|
358
350
|
Enabled: true
|
359
351
|
|
360
|
-
Style/ParameterLists:
|
361
|
-
Description: 'Avoid parameter lists longer than three or four parameters.'
|
362
|
-
Enabled: true
|
363
|
-
|
364
352
|
Style/ParenthesesAroundCondition:
|
365
353
|
Description: >-
|
366
354
|
Don't use parentheses around the condition of an
|
@@ -371,6 +359,10 @@ Style/PercentLiteralDelimiters:
|
|
371
359
|
Description: 'Use `%`-literal delimiters consistently'
|
372
360
|
Enabled: true
|
373
361
|
|
362
|
+
Style/PercentQLiterals:
|
363
|
+
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
364
|
+
Enabled: true
|
365
|
+
|
374
366
|
Style/PerlBackrefs:
|
375
367
|
Description: 'Avoid Perl-style regex back references.'
|
376
368
|
Enabled: true
|
@@ -416,7 +408,9 @@ Style/RescueModifier:
|
|
416
408
|
Enabled: true
|
417
409
|
|
418
410
|
Style/SelfAssignment:
|
419
|
-
Description:
|
411
|
+
Description: >-
|
412
|
+
Checks for places where self-assignment shorthand should have
|
413
|
+
been used.
|
420
414
|
Enabled: true
|
421
415
|
|
422
416
|
Style/Semicolon:
|
@@ -595,6 +589,40 @@ Style/WordArray:
|
|
595
589
|
Description: 'Use %w or %W for arrays of words.'
|
596
590
|
Enabled: true
|
597
591
|
|
592
|
+
#################### Metrics ################################
|
593
|
+
|
594
|
+
Metrics/BlockNesting:
|
595
|
+
Description: 'Avoid excessive block nesting'
|
596
|
+
Enabled: true
|
597
|
+
|
598
|
+
Metrics/ClassLength:
|
599
|
+
Description: 'Avoid classes longer than 100 lines of code.'
|
600
|
+
Enabled: true
|
601
|
+
|
602
|
+
Metrics/CyclomaticComplexity:
|
603
|
+
Description: >-
|
604
|
+
A complexity metric that is strongy correlated to the number
|
605
|
+
of test cases needed to validate a method.
|
606
|
+
Enabled: true
|
607
|
+
|
608
|
+
Metrics/LineLength:
|
609
|
+
Description: 'Limit lines to 80 characters.'
|
610
|
+
Enabled: true
|
611
|
+
|
612
|
+
Metrics/MethodLength:
|
613
|
+
Description: 'Avoid methods longer than 10 lines of code.'
|
614
|
+
Enabled: true
|
615
|
+
|
616
|
+
Metrics/ParameterLists:
|
617
|
+
Description: 'Avoid parameter lists longer than three or four parameters.'
|
618
|
+
Enabled: true
|
619
|
+
|
620
|
+
Metrics/PerceivedComplexity:
|
621
|
+
Description: >-
|
622
|
+
A complexity metric geared towards measuring complexity for a
|
623
|
+
human reader.
|
624
|
+
Enabled: true
|
625
|
+
|
598
626
|
#################### Lint ################################
|
599
627
|
### Warnings
|
600
628
|
|
@@ -619,7 +647,9 @@ Lint/BlockAlignment:
|
|
619
647
|
Enabled: true
|
620
648
|
|
621
649
|
Lint/ConditionPosition:
|
622
|
-
Description:
|
650
|
+
Description: >-
|
651
|
+
Checks for condition placed in a confusing position relative to
|
652
|
+
the keyword.
|
623
653
|
Enabled: true
|
624
654
|
|
625
655
|
Lint/Debugger:
|
@@ -781,7 +811,9 @@ Rails/Output:
|
|
781
811
|
Enabled: true
|
782
812
|
|
783
813
|
Rails/ReadWriteAttribute:
|
784
|
-
Description:
|
814
|
+
Description: >-
|
815
|
+
Checks for read_attribute(:attr) and
|
816
|
+
write_attribute(:attr, val).
|
785
817
|
Enabled: true
|
786
818
|
|
787
819
|
Rails/ScopeArgs:
|