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.

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