rubocop 0.46.0 → 0.47.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/LICENSE.txt +1 -1
- data/README.md +77 -2
- data/config/default.yml +151 -74
- data/config/disabled.yml +9 -0
- data/config/enabled.yml +49 -9
- data/lib/rubocop.rb +36 -8
- data/lib/rubocop/ast/builder.rb +59 -0
- data/lib/rubocop/ast/node.rb +607 -0
- data/lib/rubocop/ast/node/array_node.rb +45 -0
- data/lib/rubocop/ast/node/case_node.rb +63 -0
- data/lib/rubocop/ast/node/for_node.rb +53 -0
- data/lib/rubocop/ast/node/hash_node.rb +102 -0
- data/lib/rubocop/ast/node/if_node.rb +136 -0
- data/lib/rubocop/ast/node/keyword_splat_node.rb +45 -0
- data/lib/rubocop/ast/node/mixin/conditional_node.rb +45 -0
- data/lib/rubocop/ast/node/mixin/hash_element_node.rb +125 -0
- data/lib/rubocop/ast/node/mixin/modifier_node.rb +17 -0
- data/lib/rubocop/ast/node/pair_node.rb +64 -0
- data/lib/rubocop/ast/node/until_node.rb +43 -0
- data/lib/rubocop/ast/node/when_node.rb +61 -0
- data/lib/rubocop/ast/node/while_node.rb +43 -0
- data/lib/rubocop/ast/sexp.rb +16 -0
- data/lib/rubocop/{ast_node → ast}/traversal.rb +1 -1
- data/lib/rubocop/cli.rb +18 -14
- data/lib/rubocop/comment_config.rb +1 -3
- data/lib/rubocop/config.rb +93 -35
- data/lib/rubocop/config_loader.rb +1 -1
- data/lib/rubocop/cop/badge.rb +73 -0
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -2
- data/lib/rubocop/cop/bundler/ordered_gems.rb +43 -3
- data/lib/rubocop/cop/commissioner.rb +17 -6
- data/lib/rubocop/cop/cop.rb +25 -112
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +9 -4
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +7 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +18 -4
- data/lib/rubocop/cop/lint/block_alignment.rb +40 -9
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +14 -0
- data/lib/rubocop/cop/lint/condition_position.rb +14 -16
- data/lib/rubocop/cop/lint/debugger.rb +28 -0
- data/lib/rubocop/cop/lint/def_end_alignment.rb +21 -1
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +13 -1
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +26 -22
- data/lib/rubocop/cop/lint/duplicate_methods.rb +15 -1
- data/lib/rubocop/cop/lint/duplicated_key.rb +16 -8
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +9 -0
- data/lib/rubocop/cop/lint/else_layout.rb +26 -29
- data/lib/rubocop/cop/lint/empty_ensure.rb +38 -0
- data/lib/rubocop/cop/lint/empty_expression.rb +11 -1
- data/lib/rubocop/cop/lint/empty_interpolation.rb +8 -0
- data/lib/rubocop/cop/lint/empty_when.rb +14 -16
- data/lib/rubocop/cop/lint/end_alignment.rb +48 -28
- data/lib/rubocop/cop/lint/end_in_method.rb +23 -0
- data/lib/rubocop/cop/lint/ensure_return.rb +21 -0
- data/lib/rubocop/cop/lint/float_out_of_range.rb +5 -0
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +29 -4
- data/lib/rubocop/cop/lint/handle_exceptions.rb +40 -0
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +7 -2
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +11 -2
- data/lib/rubocop/cop/lint/invalid_character_literal.rb +3 -0
- data/lib/rubocop/cop/lint/literal_in_condition.rb +34 -36
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +8 -0
- data/lib/rubocop/cop/lint/loop.rb +36 -0
- data/lib/rubocop/cop/lint/multiple_compare.rb +46 -0
- data/lib/rubocop/cop/lint/nested_method_definition.rb +22 -0
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +5 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +8 -0
- data/lib/rubocop/cop/lint/percent_string_array.rb +27 -13
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +14 -4
- data/lib/rubocop/cop/lint/rand_one.rb +7 -3
- data/lib/rubocop/cop/lint/require_parentheses.rb +20 -19
- data/lib/rubocop/cop/lint/rescue_exception.rb +20 -0
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +66 -0
- data/lib/rubocop/cop/lint/shadowed_exception.rb +6 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +24 -0
- data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +8 -0
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +24 -0
- data/lib/rubocop/cop/lint/unified_integer.rb +5 -0
- data/lib/rubocop/cop/lint/unneeded_disable.rb +2 -2
- data/lib/rubocop/cop/lint/unneeded_splat_expansion.rb +5 -0
- data/lib/rubocop/cop/lint/unreachable_code.rb +17 -0
- data/lib/rubocop/cop/lint/unused_block_argument.rb +2 -0
- data/lib/rubocop/cop/lint/unused_method_argument.rb +10 -0
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +28 -1
- data/lib/rubocop/cop/lint/useless_assignment.rb +18 -0
- data/lib/rubocop/cop/lint/useless_comparison.rb +3 -1
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +16 -1
- data/lib/rubocop/cop/lint/useless_setter_call.rb +16 -4
- data/lib/rubocop/cop/lint/void.rb +52 -0
- data/lib/rubocop/cop/message_annotator.rb +102 -0
- data/lib/rubocop/cop/metrics/block_length.rb +6 -0
- data/lib/rubocop/cop/metrics/block_nesting.rb +17 -5
- data/lib/rubocop/cop/metrics/line_length.rb +11 -4
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -2
- data/lib/rubocop/cop/mixin/array_syntax.rb +2 -11
- data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +12 -5
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +48 -0
- data/lib/rubocop/cop/mixin/configurable_max.rb +3 -3
- data/lib/rubocop/cop/mixin/configurable_naming.rb +5 -33
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +6 -47
- data/lib/rubocop/cop/mixin/documentation_comment.rb +7 -1
- data/lib/rubocop/cop/mixin/duplication.rb +46 -0
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +2 -2
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +14 -11
- data/lib/rubocop/cop/mixin/hash_alignment.rb +114 -0
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +3 -3
- data/lib/rubocop/cop/mixin/negative_conditional.rb +21 -7
- data/lib/rubocop/cop/mixin/on_method_def.rb +14 -0
- data/lib/rubocop/cop/mixin/on_normal_if_unless.rb +1 -24
- data/lib/rubocop/cop/mixin/statement_modifier.rb +8 -13
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +16 -0
- data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -3
- data/lib/rubocop/cop/offense.rb +1 -1
- data/lib/rubocop/cop/performance/case_when_splat.rb +56 -59
- data/lib/rubocop/cop/performance/detect.rb +2 -2
- data/lib/rubocop/cop/performance/flat_map.rb +3 -3
- data/lib/rubocop/cop/performance/redundant_merge.rb +3 -6
- data/lib/rubocop/cop/performance/regexp_match.rb +201 -0
- data/lib/rubocop/cop/rails/delegate.rb +2 -2
- data/lib/rubocop/cop/rails/delegate_allow_blank.rb +10 -19
- data/lib/rubocop/cop/rails/enum_uniqueness.rb +12 -40
- data/lib/rubocop/cop/rails/file_path.rb +80 -0
- data/lib/rubocop/cop/rails/find_each.rb +5 -14
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +30 -24
- data/lib/rubocop/cop/rails/not_null_column.rb +23 -0
- data/lib/rubocop/cop/rails/reversible_migration.rb +217 -0
- data/lib/rubocop/cop/rails/safe_navigation.rb +4 -2
- data/lib/rubocop/cop/rails/skips_model_validations.rb +46 -0
- data/lib/rubocop/cop/rails/time_zone.rb +1 -1
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +7 -5
- data/lib/rubocop/cop/registry.rb +170 -0
- data/lib/rubocop/cop/{lint → security}/eval.rb +7 -1
- data/lib/rubocop/cop/security/marshal_load.rb +33 -0
- data/lib/rubocop/cop/security/yaml_load.rb +37 -0
- data/lib/rubocop/cop/style/align_hash.rb +138 -169
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +10 -15
- data/lib/rubocop/cop/style/case_indentation.rb +36 -27
- data/lib/rubocop/cop/style/conditional_assignment.rb +64 -47
- data/lib/rubocop/cop/style/each_with_object.rb +4 -1
- data/lib/rubocop/cop/style/else_alignment.rb +14 -20
- data/lib/rubocop/cop/style/empty_case_condition.rb +16 -25
- data/lib/rubocop/cop/style/empty_else.rb +20 -22
- data/lib/rubocop/cop/style/empty_literal.rb +4 -4
- data/lib/rubocop/cop/style/empty_method.rb +12 -6
- data/lib/rubocop/cop/style/encoding.rb +1 -1
- data/lib/rubocop/cop/style/file_name.rb +24 -4
- data/lib/rubocop/cop/style/first_method_argument_line_break.rb +1 -1
- data/lib/rubocop/cop/style/format_string.rb +17 -48
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +40 -11
- data/lib/rubocop/cop/style/guard_clause.rb +11 -17
- data/lib/rubocop/cop/style/hash_syntax.rb +24 -42
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +40 -28
- data/lib/rubocop/cop/style/if_inside_else.rb +6 -9
- data/lib/rubocop/cop/style/if_unless_modifier.rb +16 -25
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +3 -9
- data/lib/rubocop/cop/style/indent_array.rb +1 -1
- data/lib/rubocop/cop/style/indentation_width.rb +29 -60
- data/lib/rubocop/cop/style/infinite_loop.rb +21 -22
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +86 -0
- data/lib/rubocop/cop/style/{method_call_parentheses.rb → method_call_without_args_parentheses.rb} +8 -1
- data/lib/rubocop/cop/style/missing_else.rb +40 -14
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +5 -15
- data/lib/rubocop/cop/style/multiline_if_then.rb +14 -8
- data/lib/rubocop/cop/style/multiline_method_call_indentation.rb +3 -3
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -5
- data/lib/rubocop/cop/style/mutable_constant.rb +3 -2
- data/lib/rubocop/cop/style/negated_if.rb +3 -19
- data/lib/rubocop/cop/style/negated_while.rb +2 -17
- data/lib/rubocop/cop/style/nested_modifier.rb +16 -43
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +3 -5
- data/lib/rubocop/cop/style/next.rb +23 -21
- data/lib/rubocop/cop/style/non_nil_check.rb +2 -3
- data/lib/rubocop/cop/style/not.rb +1 -3
- data/lib/rubocop/cop/style/numeric_literals.rb +2 -2
- data/lib/rubocop/cop/style/one_line_conditional.rb +12 -22
- data/lib/rubocop/cop/style/option_hash.rb +4 -15
- data/lib/rubocop/cop/style/parallel_assignment.rb +1 -3
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -12
- data/lib/rubocop/cop/style/percent_q_literals.rb +15 -12
- data/lib/rubocop/cop/style/redundant_freeze.rb +3 -2
- data/lib/rubocop/cop/style/redundant_parentheses.rb +27 -4
- data/lib/rubocop/cop/style/redundant_return.rb +4 -8
- data/lib/rubocop/cop/style/safe_navigation.rb +13 -6
- data/lib/rubocop/cop/style/space_after_colon.rb +2 -4
- data/lib/rubocop/cop/style/space_around_block_parameters.rb +1 -1
- data/lib/rubocop/cop/style/space_around_operators.rb +15 -13
- data/lib/rubocop/cop/style/string_methods.rb +1 -3
- data/lib/rubocop/cop/style/symbol_array.rb +1 -5
- data/lib/rubocop/cop/style/ternary_parentheses.rb +5 -6
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +2 -5
- data/lib/rubocop/cop/style/trailing_comma_in_literal.rb +1 -1
- data/lib/rubocop/cop/style/unless_else.rb +1 -5
- data/lib/rubocop/cop/style/when_then.rb +4 -2
- data/lib/rubocop/cop/style/while_until_do.rb +9 -13
- data/lib/rubocop/cop/style/while_until_modifier.rb +12 -11
- data/lib/rubocop/cop/style/word_array.rb +5 -9
- data/lib/rubocop/cop/team.rb +16 -15
- data/lib/rubocop/cop/util.rb +13 -3
- data/lib/rubocop/formatter/clang_style_formatter.rb +2 -2
- data/lib/rubocop/formatter/disabled_config_formatter.rb +2 -1
- data/lib/rubocop/magic_comment.rb +196 -0
- data/lib/rubocop/options.rb +5 -4
- data/lib/rubocop/processed_source.rb +1 -1
- data/lib/rubocop/rspec/cop_helper.rb +9 -0
- data/lib/rubocop/rspec/shared_examples.rb +1 -1
- data/lib/rubocop/runner.rb +7 -2
- data/lib/rubocop/version.rb +1 -1
- metadata +41 -14
- data/lib/rubocop/ast_node.rb +0 -624
- data/lib/rubocop/ast_node/builder.rb +0 -30
- data/lib/rubocop/ast_node/sexp.rb +0 -13
- data/lib/rubocop/cop/mixin/hash_node.rb +0 -14
- data/lib/rubocop/cop/mixin/if_node.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cb307d9f435d9dd656afd7e19bef4f356ec3db7
|
4
|
+
data.tar.gz: 9b91ab777ecc3e2077870b733bc5198183c243fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed32a64bae1f1eb8c6bd32b1d8195e92d16ea0f3811ce677435da73a28f5843a39bc187d33e1ba1f039f62a1c523f5bde2485ed417d006883a75a6d717594e19
|
7
|
+
data.tar.gz: 1419bc1c8062afe4281d6f3580f473030cacf4728be174b235df5b2337f58613b11d65815175020adb32b2f43aa38aa6f8c82d5dff508098e320018ee7ce4cab
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
[![Code Climate](https://codeclimate.com/github/bbatsov/rubocop/badges/gpa.svg)](https://codeclimate.com/github/bbatsov/rubocop)
|
6
6
|
[![Inline docs](http://inch-ci.org/github/bbatsov/rubocop.svg)](http://inch-ci.org/github/bbatsov/rubocop)
|
7
7
|
[![Gratipay Team](https://img.shields.io/gratipay/team/rubocop.svg?maxAge=2592000)](https://gratipay.com/rubocop/)
|
8
|
+
[![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#backers)
|
9
|
+
[![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#sponsors)
|
10
|
+
|
8
11
|
|
9
12
|
<p align="center">
|
10
13
|
<img src="https://raw.githubusercontent.com/bbatsov/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
|
@@ -51,7 +54,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
51
54
|
might want to use a conservative version locking in your `Gemfile`:
|
52
55
|
|
53
56
|
```rb
|
54
|
-
gem 'rubocop', '~> 0.
|
57
|
+
gem 'rubocop', '~> 0.47.0', require: false
|
55
58
|
```
|
56
59
|
|
57
60
|
## Quickstart
|
@@ -75,6 +78,7 @@ RuboCop supports the following Ruby implementations:
|
|
75
78
|
* MRI 2.1
|
76
79
|
* MRI 2.2
|
77
80
|
* MRI 2.3
|
81
|
+
* MRI 2.4
|
78
82
|
* JRuby 9.0+
|
79
83
|
* Rubinius 2.0+
|
80
84
|
|
@@ -118,11 +122,82 @@ You can also support my work on RuboCop via
|
|
118
122
|
|
119
123
|
[![Support via Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.1.3/dist/gratipay.png)](https://gratipay.com/rubocop/)
|
120
124
|
|
125
|
+
## Open Collective Backers
|
126
|
+
|
127
|
+
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/rubocop#backer)]
|
128
|
+
|
129
|
+
<a href="https://opencollective.com/rubocop/backer/0/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/0/avatar.svg"></a>
|
130
|
+
<a href="https://opencollective.com/rubocop/backer/1/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/1/avatar.svg"></a>
|
131
|
+
<a href="https://opencollective.com/rubocop/backer/2/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/2/avatar.svg"></a>
|
132
|
+
<a href="https://opencollective.com/rubocop/backer/3/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/3/avatar.svg"></a>
|
133
|
+
<a href="https://opencollective.com/rubocop/backer/4/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/4/avatar.svg"></a>
|
134
|
+
<a href="https://opencollective.com/rubocop/backer/5/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/5/avatar.svg"></a>
|
135
|
+
<a href="https://opencollective.com/rubocop/backer/6/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/6/avatar.svg"></a>
|
136
|
+
<a href="https://opencollective.com/rubocop/backer/7/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/7/avatar.svg"></a>
|
137
|
+
<a href="https://opencollective.com/rubocop/backer/8/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/8/avatar.svg"></a>
|
138
|
+
<a href="https://opencollective.com/rubocop/backer/9/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/9/avatar.svg"></a>
|
139
|
+
<a href="https://opencollective.com/rubocop/backer/10/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/10/avatar.svg"></a>
|
140
|
+
<a href="https://opencollective.com/rubocop/backer/11/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/11/avatar.svg"></a>
|
141
|
+
<a href="https://opencollective.com/rubocop/backer/12/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/12/avatar.svg"></a>
|
142
|
+
<a href="https://opencollective.com/rubocop/backer/13/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/13/avatar.svg"></a>
|
143
|
+
<a href="https://opencollective.com/rubocop/backer/14/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/14/avatar.svg"></a>
|
144
|
+
<a href="https://opencollective.com/rubocop/backer/15/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/15/avatar.svg"></a>
|
145
|
+
<a href="https://opencollective.com/rubocop/backer/16/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/16/avatar.svg"></a>
|
146
|
+
<a href="https://opencollective.com/rubocop/backer/17/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/17/avatar.svg"></a>
|
147
|
+
<a href="https://opencollective.com/rubocop/backer/18/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/18/avatar.svg"></a>
|
148
|
+
<a href="https://opencollective.com/rubocop/backer/19/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/19/avatar.svg"></a>
|
149
|
+
<a href="https://opencollective.com/rubocop/backer/20/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/20/avatar.svg"></a>
|
150
|
+
<a href="https://opencollective.com/rubocop/backer/21/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/21/avatar.svg"></a>
|
151
|
+
<a href="https://opencollective.com/rubocop/backer/22/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/22/avatar.svg"></a>
|
152
|
+
<a href="https://opencollective.com/rubocop/backer/23/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/23/avatar.svg"></a>
|
153
|
+
<a href="https://opencollective.com/rubocop/backer/24/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/24/avatar.svg"></a>
|
154
|
+
<a href="https://opencollective.com/rubocop/backer/25/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/25/avatar.svg"></a>
|
155
|
+
<a href="https://opencollective.com/rubocop/backer/26/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/26/avatar.svg"></a>
|
156
|
+
<a href="https://opencollective.com/rubocop/backer/27/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/27/avatar.svg"></a>
|
157
|
+
<a href="https://opencollective.com/rubocop/backer/28/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/28/avatar.svg"></a>
|
158
|
+
<a href="https://opencollective.com/rubocop/backer/29/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/29/avatar.svg"></a>
|
159
|
+
|
160
|
+
|
161
|
+
## Open Collective Sponsors
|
162
|
+
|
163
|
+
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/rubocop#sponsor)]
|
164
|
+
|
165
|
+
<a href="https://opencollective.com/rubocop/sponsor/0/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/0/avatar.svg"></a>
|
166
|
+
<a href="https://opencollective.com/rubocop/sponsor/1/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/1/avatar.svg"></a>
|
167
|
+
<a href="https://opencollective.com/rubocop/sponsor/2/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/2/avatar.svg"></a>
|
168
|
+
<a href="https://opencollective.com/rubocop/sponsor/3/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/3/avatar.svg"></a>
|
169
|
+
<a href="https://opencollective.com/rubocop/sponsor/4/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/4/avatar.svg"></a>
|
170
|
+
<a href="https://opencollective.com/rubocop/sponsor/5/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/5/avatar.svg"></a>
|
171
|
+
<a href="https://opencollective.com/rubocop/sponsor/6/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/6/avatar.svg"></a>
|
172
|
+
<a href="https://opencollective.com/rubocop/sponsor/7/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/7/avatar.svg"></a>
|
173
|
+
<a href="https://opencollective.com/rubocop/sponsor/8/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/8/avatar.svg"></a>
|
174
|
+
<a href="https://opencollective.com/rubocop/sponsor/9/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/9/avatar.svg"></a>
|
175
|
+
<a href="https://opencollective.com/rubocop/sponsor/10/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/10/avatar.svg"></a>
|
176
|
+
<a href="https://opencollective.com/rubocop/sponsor/11/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/11/avatar.svg"></a>
|
177
|
+
<a href="https://opencollective.com/rubocop/sponsor/12/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/12/avatar.svg"></a>
|
178
|
+
<a href="https://opencollective.com/rubocop/sponsor/13/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/13/avatar.svg"></a>
|
179
|
+
<a href="https://opencollective.com/rubocop/sponsor/14/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/14/avatar.svg"></a>
|
180
|
+
<a href="https://opencollective.com/rubocop/sponsor/15/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/15/avatar.svg"></a>
|
181
|
+
<a href="https://opencollective.com/rubocop/sponsor/16/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/16/avatar.svg"></a>
|
182
|
+
<a href="https://opencollective.com/rubocop/sponsor/17/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/17/avatar.svg"></a>
|
183
|
+
<a href="https://opencollective.com/rubocop/sponsor/18/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/18/avatar.svg"></a>
|
184
|
+
<a href="https://opencollective.com/rubocop/sponsor/19/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/19/avatar.svg"></a>
|
185
|
+
<a href="https://opencollective.com/rubocop/sponsor/20/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/20/avatar.svg"></a>
|
186
|
+
<a href="https://opencollective.com/rubocop/sponsor/21/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/21/avatar.svg"></a>
|
187
|
+
<a href="https://opencollective.com/rubocop/sponsor/22/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/22/avatar.svg"></a>
|
188
|
+
<a href="https://opencollective.com/rubocop/sponsor/23/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/23/avatar.svg"></a>
|
189
|
+
<a href="https://opencollective.com/rubocop/sponsor/24/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/24/avatar.svg"></a>
|
190
|
+
<a href="https://opencollective.com/rubocop/sponsor/25/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/25/avatar.svg"></a>
|
191
|
+
<a href="https://opencollective.com/rubocop/sponsor/26/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/26/avatar.svg"></a>
|
192
|
+
<a href="https://opencollective.com/rubocop/sponsor/27/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/27/avatar.svg"></a>
|
193
|
+
<a href="https://opencollective.com/rubocop/sponsor/28/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/28/avatar.svg"></a>
|
194
|
+
<a href="https://opencollective.com/rubocop/sponsor/29/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/29/avatar.svg"></a>
|
195
|
+
|
121
196
|
## Changelog
|
122
197
|
|
123
198
|
RuboCop's changelog is available [here](CHANGELOG.md).
|
124
199
|
|
125
200
|
## Copyright
|
126
201
|
|
127
|
-
Copyright (c) 2012-
|
202
|
+
Copyright (c) 2012-2017 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
|
128
203
|
further details.
|
data/config/default.yml
CHANGED
@@ -29,35 +29,35 @@ AllCops:
|
|
29
29
|
- '**/*Fastfile'
|
30
30
|
Exclude:
|
31
31
|
- 'vendor/**/*'
|
32
|
-
# Default formatter will be used if no
|
32
|
+
# Default formatter will be used if no `-f/--format` option is given.
|
33
33
|
DefaultFormatter: progress
|
34
34
|
# Cop names are not displayed in offense messages by default. Change behavior
|
35
|
-
# by overriding DisplayCopNames, or by giving the
|
35
|
+
# by overriding DisplayCopNames, or by giving the `-D/--display-cop-names`
|
36
36
|
# option.
|
37
37
|
DisplayCopNames: false
|
38
38
|
# Style guide URLs are not displayed in offense messages by default. Change
|
39
|
-
# behavior by overriding DisplayStyleGuide
|
40
|
-
#
|
39
|
+
# behavior by overriding `DisplayStyleGuide`, or by giving the
|
40
|
+
# `-S/--display-style-guide` option.
|
41
41
|
DisplayStyleGuide: false
|
42
42
|
# When specifying style guide URLs, any paths and/or fragments will be
|
43
43
|
# evaluated relative to the base URL.
|
44
44
|
StyleGuideBaseURL: https://github.com/bbatsov/ruby-style-guide
|
45
45
|
# Extra details are not displayed in offense messages by default. Change
|
46
46
|
# behavior by overriding ExtraDetails, or by giving the
|
47
|
-
#
|
47
|
+
# `-E/--extra-details` option.
|
48
48
|
ExtraDetails: false
|
49
49
|
# Additional cops that do not reference a style guide rule may be enabled by
|
50
|
-
# default. Change behavior by overriding StyleGuideCopsOnly
|
51
|
-
# the
|
50
|
+
# default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
|
51
|
+
# the `--only-guide-cops` option.
|
52
52
|
StyleGuideCopsOnly: false
|
53
53
|
# All cops except the ones in disabled.yml are enabled by default. Change
|
54
|
-
# this behavior by overriding DisabledByDefault
|
55
|
-
# true
|
54
|
+
# this behavior by overriding `DisabledByDefault`. When `DisabledByDefault` is
|
55
|
+
# `true`, all cops in the default configuration are disabled, and only cops
|
56
56
|
# in user configuration are enabled. This makes cops opt-in instead of
|
57
|
-
# opt-out. Note that when DisabledByDefault is true
|
57
|
+
# opt-out. Note that when `DisabledByDefault` is `true`, cops in user
|
58
58
|
# configuration will be enabled even if they don't set the Enabled parameter.
|
59
59
|
DisabledByDefault: false
|
60
|
-
# Enables the result cache if true
|
60
|
+
# Enables the result cache if `true`. Can be overridden by the `--cache command`
|
61
61
|
# line option.
|
62
62
|
UseCache: true
|
63
63
|
# Threshold for how many files can be stored in the result cache before some
|
@@ -113,6 +113,10 @@ Style/AlignHash:
|
|
113
113
|
# 'a' => 2
|
114
114
|
# 'bb' => 3
|
115
115
|
EnforcedHashRocketStyle: key
|
116
|
+
SupportedHashRocketStyles:
|
117
|
+
- key
|
118
|
+
- separator
|
119
|
+
- table
|
116
120
|
# Alignment of entries using colon as separator. Valid values are:
|
117
121
|
#
|
118
122
|
# key - left alignment of keys
|
@@ -125,6 +129,10 @@ Style/AlignHash:
|
|
125
129
|
# a: 0
|
126
130
|
# bb: 1
|
127
131
|
EnforcedColonStyle: key
|
132
|
+
SupportedColonStyles:
|
133
|
+
- key
|
134
|
+
- separator
|
135
|
+
- table
|
128
136
|
# Select whether hashes that are the last argument in a method call should be
|
129
137
|
# inspected? Valid values are:
|
130
138
|
#
|
@@ -194,7 +202,7 @@ Style/AndOr:
|
|
194
202
|
- conditionals
|
195
203
|
|
196
204
|
|
197
|
-
# Checks if usage of
|
205
|
+
# Checks if usage of `%()` or `%Q()` matches configuration.
|
198
206
|
Style/BarePercentLiterals:
|
199
207
|
EnforcedStyle: bare_percent
|
200
208
|
SupportedStyles:
|
@@ -288,14 +296,14 @@ Style/BracesAroundHashParameters:
|
|
288
296
|
|
289
297
|
# Indentation of `when`.
|
290
298
|
Style/CaseIndentation:
|
291
|
-
|
299
|
+
EnforcedStyle: case
|
292
300
|
SupportedStyles:
|
293
301
|
- case
|
294
302
|
- end
|
295
303
|
IndentOneStep: false
|
296
|
-
# By default, the indentation width from Style/IndentationWidth is used
|
297
|
-
# But it can be overridden by setting this parameter
|
298
|
-
# This only matters if IndentOneStep is true
|
304
|
+
# By default, the indentation width from `Style/IndentationWidth` is used.
|
305
|
+
# But it can be overridden by setting this parameter.
|
306
|
+
# This only matters if `IndentOneStep` is `true`
|
299
307
|
IndentationWidth: ~
|
300
308
|
|
301
309
|
Style/ClassAndModuleChildren:
|
@@ -313,7 +321,7 @@ Style/ClassAndModuleChildren:
|
|
313
321
|
# class Foo::Bar
|
314
322
|
# end
|
315
323
|
#
|
316
|
-
# The compact style is only forced, for classes
|
324
|
+
# The compact style is only forced, for classes or modules with one child.
|
317
325
|
EnforcedStyle: nested
|
318
326
|
SupportedStyles:
|
319
327
|
- nested
|
@@ -340,17 +348,17 @@ Style/CollectionMethods:
|
|
340
348
|
detect: 'find'
|
341
349
|
find_all: 'select'
|
342
350
|
|
343
|
-
# Use ` or %x around command literals.
|
351
|
+
# Use '`' or '%x' around command literals.
|
344
352
|
Style/CommandLiteral:
|
345
353
|
EnforcedStyle: backticks
|
346
354
|
# backticks: Always use backticks.
|
347
|
-
# percent_x: Always use
|
348
|
-
# mixed: Use backticks on single-line commands, and
|
355
|
+
# percent_x: Always use `%x`.
|
356
|
+
# mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
|
349
357
|
SupportedStyles:
|
350
358
|
- backticks
|
351
359
|
- percent_x
|
352
360
|
- mixed
|
353
|
-
# If false
|
361
|
+
# If `false`, the cop will always recommend using `%x` if one or more backticks
|
354
362
|
# are found in the command string.
|
355
363
|
AllowInnerBackticks: false
|
356
364
|
|
@@ -375,14 +383,15 @@ Style/ConditionalAssignment:
|
|
375
383
|
# will only register an offense for assignment to a condition that has
|
376
384
|
# at least one multiline branch.
|
377
385
|
SingleLineConditionsOnly: true
|
386
|
+
IncludeTernaryExpressions: true
|
378
387
|
|
379
388
|
# Checks that you have put a copyright in a comment before any code.
|
380
389
|
#
|
381
390
|
# You can override the default Notice in your .rubocop.yml file.
|
382
391
|
#
|
383
392
|
# In order to use autocorrect, you must supply a value for the
|
384
|
-
# AutocorrectNotice key that matches the regexp Notice. A blank
|
385
|
-
# AutocorrectNotice will cause an error during autocorrect.
|
393
|
+
# `AutocorrectNotice` key that matches the regexp Notice. A blank
|
394
|
+
# `AutocorrectNotice` will cause an error during autocorrect.
|
386
395
|
#
|
387
396
|
# Autocorrect will add a copyright notice in a comment at the top
|
388
397
|
# of the file immediately after any shebang or encoding comments.
|
@@ -409,9 +418,9 @@ Style/DotPosition:
|
|
409
418
|
- trailing
|
410
419
|
|
411
420
|
# Warn on empty else statements
|
412
|
-
# empty - warn only on empty else
|
413
|
-
# nil - warn on else with nil in it
|
414
|
-
# both - warn on empty else and else with nil in it
|
421
|
+
# empty - warn only on empty `else`
|
422
|
+
# nil - warn on `else` with nil in it
|
423
|
+
# both - warn on empty `else` and `else` with nil in it
|
415
424
|
Style/EmptyElse:
|
416
425
|
EnforcedStyle: both
|
417
426
|
SupportedStyles:
|
@@ -421,7 +430,7 @@ Style/EmptyElse:
|
|
421
430
|
|
422
431
|
# Use empty lines between defs.
|
423
432
|
Style/EmptyLineBetweenDefs:
|
424
|
-
# If true
|
433
|
+
# If `true`, this parameter means that single line method definitions don't
|
425
434
|
# need an empty line between them.
|
426
435
|
AllowAdjacentOneLineDefs: false
|
427
436
|
|
@@ -469,19 +478,19 @@ Style/ExtraSpacing:
|
|
469
478
|
# things with the previous or next line, not counting empty lines or comment
|
470
479
|
# lines.
|
471
480
|
AllowForAlignment: true
|
472
|
-
# When true, forces the alignment of
|
481
|
+
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
473
482
|
ForceEqualSignAlignment: false
|
474
483
|
|
475
484
|
Style/FileName:
|
476
|
-
# File names listed in AllCops:Include are excluded by default. Add extra
|
485
|
+
# File names listed in `AllCops:Include` are excluded by default. Add extra
|
477
486
|
# excludes here.
|
478
487
|
Exclude: []
|
479
|
-
# When true
|
488
|
+
# When `true`, requires that each source file should define a class or module
|
480
489
|
# with a name which matches the file name (converted to ... case).
|
481
490
|
# It further expects it to be nested inside modules which match the names
|
482
491
|
# of subdirectories in its path.
|
483
492
|
ExpectMatchingDefinition: false
|
484
|
-
# If non
|
493
|
+
# If non-`nil`, expect all source file names to match the following regex.
|
485
494
|
# Only the file name itself is matched, not the entire file path.
|
486
495
|
# Use anchors as necessary if you want to match the entire name rather than
|
487
496
|
# just a part of it.
|
@@ -490,6 +499,47 @@ Style/FileName:
|
|
490
499
|
# report offending filenames for executable scripts (i.e. source
|
491
500
|
# files with a shebang in the first line).
|
492
501
|
IgnoreExecutableScripts: true
|
502
|
+
AllowedAcronyms:
|
503
|
+
- CLI
|
504
|
+
- DSL
|
505
|
+
- ACL
|
506
|
+
- API
|
507
|
+
- ASCII
|
508
|
+
- CPU
|
509
|
+
- CSS
|
510
|
+
- DNS
|
511
|
+
- EOF
|
512
|
+
- GUID
|
513
|
+
- HTML
|
514
|
+
- HTTP
|
515
|
+
- HTTPS
|
516
|
+
- ID
|
517
|
+
- IP
|
518
|
+
- JSON
|
519
|
+
- LHS
|
520
|
+
- QPS
|
521
|
+
- RAM
|
522
|
+
- RHS
|
523
|
+
- RPC
|
524
|
+
- SLA
|
525
|
+
- SMTP
|
526
|
+
- SQL
|
527
|
+
- SSH
|
528
|
+
- TCP
|
529
|
+
- TLS
|
530
|
+
- TTL
|
531
|
+
- UDP
|
532
|
+
- UI
|
533
|
+
- UID
|
534
|
+
- UUID
|
535
|
+
- URI
|
536
|
+
- URL
|
537
|
+
- UTF8
|
538
|
+
- VM
|
539
|
+
- XML
|
540
|
+
- XMPP
|
541
|
+
- XSRF
|
542
|
+
- XSS
|
493
543
|
|
494
544
|
Style/FirstParameterIndentation:
|
495
545
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
@@ -502,10 +552,10 @@ Style/FirstParameterIndentation:
|
|
502
552
|
# a parameter in a method call, then the inner parameter should be indented
|
503
553
|
# relative to the inner method.
|
504
554
|
- special_for_inner_method_call
|
505
|
-
# Same as special_for_inner_method_call except that the special rule only
|
555
|
+
# Same as `special_for_inner_method_call` except that the special rule only
|
506
556
|
# applies if the outer method call encloses its arguments in parentheses.
|
507
557
|
- special_for_inner_method_call_in_parentheses
|
508
|
-
# By default, the indentation width from Style/IndentationWidth is used
|
558
|
+
# By default, the indentation width from `Style/IndentationWidth` is used
|
509
559
|
# But it can be overridden by setting this parameter
|
510
560
|
IndentationWidth: ~
|
511
561
|
|
@@ -535,12 +585,15 @@ Style/FrozenStringLiteralComment:
|
|
535
585
|
# string literal. If you run code against multiple versions of Ruby, it is
|
536
586
|
# possible that this will create errors in Ruby 2.3.0+.
|
537
587
|
- always
|
588
|
+
# `never` will enforce that the frozen string literal comment does not
|
589
|
+
# exist in a file.
|
590
|
+
- never
|
538
591
|
|
539
592
|
# Built-in global variables are allowed by default.
|
540
593
|
Style/GlobalVars:
|
541
594
|
AllowedVariables: []
|
542
595
|
|
543
|
-
# `MinBodyLength` defines the number of lines of the a body of an if
|
596
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
544
597
|
# needs to have to trigger this cop
|
545
598
|
Style/GuardClause:
|
546
599
|
MinBodyLength: 1
|
@@ -598,13 +651,13 @@ Style/IndentArray:
|
|
598
651
|
- special_inside_parentheses
|
599
652
|
- consistent
|
600
653
|
- align_brackets
|
601
|
-
# By default, the indentation width from Style/IndentationWidth is used
|
654
|
+
# By default, the indentation width from `Style/IndentationWidth` is used
|
602
655
|
# But it can be overridden by setting this parameter
|
603
656
|
IndentationWidth: ~
|
604
657
|
|
605
658
|
# Checks the indentation of assignment RHS, when on a different line from LHS
|
606
659
|
Style/IndentAssignment:
|
607
|
-
# By default, the indentation width from Style/IndentationWidth is used
|
660
|
+
# By default, the indentation width from `Style/IndentationWidth` is used
|
608
661
|
# But it can be overridden by setting this parameter
|
609
662
|
IndentationWidth: ~
|
610
663
|
|
@@ -626,7 +679,7 @@ Style/IndentHash:
|
|
626
679
|
- special_inside_parentheses
|
627
680
|
- consistent
|
628
681
|
- align_braces
|
629
|
-
# By default, the indentation width from Style/IndentationWidth is used
|
682
|
+
# By default, the indentation width from `Style/IndentationWidth` is used
|
630
683
|
# But it can be overridden by setting this parameter
|
631
684
|
IndentationWidth: ~
|
632
685
|
|
@@ -654,7 +707,7 @@ Style/Next:
|
|
654
707
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
655
708
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
656
709
|
EnforcedStyle: skip_modifier_ifs
|
657
|
-
# `MinBodyLength` defines the number of lines of the a body of an if
|
710
|
+
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
658
711
|
# needs to have to trigger this cop
|
659
712
|
MinBodyLength: 3
|
660
713
|
SupportedStyles:
|
@@ -687,6 +740,9 @@ Style/MethodDefParentheses:
|
|
687
740
|
- require_no_parentheses
|
688
741
|
- require_no_parentheses_except_multiline
|
689
742
|
|
743
|
+
Style/MethodCallWithArgsParentheses:
|
744
|
+
IgnoredMethods: []
|
745
|
+
|
690
746
|
Style/MethodName:
|
691
747
|
EnforcedStyle: snake_case
|
692
748
|
SupportedStyles:
|
@@ -772,7 +828,7 @@ Style/MultilineOperationIndentation:
|
|
772
828
|
SupportedStyles:
|
773
829
|
- aligned
|
774
830
|
- indented
|
775
|
-
# By default, the indentation width from Style/IndentationWidth is used
|
831
|
+
# By default, the indentation width from `Style/IndentationWidth` is used
|
776
832
|
# But it can be overridden by setting this parameter
|
777
833
|
IndentationWidth: ~
|
778
834
|
|
@@ -814,8 +870,8 @@ Style/PercentLiteralDelimiters:
|
|
814
870
|
Style/PercentQLiterals:
|
815
871
|
EnforcedStyle: lower_case_q
|
816
872
|
SupportedStyles:
|
817
|
-
- lower_case_q # Use
|
818
|
-
- upper_case_q # Always use
|
873
|
+
- lower_case_q # Use `%q` when possible, `%Q` when necessary
|
874
|
+
- upper_case_q # Always use `%Q`
|
819
875
|
|
820
876
|
Style/PredicateName:
|
821
877
|
# Predicate name prefixes.
|
@@ -828,7 +884,7 @@ Style/PredicateName:
|
|
828
884
|
- is_
|
829
885
|
- has_
|
830
886
|
- have_
|
831
|
-
# Predicate names which, despite having a blacklisted prefix, or no
|
887
|
+
# Predicate names which, despite having a blacklisted prefix, or no `?`,
|
832
888
|
# should still be accepted
|
833
889
|
NameWhitelist:
|
834
890
|
- is_a?
|
@@ -850,20 +906,20 @@ Style/RaiseArgs:
|
|
850
906
|
- exploded # raise Exception, msg
|
851
907
|
|
852
908
|
Style/RedundantReturn:
|
853
|
-
# When true allows code like `return x, y`.
|
909
|
+
# When `true` allows code like `return x, y`.
|
854
910
|
AllowMultipleReturnValues: false
|
855
911
|
|
856
|
-
# Use
|
912
|
+
# Use `/` or `%r` around regular expressions.
|
857
913
|
Style/RegexpLiteral:
|
858
914
|
EnforcedStyle: slashes
|
859
915
|
# slashes: Always use slashes.
|
860
|
-
# percent_r: Always use
|
861
|
-
# mixed: Use slashes on single-line regexes, and
|
916
|
+
# percent_r: Always use `%r`.
|
917
|
+
# mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
|
862
918
|
SupportedStyles:
|
863
919
|
- slashes
|
864
920
|
- percent_r
|
865
921
|
- mixed
|
866
|
-
# If false
|
922
|
+
# If `false`, the cop will always recommend using `%r` if one or more slashes
|
867
923
|
# are found in the regexp string.
|
868
924
|
AllowInnerSlashes: false
|
869
925
|
|
@@ -873,7 +929,7 @@ Style/SafeNavigation:
|
|
873
929
|
ConvertCodeThatCanStartToReturnNil: false
|
874
930
|
|
875
931
|
Style/Semicolon:
|
876
|
-
# Allow
|
932
|
+
# Allow `;` to separate several expressions on the same line.
|
877
933
|
AllowAsExpressionSeparator: false
|
878
934
|
|
879
935
|
Style/SignalException:
|
@@ -896,7 +952,7 @@ Style/SingleLineMethods:
|
|
896
952
|
AllowIfMethodIsEmpty: true
|
897
953
|
|
898
954
|
Style/SpaceBeforeFirstArg:
|
899
|
-
# When true
|
955
|
+
# When `true`, allows most uses of extra spacing if the intent is to align
|
900
956
|
# things with the previous or next line, not counting empty lines or comment
|
901
957
|
# lines.
|
902
958
|
AllowForAlignment: true
|
@@ -918,7 +974,7 @@ Style/StringLiterals:
|
|
918
974
|
SupportedStyles:
|
919
975
|
- single_quotes
|
920
976
|
- double_quotes
|
921
|
-
# If true
|
977
|
+
# If `true`, strings which span multiple lines using `\` for continuation must
|
922
978
|
# use the same type of quotes on each line.
|
923
979
|
ConsistentQuotesInMultiline: false
|
924
980
|
|
@@ -940,7 +996,7 @@ Style/StringMethods:
|
|
940
996
|
|
941
997
|
Style/SpaceAroundBlockParameters:
|
942
998
|
EnforcedStyleInsidePipes: no_space
|
943
|
-
|
999
|
+
SupportedStylesInsidePipes:
|
944
1000
|
- space
|
945
1001
|
- no_space
|
946
1002
|
|
@@ -951,7 +1007,7 @@ Style/SpaceAroundEqualsInParameterDefault:
|
|
951
1007
|
- no_space
|
952
1008
|
|
953
1009
|
Style/SpaceAroundOperators:
|
954
|
-
# When true
|
1010
|
+
# When `true`, allows most uses of extra spacing if the intent is to align
|
955
1011
|
# with an operator on the previous or next line, not counting empty lines
|
956
1012
|
# or comment lines.
|
957
1013
|
AllowForAlignment: true
|
@@ -967,20 +1023,25 @@ Style/SpaceInsideBlockBraces:
|
|
967
1023
|
SupportedStyles:
|
968
1024
|
- space
|
969
1025
|
- no_space
|
970
|
-
# Valid values are: space, no_space
|
971
1026
|
EnforcedStyleForEmptyBraces: no_space
|
1027
|
+
SupportedStylesForEmptyBraces:
|
1028
|
+
- space
|
1029
|
+
- no_space
|
972
1030
|
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
973
1031
|
SpaceBeforeBlockParameters: true
|
974
1032
|
|
975
1033
|
Style/SpaceInsideHashLiteralBraces:
|
976
1034
|
EnforcedStyle: space
|
977
|
-
EnforcedStyleForEmptyBraces: no_space
|
978
1035
|
SupportedStyles:
|
979
1036
|
- space
|
980
1037
|
- no_space
|
981
1038
|
# 'compact' normally requires a space inside hash braces, with the exception
|
982
1039
|
# that successive left braces or right braces are collapsed together
|
983
1040
|
- compact
|
1041
|
+
EnforcedStyleForEmptyBraces: no_space
|
1042
|
+
SupportedStylesForEmptyBraces:
|
1043
|
+
- space
|
1044
|
+
- no_space
|
984
1045
|
|
985
1046
|
Style/SpaceInsideStringInterpolation:
|
986
1047
|
EnforcedStyle: no_space
|
@@ -1021,7 +1082,7 @@ Style/TrailingCommaInArguments:
|
|
1021
1082
|
# If `consistent_comma`, the cop requires a comma after the last argument,
|
1022
1083
|
# for all parenthesized method calls with arguments.
|
1023
1084
|
EnforcedStyleForMultiline: no_comma
|
1024
|
-
|
1085
|
+
SupportedStylesForMultiline:
|
1025
1086
|
- comma
|
1026
1087
|
- consistent_comma
|
1027
1088
|
- no_comma
|
@@ -1032,7 +1093,7 @@ Style/TrailingCommaInLiteral:
|
|
1032
1093
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
1033
1094
|
# non-empty array and hash literals.
|
1034
1095
|
EnforcedStyleForMultiline: no_comma
|
1035
|
-
|
1096
|
+
SupportedStylesForMultiline:
|
1036
1097
|
- comma
|
1037
1098
|
- consistent_comma
|
1038
1099
|
- no_comma
|
@@ -1040,7 +1101,7 @@ Style/TrailingCommaInLiteral:
|
|
1040
1101
|
# TrivialAccessors requires exact name matches and doesn't allow
|
1041
1102
|
# predicated methods by default.
|
1042
1103
|
Style/TrivialAccessors:
|
1043
|
-
# When set to false the cop will suggest the use of accessor methods
|
1104
|
+
# When set to `false` the cop will suggest the use of accessor methods
|
1044
1105
|
# in situations like:
|
1045
1106
|
#
|
1046
1107
|
# def name
|
@@ -1095,7 +1156,7 @@ Style/VariableNumber:
|
|
1095
1156
|
Style/WhileUntilModifier:
|
1096
1157
|
MaxLineLength: 80
|
1097
1158
|
|
1098
|
-
# WordArray enforces how array literals of word-like strings should be expressed.
|
1159
|
+
# `WordArray` enforces how array literals of word-like strings should be expressed.
|
1099
1160
|
Style/WordArray:
|
1100
1161
|
EnforcedStyle: percent
|
1101
1162
|
SupportedStyles:
|
@@ -1103,11 +1164,11 @@ Style/WordArray:
|
|
1103
1164
|
- percent
|
1104
1165
|
# bracket style: ['word1', 'word2']
|
1105
1166
|
- brackets
|
1106
|
-
# The MinSize option causes the WordArray rule to be ignored for arrays
|
1167
|
+
# The `MinSize` option causes the `WordArray` rule to be ignored for arrays
|
1107
1168
|
# smaller than a certain size. The rule is only applied to arrays
|
1108
|
-
# whose element count is greater than or equal to MinSize
|
1169
|
+
# whose element count is greater than or equal to `MinSize`.
|
1109
1170
|
MinSize: 0
|
1110
|
-
# The regular expression WordRegex decides what is considered a word.
|
1171
|
+
# The regular expression `WordRegex` decides what is considered a word.
|
1111
1172
|
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
1112
1173
|
|
1113
1174
|
##################### Metrics ##################################
|
@@ -1118,6 +1179,7 @@ Metrics/AbcSize:
|
|
1118
1179
|
Max: 15
|
1119
1180
|
|
1120
1181
|
Metrics/BlockNesting:
|
1182
|
+
CountBlocks: false
|
1121
1183
|
Max: 3
|
1122
1184
|
|
1123
1185
|
Metrics/ClassLength:
|
@@ -1156,10 +1218,7 @@ Metrics/MethodLength:
|
|
1156
1218
|
Metrics/BlockLength:
|
1157
1219
|
CountComments: false # count full line comments?
|
1158
1220
|
Max: 25
|
1159
|
-
|
1160
|
-
- 'Rakefile'
|
1161
|
-
- '**/*.rake'
|
1162
|
-
- 'spec/**/*.rb'
|
1221
|
+
ExcludedMethods: []
|
1163
1222
|
|
1164
1223
|
Metrics/ParameterLists:
|
1165
1224
|
Max: 5
|
@@ -1181,8 +1240,8 @@ Lint/BlockAlignment:
|
|
1181
1240
|
# The value `start_of_line` means it should be aligned with the whole
|
1182
1241
|
# expression's starting line.
|
1183
1242
|
# The value `either` means both are allowed.
|
1184
|
-
|
1185
|
-
|
1243
|
+
EnforcedStyleAlignWith: either
|
1244
|
+
SupportedStylesAlignWith:
|
1186
1245
|
- either
|
1187
1246
|
- start_of_block
|
1188
1247
|
- start_of_line
|
@@ -1190,14 +1249,14 @@ Lint/BlockAlignment:
|
|
1190
1249
|
# Align ends correctly.
|
1191
1250
|
Lint/EndAlignment:
|
1192
1251
|
# The value `keyword` means that `end` should be aligned with the matching
|
1193
|
-
# keyword (if
|
1252
|
+
# keyword (`if`, `while`, etc.).
|
1194
1253
|
# The value `variable` means that in assignments, `end` should be aligned
|
1195
1254
|
# with the start of the variable on the left hand side of `=`. In all other
|
1196
1255
|
# situations, `end` should still be aligned with the keyword.
|
1197
1256
|
# The value `start_of_line` means that `end` should be aligned with the start
|
1198
1257
|
# of the line which the matching keyword appears on.
|
1199
|
-
|
1200
|
-
|
1258
|
+
EnforcedStyleAlignWith: keyword
|
1259
|
+
SupportedStylesAlignWith:
|
1201
1260
|
- keyword
|
1202
1261
|
- variable
|
1203
1262
|
- start_of_line
|
@@ -1208,8 +1267,8 @@ Lint/DefEndAlignment:
|
|
1208
1267
|
# The value `start_of_line` means that `end` should be aligned with method
|
1209
1268
|
# calls like `private`, `public`, etc, if present in front of the `def`
|
1210
1269
|
# keyword on the same line.
|
1211
|
-
|
1212
|
-
|
1270
|
+
EnforcedStyleAlignWith: start_of_line
|
1271
|
+
SupportedStylesAlignWith:
|
1213
1272
|
- start_of_line
|
1214
1273
|
- def
|
1215
1274
|
AutoCorrect: false
|
@@ -1307,6 +1366,10 @@ Rails/RequestReferer:
|
|
1307
1366
|
- referer
|
1308
1367
|
- referrer
|
1309
1368
|
|
1369
|
+
Rails/ReversibleMigration:
|
1370
|
+
Include:
|
1371
|
+
- db/migrate/*.rb
|
1372
|
+
|
1310
1373
|
Rails/SafeNavigation:
|
1311
1374
|
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
1312
1375
|
# `try` and `try!` work slighly differently. `try!` and safe navigation will
|
@@ -1327,12 +1390,26 @@ Rails/TimeZone:
|
|
1327
1390
|
- flexible
|
1328
1391
|
|
1329
1392
|
Rails/UniqBeforePluck:
|
1330
|
-
|
1331
|
-
|
1393
|
+
EnforcedStyle: conservative
|
1394
|
+
SupportedStyles:
|
1332
1395
|
- conservative
|
1333
1396
|
- aggressive
|
1334
1397
|
AutoCorrect: false
|
1335
1398
|
|
1399
|
+
Rails/SkipsModelValidations:
|
1400
|
+
Blacklist:
|
1401
|
+
- decrement!
|
1402
|
+
- decrement_counter
|
1403
|
+
- increment!
|
1404
|
+
- increment_counter
|
1405
|
+
- toggle!
|
1406
|
+
- touch
|
1407
|
+
- update_all
|
1408
|
+
- update_attribute
|
1409
|
+
- update_column
|
1410
|
+
- update_columns
|
1411
|
+
- update_counters
|
1412
|
+
|
1336
1413
|
Rails/Validation:
|
1337
1414
|
Include:
|
1338
1415
|
- app/models/**/*.rb
|