rubocop 0.13.1 → 0.14.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.yml +3 -0
- data/CHANGELOG.md +42 -0
- data/README.md +59 -54
- data/config/default.yml +124 -95
- data/config/disabled.yml +4 -0
- data/config/enabled.yml +286 -264
- data/lib/rubocop.rb +10 -3
- data/lib/rubocop/cli.rb +10 -171
- data/lib/rubocop/cop/cop.rb +14 -11
- data/lib/rubocop/cop/lint/debugger.rb +35 -0
- data/lib/rubocop/cop/lint/syntax.rb +34 -0
- data/lib/rubocop/cop/offence.rb +15 -23
- data/lib/rubocop/cop/style/align_array.rb +1 -10
- data/lib/rubocop/cop/style/align_hash.rb +14 -2
- data/lib/rubocop/cop/style/align_parameters.rb +1 -11
- data/lib/rubocop/cop/style/and_or.rb +13 -11
- data/lib/rubocop/cop/style/attr.rb +1 -1
- data/lib/rubocop/cop/style/autocorrect_alignment.rb +31 -6
- data/lib/rubocop/cop/style/blocks.rb +14 -6
- data/lib/rubocop/cop/style/character_literal.rb +1 -1
- data/lib/rubocop/cop/style/class_length.rb +38 -0
- data/lib/rubocop/cop/style/collection_methods.rb +1 -1
- data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
- data/lib/rubocop/cop/style/configurable_naming.rb +47 -0
- data/lib/rubocop/cop/style/def_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/empty_literal.rb +1 -1
- data/lib/rubocop/cop/style/even_odd.rb +7 -3
- data/lib/rubocop/cop/style/hash_methods.rb +1 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +36 -7
- data/lib/rubocop/cop/style/lambda_call.rb +36 -11
- data/lib/rubocop/cop/style/method_call_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +41 -0
- data/lib/rubocop/cop/style/method_length.rb +2 -13
- data/lib/rubocop/cop/style/method_name.rb +42 -0
- data/lib/rubocop/cop/style/numeric_literals.rb +4 -0
- data/lib/rubocop/cop/style/perl_backrefs.rb +1 -1
- data/lib/rubocop/cop/style/raise_args.rb +60 -0
- data/lib/rubocop/cop/style/redundant_exception.rb +32 -0
- data/lib/rubocop/cop/style/redundant_return.rb +14 -5
- data/lib/rubocop/cop/style/redundant_self.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +13 -4
- data/lib/rubocop/cop/style/signal_exception.rb +63 -14
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
- data/lib/rubocop/cop/style/string_help.rb +4 -1
- data/lib/rubocop/cop/style/string_literals.rb +34 -11
- data/lib/rubocop/cop/style/surrounding_space.rb +64 -17
- data/lib/rubocop/cop/style/tab.rb +1 -1
- data/lib/rubocop/cop/style/variable_name.rb +44 -0
- data/lib/rubocop/cop/style/when_then.rb +1 -1
- data/lib/rubocop/cop/style/while_until_do.rb +1 -1
- data/lib/rubocop/cop/team.rb +4 -7
- data/lib/rubocop/cop/util.rb +12 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/emacs_style_formatter.rb +5 -2
- data/lib/rubocop/formatter/json_formatter.rb +1 -0
- data/lib/rubocop/formatter/progress_formatter.rb +9 -13
- data/lib/rubocop/formatter/simple_text_formatter.rb +63 -15
- data/lib/rubocop/options.rb +184 -0
- data/lib/rubocop/processed_source.rb +4 -0
- data/lib/rubocop/version.rb +1 -1
- data/rubocop.gemspec +1 -1
- data/spec/rubocop/cli_spec.rb +870 -1001
- data/spec/rubocop/config_spec.rb +13 -13
- data/spec/rubocop/config_store_spec.rb +38 -37
- data/spec/rubocop/cop/commissioner_spec.rb +42 -46
- data/spec/rubocop/cop/cop_spec.rb +72 -77
- data/spec/rubocop/cop/corrector_spec.rb +51 -55
- data/spec/rubocop/cop/lint/assignment_in_condition_spec.rb +100 -106
- data/spec/rubocop/cop/lint/block_alignment_spec.rb +403 -409
- data/spec/rubocop/cop/lint/debugger_spec.rb +39 -0
- data/spec/rubocop/cop/lint/empty_ensure_spec.rb +19 -25
- data/spec/rubocop/cop/lint/end_alignment_spec.rb +50 -56
- data/spec/rubocop/cop/lint/end_in_method_spec.rb +20 -26
- data/spec/rubocop/cop/lint/ensure_return_spec.rb +30 -36
- data/spec/rubocop/cop/lint/eval_spec.rb +25 -31
- data/spec/rubocop/cop/lint/handle_exceptions_spec.rb +22 -28
- data/spec/rubocop/cop/lint/literal_in_condition_spec.rb +51 -57
- data/spec/rubocop/cop/lint/loop_spec.rb +17 -23
- data/spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb +51 -57
- data/spec/rubocop/cop/lint/rescue_exception_spec.rb +105 -111
- data/spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb +230 -236
- data/spec/rubocop/cop/lint/syntax_spec.rb +33 -0
- data/spec/rubocop/cop/lint/unreachable_code_spec.rb +51 -57
- data/spec/rubocop/cop/lint/useless_assignment_spec.rb +1544 -1550
- data/spec/rubocop/cop/lint/useless_comparison_spec.rb +21 -27
- data/spec/rubocop/cop/lint/useless_setter_call_spec.rb +119 -125
- data/spec/rubocop/cop/lint/void_spec.rb +50 -56
- data/spec/rubocop/cop/offence_spec.rb +101 -131
- data/spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb +6 -12
- data/spec/rubocop/cop/rails/read_attribute_spec.rb +6 -12
- data/spec/rubocop/cop/rails/validation_spec.rb +13 -19
- data/spec/rubocop/cop/style/access_control_spec.rb +146 -152
- data/spec/rubocop/cop/style/alias_spec.rb +30 -36
- data/spec/rubocop/cop/style/align_array_spec.rb +57 -56
- data/spec/rubocop/cop/style/align_hash_spec.rb +256 -237
- data/spec/rubocop/cop/style/align_parameters_spec.rb +216 -202
- data/spec/rubocop/cop/style/and_or_spec.rb +51 -55
- data/spec/rubocop/cop/style/ascii_comments_spec.rb +14 -20
- data/spec/rubocop/cop/style/ascii_identifiers_spec.rb +26 -32
- data/spec/rubocop/cop/style/attr_spec.rb +11 -17
- data/spec/rubocop/cop/style/begin_block_spec.rb +6 -12
- data/spec/rubocop/cop/style/block_comments_spec.rb +13 -19
- data/spec/rubocop/cop/style/block_nesting_spec.rb +134 -140
- data/spec/rubocop/cop/style/blocks_spec.rb +81 -84
- data/spec/rubocop/cop/style/case_equality_spec.rb +5 -11
- data/spec/rubocop/cop/style/case_indentation_spec.rb +71 -77
- data/spec/rubocop/cop/style/character_literal_spec.rb +31 -37
- data/spec/rubocop/cop/style/class_and_module_camel_case_spec.rb +31 -37
- data/spec/rubocop/cop/style/class_length_spec.rb +65 -0
- data/spec/rubocop/cop/style/class_methods_spec.rb +35 -41
- data/spec/rubocop/cop/style/class_vars_spec.rb +11 -17
- data/spec/rubocop/cop/style/collection_methods_spec.rb +41 -47
- data/spec/rubocop/cop/style/colon_method_call_spec.rb +45 -51
- data/spec/rubocop/cop/style/comment_annotation_spec.rb +79 -85
- data/spec/rubocop/cop/style/constant_name_spec.rb +45 -51
- data/spec/rubocop/cop/style/def_with_parentheses_spec.rb +28 -34
- data/spec/rubocop/cop/style/def_without_parentheses_spec.rb +23 -29
- data/spec/rubocop/cop/style/documentation_spec.rb +60 -66
- data/spec/rubocop/cop/style/dot_position_spec.rb +50 -56
- data/spec/rubocop/cop/style/empty_line_between_defs_spec.rb +109 -110
- data/spec/rubocop/cop/style/empty_lines_spec.rb +28 -34
- data/spec/rubocop/cop/style/empty_literal_spec.rb +80 -86
- data/spec/rubocop/cop/style/encoding_spec.rb +50 -56
- data/spec/rubocop/cop/style/end_block_spec.rb +6 -12
- data/spec/rubocop/cop/style/end_of_line_spec.rb +13 -19
- data/spec/rubocop/cop/style/even_odd_spec.rb +69 -41
- data/spec/rubocop/cop/style/favor_join_spec.rb +21 -27
- data/spec/rubocop/cop/style/favor_modifier_spec.rb +180 -176
- data/spec/rubocop/cop/style/favor_sprintf_spec.rb +41 -47
- data/spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb +63 -69
- data/spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb +32 -38
- data/spec/rubocop/cop/style/final_newline_spec.rb +16 -22
- data/spec/rubocop/cop/style/for_spec.rb +18 -24
- data/spec/rubocop/cop/style/global_vars_spec.rb +23 -29
- data/spec/rubocop/cop/style/hash_methods_spec.rb +39 -45
- data/spec/rubocop/cop/style/hash_syntax_spec.rb +93 -65
- data/spec/rubocop/cop/style/if_with_semicolon_spec.rb +11 -17
- data/spec/rubocop/cop/style/indentation_width_spec.rb +377 -383
- data/spec/rubocop/cop/style/lambda_call_spec.rb +40 -22
- data/spec/rubocop/cop/style/lambda_spec.rb +30 -34
- data/spec/rubocop/cop/style/leading_comment_space_spec.rb +44 -50
- data/spec/rubocop/cop/style/line_length_spec.rb +11 -17
- data/spec/rubocop/cop/style/method_call_parentheses_spec.rb +14 -20
- data/spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb +60 -0
- data/spec/rubocop/cop/style/method_length_spec.rb +127 -133
- data/spec/rubocop/cop/style/method_name_spec.rb +103 -0
- data/spec/rubocop/cop/style/module_function_spec.rb +16 -22
- data/spec/rubocop/cop/style/multiline_block_chain_spec.rb +64 -70
- data/spec/rubocop/cop/style/multiline_if_then_spec.rb +74 -80
- data/spec/rubocop/cop/style/nil_comparison_spec.rb +20 -26
- data/spec/rubocop/cop/style/not_spec.rb +13 -19
- data/spec/rubocop/cop/style/numeric_literals_spec.rb +36 -35
- data/spec/rubocop/cop/style/one_line_conditional_spec.rb +5 -11
- data/spec/rubocop/cop/style/op_method_spec.rb +61 -67
- data/spec/rubocop/cop/style/parameter_lists_spec.rb +31 -37
- data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +62 -68
- data/spec/rubocop/cop/style/perl_backrefs_spec.rb +9 -15
- data/spec/rubocop/cop/style/proc_spec.rb +13 -19
- data/spec/rubocop/cop/style/raise_args_spec.rb +55 -0
- data/spec/rubocop/cop/style/reduce_arguments_spec.rb +49 -55
- data/spec/rubocop/cop/style/redundant_begin_spec.rb +47 -53
- data/spec/rubocop/cop/style/redundant_exception_spec.rb +27 -0
- data/spec/rubocop/cop/style/redundant_return_spec.rb +164 -72
- data/spec/rubocop/cop/style/redundant_self_spec.rb +109 -115
- data/spec/rubocop/cop/style/regexp_literal_spec.rb +57 -63
- data/spec/rubocop/cop/style/rescue_modifier_spec.rb +99 -105
- data/spec/rubocop/cop/style/semicolon_spec.rb +95 -90
- data/spec/rubocop/cop/style/signal_exception_spec.rb +248 -95
- data/spec/rubocop/cop/style/single_line_methods_spec.rb +45 -51
- data/spec/rubocop/cop/style/space_after_colon_spec.rb +14 -20
- data/spec/rubocop/cop/style/space_after_comma_spec.rb +16 -22
- data/spec/rubocop/cop/style/space_after_control_keyword_spec.rb +48 -54
- data/spec/rubocop/cop/style/space_after_method_name_spec.rb +49 -55
- data/spec/rubocop/cop/style/space_after_semicolon_spec.rb +10 -16
- data/spec/rubocop/cop/style/space_around_block_braces_spec.rb +118 -50
- data/spec/rubocop/cop/style/space_around_equals_in_default_parameter_spec.rb +18 -24
- data/spec/rubocop/cop/style/space_around_operators_spec.rb +204 -210
- data/spec/rubocop/cop/style/space_before_modifier_keyword_spec.rb +36 -42
- data/spec/rubocop/cop/style/space_inside_brackets_spec.rb +39 -45
- data/spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb +62 -68
- data/spec/rubocop/cop/style/space_inside_parens_spec.rb +18 -24
- data/spec/rubocop/cop/style/special_global_vars_spec.rb +40 -46
- data/spec/rubocop/cop/style/string_literals_spec.rb +148 -70
- data/spec/rubocop/cop/style/symbol_array_spec.rb +28 -34
- data/spec/rubocop/cop/style/symbol_name_spec.rb +132 -138
- data/spec/rubocop/cop/style/tab_spec.rb +9 -15
- data/spec/rubocop/cop/style/ternary_operator_spec.rb +25 -31
- data/spec/rubocop/cop/style/trailing_blank_lines_spec.rb +10 -16
- data/spec/rubocop/cop/style/trailing_whitespace_spec.rb +14 -20
- data/spec/rubocop/cop/style/trivial_accessors_spec.rb +374 -380
- data/spec/rubocop/cop/style/unless_else_spec.rb +17 -23
- data/spec/rubocop/cop/style/variable_interpolation_spec.rb +36 -42
- data/spec/rubocop/cop/style/variable_name_spec.rb +83 -0
- data/spec/rubocop/cop/style/when_then_spec.rb +31 -37
- data/spec/rubocop/cop/style/while_until_do_spec.rb +47 -53
- data/spec/rubocop/cop/style/word_array_spec.rb +49 -55
- data/spec/rubocop/cop/team_spec.rb +125 -127
- data/spec/rubocop/cop/variable_inspector/assignment_spec.rb +176 -180
- data/spec/rubocop/cop/variable_inspector/locatable_spec.rb +580 -586
- data/spec/rubocop/cop/variable_inspector/scope_spec.rb +140 -146
- data/spec/rubocop/cop/variable_inspector/variable_spec.rb +52 -58
- data/spec/rubocop/cop/variable_inspector/variable_table_spec.rb +217 -223
- data/spec/rubocop/cop/variable_inspector_spec.rb +15 -19
- data/spec/rubocop/formatter/clang_style_formatter_spec.rb +35 -36
- data/spec/rubocop/formatter/disabled_config_formatter_spec.rb +2 -2
- data/spec/rubocop/formatter/emacs_style_formatter_spec.rb +24 -1
- data/spec/rubocop/formatter/file_list_formatter_spec.rb +1 -1
- data/spec/rubocop/formatter/formatter_set_spec.rb +3 -3
- data/spec/rubocop/formatter/json_formatter_spec.rb +7 -2
- data/spec/rubocop/formatter/offence_count_formatter_spec.rb +1 -1
- data/spec/rubocop/formatter/progress_formatter_spec.rb +1 -1
- data/spec/rubocop/formatter/simple_text_formatter_spec.rb +55 -6
- data/spec/rubocop/options_spec.rb +233 -0
- data/spec/rubocop/processed_source_spec.rb +85 -42
- data/spec/rubocop/source_parser_spec.rb +108 -110
- data/spec/rubocop/target_finder_spec.rb +125 -127
- data/spec/rubocop/token_spec.rb +15 -17
- metadata +32 -8
- data/lib/rubocop/backports/bsearch.rb +0 -39
- data/lib/rubocop/cop/style/method_and_variable_snake_case.rb +0 -77
- data/spec/rubocop/cop/style/method_and_variable_snake_case_spec.rb +0 -102
data/config/disabled.yml
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# These are all the cops that are disabled in the default configuration.
|
2
2
|
|
3
|
+
MethodCalledOnDoEndBlock:
|
4
|
+
Description: 'Avoid chaining a method call on a do...end block.'
|
5
|
+
Enabled: false
|
6
|
+
|
3
7
|
SymbolArray:
|
4
8
|
Description: 'Use %i or %I for arrays of symbols.'
|
5
9
|
Enabled: false
|
data/config/enabled.yml
CHANGED
@@ -1,97 +1,106 @@
|
|
1
1
|
# These are all the cops that are enabled in the default configuration.
|
2
2
|
|
3
|
-
|
4
|
-
Description:
|
3
|
+
AccessControl:
|
4
|
+
Description: >
|
5
|
+
Indent private/protected as deep as defs and keep blank
|
6
|
+
lines around them.
|
5
7
|
Enabled: true
|
6
8
|
|
7
|
-
|
8
|
-
Description: '
|
9
|
+
Alias:
|
10
|
+
Description: 'Use alias_method instead of alias.'
|
9
11
|
Enabled: true
|
10
12
|
|
11
|
-
|
12
|
-
Description:
|
13
|
+
AlignArray:
|
14
|
+
Description: >
|
15
|
+
Align the elements of an array literal if they span more than
|
16
|
+
one line.
|
13
17
|
Enabled: true
|
14
18
|
|
15
|
-
|
16
|
-
Description:
|
19
|
+
AlignHash:
|
20
|
+
Description: >
|
21
|
+
Align the elements of a hash literal if they span more than
|
22
|
+
one line.
|
17
23
|
Enabled: true
|
18
24
|
|
19
|
-
|
20
|
-
Description:
|
25
|
+
AlignParameters:
|
26
|
+
Description: >
|
27
|
+
Align the parameters of a method call if they span more
|
28
|
+
than one line.
|
21
29
|
Enabled: true
|
22
30
|
|
23
|
-
|
24
|
-
Description: '
|
31
|
+
AndOr:
|
32
|
+
Description: 'Use &&/|| instead of and/or.'
|
25
33
|
Enabled: true
|
26
34
|
|
27
|
-
|
28
|
-
Description: '
|
35
|
+
AsciiIdentifiers:
|
36
|
+
Description: 'Use only ascii symbols in identifiers.'
|
29
37
|
Enabled: true
|
30
38
|
|
31
|
-
|
32
|
-
Description: '
|
39
|
+
AsciiComments:
|
40
|
+
Description: 'Use only ascii symbols in comments.'
|
33
41
|
Enabled: true
|
34
42
|
|
35
|
-
|
36
|
-
Description: '
|
43
|
+
Attr:
|
44
|
+
Description: 'Checks for uses of Module#attr.'
|
37
45
|
Enabled: true
|
38
46
|
|
39
|
-
|
40
|
-
Description:
|
47
|
+
BeginBlock:
|
48
|
+
Description: 'Avoid the use of BEGIN blocks.'
|
41
49
|
Enabled: true
|
42
50
|
|
43
|
-
|
44
|
-
Description:
|
51
|
+
Blocks:
|
52
|
+
Description: >
|
53
|
+
Avoid using {...} for multi-line blocks (multiline chaining is
|
54
|
+
always ugly).
|
55
|
+
Prefer {...} over do...end for single-line blocks.
|
45
56
|
Enabled: true
|
46
57
|
|
47
|
-
|
48
|
-
Description: '
|
58
|
+
BlockComments:
|
59
|
+
Description: 'Do not use block comments.'
|
49
60
|
Enabled: true
|
50
61
|
|
51
|
-
|
52
|
-
Description: '
|
62
|
+
BlockNesting:
|
63
|
+
Description: 'Avoid excessive block nesting'
|
53
64
|
Enabled: true
|
54
65
|
|
55
|
-
|
56
|
-
Description: '
|
66
|
+
CaseEquality:
|
67
|
+
Description: 'Avoid explicit use of the case equality operator(===).'
|
57
68
|
Enabled: true
|
58
69
|
|
59
|
-
|
60
|
-
Description: '
|
70
|
+
CaseIndentation:
|
71
|
+
Description: 'Indent when as deep as case.'
|
61
72
|
Enabled: true
|
62
73
|
|
63
|
-
|
64
|
-
Description: '
|
74
|
+
CharacterLiteral:
|
75
|
+
Description: 'Checks for uses of character literals.'
|
65
76
|
Enabled: true
|
66
77
|
|
67
|
-
|
68
|
-
Description: '
|
78
|
+
ClassLength:
|
79
|
+
Description: 'Avoid classes longer than 100 lines of code.'
|
69
80
|
Enabled: true
|
70
81
|
|
71
|
-
|
72
|
-
Description: 'Use
|
82
|
+
ClassAndModuleCamelCase:
|
83
|
+
Description: 'Use CamelCase for classes and modules.'
|
73
84
|
Enabled: true
|
74
85
|
|
75
|
-
|
76
|
-
Description:
|
77
|
-
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
78
|
-
{ :a => 1, :b => 2 }.
|
86
|
+
ClassMethods:
|
87
|
+
Description: 'Use self when defining module/class methods.'
|
79
88
|
Enabled: true
|
80
89
|
|
81
|
-
|
82
|
-
Description: '
|
90
|
+
ClassVars:
|
91
|
+
Description: 'Avoid the use of class variables.'
|
83
92
|
Enabled: true
|
84
93
|
|
85
|
-
|
86
|
-
Description:
|
87
|
-
Add underscores to large numeric literals to improve their
|
88
|
-
readability.
|
94
|
+
CollectionMethods:
|
95
|
+
Description: 'Preferred collection methods.'
|
89
96
|
Enabled: true
|
90
97
|
|
91
|
-
|
92
|
-
Description:
|
93
|
-
|
94
|
-
|
98
|
+
ColonMethodCall:
|
99
|
+
Description: 'Do not use :: for method call.'
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
ConstantName:
|
103
|
+
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
95
104
|
Enabled: true
|
96
105
|
|
97
106
|
DefWithParentheses:
|
@@ -104,76 +113,58 @@ DefWithoutParentheses:
|
|
104
113
|
any arguments.
|
105
114
|
Enabled: true
|
106
115
|
|
107
|
-
|
108
|
-
Description: '
|
116
|
+
Documentation:
|
117
|
+
Description: 'Document classes and non-namespace modules.'
|
109
118
|
Enabled: true
|
110
119
|
|
111
|
-
|
112
|
-
Description: '
|
120
|
+
DotPosition:
|
121
|
+
Description: 'Checks the position of the dot in multi-line method calls.'
|
113
122
|
Enabled: true
|
114
123
|
|
115
|
-
|
116
|
-
Description:
|
117
|
-
Favor the ternary operator(?:) over
|
118
|
-
if/then/else/end constructs.
|
124
|
+
EmptyLines:
|
125
|
+
Description: "Don't use several empty lines in a row."
|
119
126
|
Enabled: true
|
120
127
|
|
121
|
-
|
122
|
-
Description:
|
123
|
-
Avoid using {...} for multi-line blocks (multiline chaining is
|
124
|
-
always ugly).
|
125
|
-
Prefer {...} over do...end for single-line blocks.
|
128
|
+
EmptyLineBetweenDefs:
|
129
|
+
Description: 'Use empty lines between defs.'
|
126
130
|
Enabled: true
|
127
131
|
|
128
|
-
|
129
|
-
|
130
|
-
Description: 'Avoid parameter lists longer than three or four parameters.'
|
132
|
+
EmptyLiteral:
|
133
|
+
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
131
134
|
Enabled: true
|
132
135
|
|
133
|
-
|
134
|
-
Description:
|
135
|
-
Prefer ' strings when you don't need string interpolation or
|
136
|
-
special symbols.
|
136
|
+
Encoding:
|
137
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
137
138
|
Enabled: true
|
138
139
|
|
139
|
-
|
140
|
-
|
141
|
-
Description: >
|
142
|
-
Avoid multi-line ?: (the ternary operator);
|
143
|
-
use if/unless instead.
|
140
|
+
EndBlock:
|
141
|
+
Description: 'Avoid the use of END blocks.'
|
144
142
|
Enabled: true
|
145
143
|
|
146
|
-
|
147
|
-
Description: 'Use
|
144
|
+
EndOfLine:
|
145
|
+
Description: 'Use Unix-style line endings.'
|
148
146
|
Enabled: true
|
149
147
|
|
150
|
-
|
151
|
-
Description:
|
152
|
-
Never use unless with else. Rewrite these with the positive
|
153
|
-
case first.
|
148
|
+
EnsureReturn:
|
149
|
+
Description: 'Never use return in an ensure block.'
|
154
150
|
Enabled: true
|
155
151
|
|
156
|
-
|
157
|
-
Description: '
|
152
|
+
Eval:
|
153
|
+
Description: 'The use of eval represents a serious security risk.'
|
158
154
|
Enabled: true
|
159
155
|
|
160
|
-
|
161
|
-
Description: '
|
156
|
+
EvenOdd:
|
157
|
+
Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
|
162
158
|
Enabled: true
|
163
159
|
|
164
|
-
|
165
|
-
Description:
|
166
|
-
Favor modifier if/unless usage when you have a
|
167
|
-
single-line body.
|
160
|
+
FavorJoin:
|
161
|
+
Description: 'Use Array#join instead of Array#*.'
|
168
162
|
Enabled: true
|
169
163
|
|
170
|
-
|
171
|
-
Description:
|
172
|
-
Favor modifier while/until usage when you have a
|
173
|
-
single-line body.
|
164
|
+
FavorSprintf:
|
165
|
+
Description: 'Use sprintf instead of String#%.'
|
174
166
|
Enabled: true
|
175
167
|
|
176
|
-
|
177
168
|
FavorUnlessOverNegatedIf:
|
178
169
|
Description: >
|
179
170
|
Favor unless over if for negative conditions
|
@@ -184,288 +175,311 @@ FavorUntilOverNegatedWhile:
|
|
184
175
|
Description: 'Favor until over while for negative conditions.'
|
185
176
|
Enabled: true
|
186
177
|
|
187
|
-
|
188
|
-
Description:
|
189
|
-
Use spaces around the = operator when assigning default
|
190
|
-
values in def params.
|
178
|
+
FinalNewline:
|
179
|
+
Description: 'Checks for a final newline in a source file.'
|
191
180
|
Enabled: true
|
192
181
|
|
193
|
-
|
194
|
-
Description: '
|
182
|
+
For:
|
183
|
+
Description: 'Prefer each over for.'
|
195
184
|
Enabled: true
|
196
185
|
|
197
|
-
|
198
|
-
Description: '
|
186
|
+
GlobalVars:
|
187
|
+
Description: 'Do not introduce global variables.'
|
199
188
|
Enabled: true
|
200
189
|
|
201
|
-
|
202
|
-
Description: '
|
190
|
+
HandleExceptions:
|
191
|
+
Description: "Don't suppress exception."
|
203
192
|
Enabled: true
|
204
193
|
|
205
|
-
|
194
|
+
HashMethods:
|
195
|
+
Description: 'Checks for use of deprecated Hash methods.'
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
HashSyntax:
|
206
199
|
Description: >
|
207
|
-
|
208
|
-
|
200
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
201
|
+
{ :a => 1, :b => 2 }.
|
209
202
|
Enabled: true
|
210
203
|
|
211
|
-
|
212
|
-
Description: '
|
204
|
+
IfWithSemicolon:
|
205
|
+
Description: 'Never use if x; .... Use the ternary operator instead.'
|
213
206
|
Enabled: true
|
214
207
|
|
215
|
-
|
216
|
-
Description:
|
208
|
+
IfUnlessModifier:
|
209
|
+
Description: >
|
210
|
+
Favor modifier if/unless usage when you have a
|
211
|
+
single-line body.
|
217
212
|
Enabled: true
|
218
213
|
|
219
|
-
|
220
|
-
Description: '
|
214
|
+
IndentationWidth:
|
215
|
+
Description: 'Use 2 spaces for indentation.'
|
221
216
|
Enabled: true
|
222
217
|
|
223
|
-
|
224
|
-
Description: '
|
218
|
+
Lambda:
|
219
|
+
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
225
220
|
Enabled: true
|
226
221
|
|
227
|
-
|
228
|
-
Description: '
|
222
|
+
LambdaCall:
|
223
|
+
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
229
224
|
Enabled: true
|
230
225
|
|
231
|
-
|
232
|
-
Description: '
|
226
|
+
LineLength:
|
227
|
+
Description: 'Limit lines to 79 characters.'
|
233
228
|
Enabled: true
|
234
229
|
|
235
|
-
|
236
|
-
Description: '
|
230
|
+
LeadingCommentSpace:
|
231
|
+
Description: 'Comments should start with a space.'
|
237
232
|
Enabled: true
|
238
233
|
|
239
|
-
|
234
|
+
Loop:
|
240
235
|
Description: >
|
241
|
-
|
242
|
-
|
236
|
+
Use Kernel#loop with break rather than begin/end/until or
|
237
|
+
begin/end/while for post-loop tests.
|
243
238
|
Enabled: true
|
244
239
|
|
245
|
-
|
246
|
-
Description:
|
240
|
+
MethodCallParentheses:
|
241
|
+
Description: 'Do not use parentheses for method calls with no arguments.'
|
247
242
|
Enabled: true
|
248
243
|
|
249
|
-
|
250
|
-
Description: '
|
244
|
+
MethodLength:
|
245
|
+
Description: 'Avoid methods longer than 10 lines of code.'
|
251
246
|
Enabled: true
|
252
247
|
|
253
|
-
|
254
|
-
Description: 'Use
|
248
|
+
MethodName:
|
249
|
+
Description: 'Use the configured style when naming methods.'
|
255
250
|
Enabled: true
|
256
251
|
|
257
|
-
|
258
|
-
Description: '
|
252
|
+
ModuleFunction:
|
253
|
+
Description: 'Checks for usage of `extend self` in modules.'
|
254
|
+
Enabled: true
|
255
|
+
|
256
|
+
MultilineBlockChain:
|
257
|
+
Description: 'Avoid multi-line chains of blocks.'
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
MultilineIfThen:
|
261
|
+
Description: 'Never use then for multi-line if/unless.'
|
262
|
+
Enabled: true
|
263
|
+
|
264
|
+
MultilineTernaryOperator:
|
265
|
+
Description: >
|
266
|
+
Avoid multi-line ?: (the ternary operator);
|
267
|
+
use if/unless instead.
|
268
|
+
Enabled: true
|
269
|
+
|
270
|
+
NestedTernaryOperator:
|
271
|
+
Description: 'Use one expression per branch in a ternary operator.'
|
272
|
+
Enabled: true
|
273
|
+
|
274
|
+
NilComparison:
|
275
|
+
Description: 'Prefer x.nil? to x == nil.'
|
259
276
|
Enabled: true
|
260
277
|
|
261
278
|
Not:
|
262
279
|
Description: 'Use ! instead of not.'
|
263
280
|
Enabled: true
|
264
281
|
|
265
|
-
|
266
|
-
Description:
|
267
|
-
|
268
|
-
|
269
|
-
EnsureReturn:
|
270
|
-
Description: 'Never use return in an ensure block.'
|
282
|
+
NumericLiterals:
|
283
|
+
Description: >
|
284
|
+
Add underscores to large numeric literals to improve their
|
285
|
+
readability.
|
271
286
|
Enabled: true
|
272
287
|
|
273
|
-
|
274
|
-
Description:
|
288
|
+
OneLineConditional:
|
289
|
+
Description: >
|
290
|
+
Favor the ternary operator(?:) over
|
291
|
+
if/then/else/end constructs.
|
275
292
|
Enabled: true
|
276
293
|
|
277
|
-
|
278
|
-
Description: '
|
294
|
+
OpMethod:
|
295
|
+
Description: 'When defining binary operators, name the argument other.'
|
279
296
|
Enabled: true
|
280
297
|
|
281
|
-
|
282
|
-
Description: '
|
298
|
+
ParameterLists:
|
299
|
+
Description: 'Avoid parameter lists longer than three or four parameters.'
|
283
300
|
Enabled: true
|
284
301
|
|
285
|
-
|
286
|
-
Description:
|
302
|
+
ParenthesesAroundCondition:
|
303
|
+
Description: >
|
304
|
+
Don't use parentheses around the condition of an
|
305
|
+
if/unless/while.
|
287
306
|
Enabled: true
|
288
307
|
|
289
|
-
|
290
|
-
Description: 'Avoid
|
308
|
+
PerlBackrefs:
|
309
|
+
Description: 'Avoid Perl-style regex back references.'
|
291
310
|
Enabled: true
|
292
311
|
|
293
|
-
|
294
|
-
Description: '
|
312
|
+
Proc:
|
313
|
+
Description: 'Use proc instead of Proc.new.'
|
295
314
|
Enabled: true
|
296
315
|
|
297
|
-
|
298
|
-
Description: '
|
316
|
+
RaiseArgs:
|
317
|
+
Description: 'Checks the arguments passed to raise/fail.'
|
299
318
|
Enabled: true
|
300
319
|
|
301
320
|
ReduceArguments:
|
302
321
|
Description: 'Name reduce arguments |a, e| (accumulator, element)'
|
303
322
|
Enabled: true
|
304
323
|
|
305
|
-
|
306
|
-
Description:
|
307
|
-
Use %r for regular expressions matching more than
|
308
|
-
`MaxSlashes` '/' characters.
|
309
|
-
Use %r only for regular expressions matching more than
|
310
|
-
`MaxSlashes` '/' character.
|
311
|
-
Enabled: true
|
312
|
-
|
313
|
-
ClassMethods:
|
314
|
-
Description: 'Use self when defining module/class methods.'
|
315
|
-
Enabled: true
|
316
|
-
|
317
|
-
SingleLineMethods:
|
318
|
-
Description: 'Avoid single-line methods.'
|
324
|
+
RedundantBegin:
|
325
|
+
Description: "Don't use begin blocks when they are not needed."
|
319
326
|
Enabled: true
|
320
327
|
|
321
|
-
|
322
|
-
Description:
|
328
|
+
RedundantException:
|
329
|
+
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
323
330
|
Enabled: true
|
324
331
|
|
325
|
-
|
326
|
-
Description: "
|
332
|
+
RedundantSelf:
|
333
|
+
Description: "Don't use self where it's not needed."
|
327
334
|
Enabled: true
|
328
335
|
|
329
|
-
|
330
|
-
Description: '
|
336
|
+
RedundantReturn:
|
337
|
+
Description: "Don't use return where it's not required."
|
331
338
|
Enabled: true
|
332
339
|
|
333
|
-
|
334
|
-
Description:
|
340
|
+
RegexpLiteral:
|
341
|
+
Description: >
|
342
|
+
Use %r for regular expressions matching more than
|
343
|
+
`MaxSlashes` '/' characters.
|
344
|
+
Use %r only for regular expressions matching more than
|
345
|
+
`MaxSlashes` '/' character.
|
335
346
|
Enabled: true
|
336
347
|
|
337
|
-
|
338
|
-
Description: '
|
348
|
+
RescueModifier:
|
349
|
+
Description: 'Avoid using rescue in its modifier form.'
|
339
350
|
Enabled: true
|
340
351
|
|
341
|
-
|
342
|
-
Description: '
|
352
|
+
RescueException:
|
353
|
+
Description: 'Avoid rescuing the Exception class.'
|
343
354
|
Enabled: true
|
344
355
|
|
345
|
-
|
346
|
-
Description: '
|
356
|
+
Semicolon:
|
357
|
+
Description: "Don't use semicolons to terminate expressions."
|
347
358
|
Enabled: true
|
348
359
|
|
349
|
-
|
350
|
-
Description: '
|
360
|
+
SignalException:
|
361
|
+
Description: 'Checks for proper usage of fail and raise.'
|
351
362
|
Enabled: true
|
352
363
|
|
353
|
-
|
354
|
-
Description: '
|
364
|
+
SingleLineMethods:
|
365
|
+
Description: 'Avoid single-line methods.'
|
355
366
|
Enabled: true
|
356
367
|
|
357
|
-
|
358
|
-
Description:
|
359
|
-
Indent private/protected as deep as defs and keep blank
|
360
|
-
lines around them.
|
368
|
+
SpaceAroundOperators:
|
369
|
+
Description: 'Use spaces around operators.'
|
361
370
|
Enabled: true
|
362
371
|
|
363
|
-
|
372
|
+
SpaceAroundBlockBraces:
|
364
373
|
Description: >
|
365
|
-
|
366
|
-
|
374
|
+
Checks that block braces have or don't have surrounding space.
|
375
|
+
For blocks taking parameters, checks that the left brace has
|
376
|
+
or doesn't have trailing space.
|
367
377
|
Enabled: true
|
368
378
|
|
369
|
-
|
370
|
-
Description: '
|
379
|
+
SpaceInsideParens:
|
380
|
+
Description: 'No spaces after ( or before ).'
|
371
381
|
Enabled: true
|
372
382
|
|
373
|
-
|
374
|
-
Description: '
|
383
|
+
SpaceInsideBrackets:
|
384
|
+
Description: 'No spaces after [ or before ].'
|
375
385
|
Enabled: true
|
376
386
|
|
377
|
-
|
378
|
-
Description: '
|
387
|
+
SpaceAfterComma:
|
388
|
+
Description: 'Use spaces after commas.'
|
379
389
|
Enabled: true
|
380
390
|
|
381
|
-
|
382
|
-
Description:
|
391
|
+
SpaceAfterMethodName:
|
392
|
+
Description: >
|
393
|
+
Never put a space between a method name and the opening
|
394
|
+
parenthesis.
|
383
395
|
Enabled: true
|
384
396
|
|
385
|
-
|
386
|
-
Description: '
|
397
|
+
SpaceAfterSemicolon:
|
398
|
+
Description: 'Use spaces after semicolons.'
|
387
399
|
Enabled: true
|
388
400
|
|
389
|
-
|
390
|
-
Description: '
|
401
|
+
SpaceAfterColon:
|
402
|
+
Description: 'Use spaces after colons.'
|
391
403
|
Enabled: true
|
392
404
|
|
393
|
-
|
394
|
-
Description: '
|
405
|
+
SpaceAfterControlKeyword:
|
406
|
+
Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
|
395
407
|
Enabled: true
|
396
408
|
|
397
|
-
|
398
|
-
Description:
|
409
|
+
SpaceAroundEqualsInParameterDefault:
|
410
|
+
Description: >
|
411
|
+
Use spaces around the = operator when assigning default
|
412
|
+
values in def params.
|
399
413
|
Enabled: true
|
400
414
|
|
401
|
-
|
402
|
-
Description:
|
415
|
+
SpaceBeforeModifierKeyword:
|
416
|
+
Description: 'Put a space before the modifier keyword.'
|
403
417
|
Enabled: true
|
404
418
|
|
405
|
-
|
406
|
-
Description: "
|
419
|
+
SpaceInsideHashLiteralBraces:
|
420
|
+
Description: "Use spaces inside hash literal braces - or don't."
|
407
421
|
Enabled: true
|
408
422
|
|
409
|
-
|
410
|
-
Description:
|
423
|
+
SpecialGlobalVars:
|
424
|
+
Description: 'Avoid Perl-style global variables.'
|
411
425
|
Enabled: true
|
412
426
|
|
413
|
-
|
414
|
-
Description: 'Checks
|
427
|
+
StringLiterals:
|
428
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
415
429
|
Enabled: true
|
416
430
|
|
417
|
-
|
418
|
-
Description: '
|
431
|
+
SymbolName:
|
432
|
+
Description: 'Symbol literals should use snake_case.'
|
419
433
|
Enabled: true
|
420
434
|
|
421
|
-
|
422
|
-
Description: '
|
435
|
+
Tab:
|
436
|
+
Description: 'No hard tabs.'
|
423
437
|
Enabled: true
|
424
438
|
|
425
|
-
|
426
|
-
Description: 'Checks for
|
439
|
+
TrailingBlankLines:
|
440
|
+
Description: 'Checks for superflous trailing blank lines.'
|
427
441
|
Enabled: true
|
428
442
|
|
429
|
-
|
430
|
-
Description: '
|
443
|
+
TrailingWhitespace:
|
444
|
+
Description: 'Avoid trailing whitespace.'
|
431
445
|
Enabled: true
|
432
446
|
|
433
|
-
|
434
|
-
Description: '
|
447
|
+
TrivialAccessors:
|
448
|
+
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
435
449
|
Enabled: true
|
436
450
|
|
437
|
-
|
438
|
-
Description:
|
451
|
+
UnlessElse:
|
452
|
+
Description: >
|
453
|
+
Never use unless with else. Rewrite these with the positive
|
454
|
+
case first.
|
439
455
|
Enabled: true
|
440
456
|
|
441
|
-
|
457
|
+
VariableInterpolation:
|
442
458
|
Description: >
|
443
|
-
|
444
|
-
|
459
|
+
Don't interpolate global, instance and class variables
|
460
|
+
directly in strings.
|
445
461
|
Enabled: true
|
446
462
|
|
447
|
-
|
448
|
-
Description: '
|
463
|
+
VariableName:
|
464
|
+
Description: 'Use the configured style when naming variables.'
|
449
465
|
Enabled: true
|
450
466
|
|
451
|
-
|
452
|
-
Description: '
|
467
|
+
WhenThen:
|
468
|
+
Description: 'Use when x then ... for one-line cases.'
|
453
469
|
Enabled: true
|
454
470
|
|
455
|
-
|
471
|
+
WhileUntilModifier:
|
456
472
|
Description: >
|
457
|
-
|
458
|
-
|
473
|
+
Favor modifier while/until usage when you have a
|
474
|
+
single-line body.
|
459
475
|
Enabled: true
|
460
476
|
|
461
|
-
|
462
|
-
Description:
|
463
|
-
Align the elements of an array literal if they span more than
|
464
|
-
one line.
|
477
|
+
WordArray:
|
478
|
+
Description: 'Use %w or %W for arrays of words.'
|
465
479
|
Enabled: true
|
466
480
|
|
467
|
-
|
468
|
-
Description: '
|
481
|
+
WhileUntilDo:
|
482
|
+
Description: 'Checks for redundant do after while or until.'
|
469
483
|
Enabled: true
|
470
484
|
|
471
485
|
#################### Lint ################################
|
@@ -475,26 +489,26 @@ AssignmentInCondition:
|
|
475
489
|
Description: "Don't use assignment in conditions."
|
476
490
|
Enabled: true
|
477
491
|
|
478
|
-
EndAlignment:
|
479
|
-
Description: 'Align ends correctly.'
|
480
|
-
Enabled: true
|
481
|
-
|
482
492
|
BlockAlignment:
|
483
493
|
Description: 'Align block ends correctly.'
|
484
494
|
Enabled: true
|
485
495
|
|
486
|
-
|
487
|
-
Description:
|
496
|
+
CommentAnnotation:
|
497
|
+
Description: >
|
498
|
+
Checks formatting of special comments
|
499
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
488
500
|
Enabled: true
|
489
501
|
|
490
|
-
|
491
|
-
Description: '
|
502
|
+
Debugger:
|
503
|
+
Description: 'Check for debugger calls.'
|
492
504
|
Enabled: true
|
493
505
|
|
494
|
-
|
495
|
-
Description:
|
496
|
-
|
497
|
-
|
506
|
+
EmptyEnsure:
|
507
|
+
Description: 'Checks for empty ensure block.'
|
508
|
+
Enabled: true
|
509
|
+
|
510
|
+
EndAlignment:
|
511
|
+
Description: 'Align ends correctly.'
|
498
512
|
Enabled: true
|
499
513
|
|
500
514
|
EndInMethod:
|
@@ -505,14 +519,24 @@ LiteralInCondition:
|
|
505
519
|
Description: 'Checks of literals used in conditions.'
|
506
520
|
Enabled: true
|
507
521
|
|
508
|
-
|
509
|
-
Description:
|
522
|
+
ParenthesesAsGroupedExpression:
|
523
|
+
Description: >
|
524
|
+
Checks for method calls with a space before the opening
|
525
|
+
parenthesis.
|
510
526
|
Enabled: true
|
511
527
|
|
512
|
-
|
528
|
+
ShadowingOuterLocalVariable:
|
513
529
|
Description: >
|
514
|
-
|
515
|
-
|
530
|
+
Do not use the same name as outer local variable
|
531
|
+
for block arguments or block local variables.
|
532
|
+
Enabled: true
|
533
|
+
|
534
|
+
Syntax:
|
535
|
+
Description: 'Reports several basic syntax warnings and invalid syntaxes.'
|
536
|
+
Enabled: true
|
537
|
+
|
538
|
+
UnreachableCode:
|
539
|
+
Description: 'Unreachable code.'
|
516
540
|
Enabled: true
|
517
541
|
|
518
542
|
UselessAssignment:
|
@@ -527,10 +551,8 @@ UselessComparison:
|
|
527
551
|
Description: 'Checks for comparison of something with itself.'
|
528
552
|
Enabled: true
|
529
553
|
|
530
|
-
|
531
|
-
Description:
|
532
|
-
Checks for method calls with a space before the opening
|
533
|
-
parenthesis.
|
554
|
+
Void:
|
555
|
+
Description: 'Possible use of operator/literal/variable in void context.'
|
534
556
|
Enabled: true
|
535
557
|
|
536
558
|
##################### Rails ##################################
|