rubocop 0.15.0 → 0.16.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 (221) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -10
  3. data/.travis.yml +2 -1
  4. data/CHANGELOG.md +55 -0
  5. data/Gemfile +3 -0
  6. data/README.md +37 -0
  7. data/config/default.yml +99 -16
  8. data/config/enabled.yml +28 -16
  9. data/lib/rubocop.rb +16 -2
  10. data/lib/rubocop/cli.rb +10 -91
  11. data/lib/rubocop/config.rb +4 -1
  12. data/lib/rubocop/config_loader.rb +18 -10
  13. data/lib/rubocop/config_store.rb +3 -2
  14. data/lib/rubocop/cop/check_assignment.rb +43 -0
  15. data/lib/rubocop/cop/check_methods.rb +18 -0
  16. data/lib/rubocop/cop/commissioner.rb +15 -3
  17. data/lib/rubocop/cop/cop.rb +51 -43
  18. data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
  19. data/lib/rubocop/cop/lint/block_alignment.rb +7 -7
  20. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  21. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  22. data/lib/rubocop/cop/lint/end_alignment.rb +56 -19
  23. data/lib/rubocop/cop/lint/end_in_method.rb +4 -10
  24. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  25. data/lib/rubocop/cop/lint/eval.rb +1 -1
  26. data/lib/rubocop/cop/lint/handle_exceptions.rb +1 -1
  27. data/lib/rubocop/cop/lint/literal_in_condition.rb +2 -2
  28. data/lib/rubocop/cop/lint/loop.rb +1 -1
  29. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
  30. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  31. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +1 -1
  32. data/lib/rubocop/cop/lint/syntax.rb +1 -1
  33. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  34. data/lib/rubocop/cop/lint/useless_assignment.rb +2 -2
  35. data/lib/rubocop/cop/lint/useless_comparison.rb +1 -1
  36. data/lib/rubocop/cop/lint/useless_setter_call.rb +6 -16
  37. data/lib/rubocop/cop/lint/void.rb +5 -5
  38. data/lib/rubocop/cop/rails/default_scope.rb +33 -0
  39. data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +2 -4
  40. data/lib/rubocop/cop/rails/output.rb +1 -1
  41. data/lib/rubocop/cop/rails/read_attribute.rb +1 -1
  42. data/lib/rubocop/cop/rails/validation.rb +1 -1
  43. data/lib/rubocop/cop/style/access_modifier_indentation.rb +31 -16
  44. data/lib/rubocop/cop/style/accessor_method_name.rb +53 -0
  45. data/lib/rubocop/cop/style/alias.rb +14 -2
  46. data/lib/rubocop/cop/style/align_hash.rb +15 -16
  47. data/lib/rubocop/cop/style/and_or.rb +3 -3
  48. data/lib/rubocop/cop/style/array_syntax.rb +22 -0
  49. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  50. data/lib/rubocop/cop/style/ascii_identifiers.rb +1 -3
  51. data/lib/rubocop/cop/style/attr.rb +1 -1
  52. data/lib/rubocop/cop/style/autocorrect_alignment.rb +13 -12
  53. data/lib/rubocop/cop/style/begin_block.rb +1 -1
  54. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  55. data/lib/rubocop/cop/style/block_nesting.rb +5 -1
  56. data/lib/rubocop/cop/style/blocks.rb +4 -4
  57. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +48 -22
  58. data/lib/rubocop/cop/style/case_equality.rb +1 -1
  59. data/lib/rubocop/cop/style/case_indentation.rb +25 -6
  60. data/lib/rubocop/cop/style/class_and_module_camel_case.rb +1 -1
  61. data/lib/rubocop/cop/style/class_length.rb +7 -19
  62. data/lib/rubocop/cop/style/class_methods.rb +1 -1
  63. data/lib/rubocop/cop/style/class_vars.rb +1 -1
  64. data/lib/rubocop/cop/style/code_length.rb +35 -0
  65. data/lib/rubocop/cop/style/collection_methods.rb +1 -1
  66. data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
  67. data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
  68. data/lib/rubocop/cop/style/configurable_enforced_style.rb +51 -0
  69. data/lib/rubocop/cop/style/configurable_max.rb +17 -0
  70. data/lib/rubocop/cop/style/configurable_naming.rb +4 -10
  71. data/lib/rubocop/cop/style/constant_name.rb +5 -3
  72. data/lib/rubocop/cop/style/cyclomatic_complexity.rb +8 -13
  73. data/lib/rubocop/cop/style/def_parentheses.rb +4 -43
  74. data/lib/rubocop/cop/style/documentation.rb +1 -1
  75. data/lib/rubocop/cop/style/dot_position.rb +6 -2
  76. data/lib/rubocop/cop/style/empty_line_between_defs.rb +1 -1
  77. data/lib/rubocop/cop/style/empty_lines.rb +5 -1
  78. data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +1 -1
  79. data/lib/rubocop/cop/style/empty_lines_around_body.rb +28 -13
  80. data/lib/rubocop/cop/style/empty_literal.rb +3 -3
  81. data/lib/rubocop/cop/style/encoding.rb +5 -5
  82. data/lib/rubocop/cop/style/end_block.rb +1 -1
  83. data/lib/rubocop/cop/style/end_of_line.rb +8 -6
  84. data/lib/rubocop/cop/style/even_odd.rb +6 -6
  85. data/lib/rubocop/cop/style/favor_join.rb +1 -1
  86. data/lib/rubocop/cop/style/favor_modifier.rb +20 -34
  87. data/lib/rubocop/cop/style/favor_sprintf.rb +1 -1
  88. data/lib/rubocop/cop/style/favor_unless_over_negated_if.rb +1 -1
  89. data/lib/rubocop/cop/style/final_newline.rb +1 -1
  90. data/lib/rubocop/cop/style/flip_flop.rb +20 -0
  91. data/lib/rubocop/cop/style/for.rb +34 -3
  92. data/lib/rubocop/cop/style/global_vars.rb +1 -1
  93. data/lib/rubocop/cop/style/hash_methods.rb +3 -3
  94. data/lib/rubocop/cop/style/hash_syntax.rb +8 -11
  95. data/lib/rubocop/cop/style/if_node.rb +25 -0
  96. data/lib/rubocop/cop/style/if_then_else.rb +1 -1
  97. data/lib/rubocop/cop/style/indentation_width.rb +77 -43
  98. data/lib/rubocop/cop/style/lambda.rb +2 -2
  99. data/lib/rubocop/cop/style/lambda_call.rb +4 -12
  100. data/lib/rubocop/cop/style/leading_comment_space.rb +1 -1
  101. data/lib/rubocop/cop/style/line_length.rb +9 -5
  102. data/lib/rubocop/cop/style/method_call_parentheses.rb +1 -1
  103. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +1 -1
  104. data/lib/rubocop/cop/style/method_def_parentheses.rb +52 -0
  105. data/lib/rubocop/cop/style/method_length.rb +9 -22
  106. data/lib/rubocop/cop/style/module_function.rb +1 -1
  107. data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
  108. data/lib/rubocop/cop/style/multiline_if_then.rb +11 -1
  109. data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
  110. data/lib/rubocop/cop/style/not.rb +1 -1
  111. data/lib/rubocop/cop/style/numeric_literals.rb +2 -2
  112. data/lib/rubocop/cop/style/op_method.rb +2 -2
  113. data/lib/rubocop/cop/style/parameter_lists.rb +2 -2
  114. data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -1
  115. data/lib/rubocop/cop/style/perl_backrefs.rb +1 -1
  116. data/lib/rubocop/cop/style/predicate_name.rb +54 -0
  117. data/lib/rubocop/cop/style/proc.rb +1 -1
  118. data/lib/rubocop/cop/style/raise_args.rb +4 -10
  119. data/lib/rubocop/cop/style/redundant_begin.rb +5 -15
  120. data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
  121. data/lib/rubocop/cop/style/redundant_return.rb +9 -19
  122. data/lib/rubocop/cop/style/redundant_self.rb +8 -3
  123. data/lib/rubocop/cop/style/regexp_literal.rb +4 -3
  124. data/lib/rubocop/cop/style/rescue_modifier.rb +9 -17
  125. data/lib/rubocop/cop/style/semicolon.rb +20 -22
  126. data/lib/rubocop/cop/style/signal_exception.rb +10 -17
  127. data/lib/rubocop/cop/style/single_line_block_params.rb +62 -0
  128. data/lib/rubocop/cop/style/single_line_methods.rb +5 -15
  129. data/lib/rubocop/cop/style/space_after_comma_etc.rb +1 -3
  130. data/lib/rubocop/cop/style/space_after_control_keyword.rb +1 -1
  131. data/lib/rubocop/cop/style/space_after_method_name.rb +4 -12
  132. data/lib/rubocop/cop/style/space_after_not.rb +1 -1
  133. data/lib/rubocop/cop/style/space_around_block_braces.rb +105 -94
  134. data/lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb +1 -1
  135. data/lib/rubocop/cop/style/space_around_operators.rb +38 -123
  136. data/lib/rubocop/cop/style/space_before_modifier_keyword.rb +1 -1
  137. data/lib/rubocop/cop/style/space_inside.rb +1 -3
  138. data/lib/rubocop/cop/style/space_inside_brackets.rb +0 -2
  139. data/lib/rubocop/cop/style/space_inside_hash_literal_braces.rb +5 -5
  140. data/lib/rubocop/cop/style/space_inside_parens.rb +0 -2
  141. data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
  142. data/lib/rubocop/cop/style/string_help.rb +1 -1
  143. data/lib/rubocop/cop/style/string_literals.rb +4 -11
  144. data/lib/rubocop/cop/style/surrounding_space.rb +0 -2
  145. data/lib/rubocop/cop/style/symbol_array.rb +3 -10
  146. data/lib/rubocop/cop/style/tab.rb +5 -5
  147. data/lib/rubocop/cop/style/ternary_operator.rb +2 -2
  148. data/lib/rubocop/cop/style/trailing_blank_lines.rb +1 -1
  149. data/lib/rubocop/cop/style/trailing_whitespace.rb +1 -1
  150. data/lib/rubocop/cop/style/trivial_accessors.rb +4 -14
  151. data/lib/rubocop/cop/style/unless_else.rb +1 -1
  152. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
  153. data/lib/rubocop/cop/style/when_then.rb +3 -1
  154. data/lib/rubocop/cop/style/while_until_do.rb +2 -2
  155. data/lib/rubocop/cop/style/word_array.rb +4 -10
  156. data/lib/rubocop/cop/util.rb +85 -12
  157. data/lib/rubocop/cop/variable_inspector.rb +4 -2
  158. data/lib/rubocop/file_inspector.rb +98 -0
  159. data/lib/rubocop/formatter/base_formatter.rb +2 -2
  160. data/lib/rubocop/formatter/disabled_config_formatter.rb +10 -2
  161. data/lib/rubocop/rake_task.rb +5 -1
  162. data/lib/rubocop/target_finder.rb +3 -3
  163. data/lib/rubocop/version.rb +1 -1
  164. data/rubocop-todo.yml +12 -0
  165. data/rubocop.gemspec +1 -1
  166. data/spec/isolated_environment_spec.rb +24 -0
  167. data/spec/rubocop/cli_spec.rb +120 -27
  168. data/spec/rubocop/config_loader_spec.rb +25 -11
  169. data/spec/rubocop/config_spec.rb +25 -9
  170. data/spec/rubocop/config_store_spec.rb +1 -1
  171. data/spec/rubocop/cop/cop_spec.rb +22 -3
  172. data/spec/rubocop/cop/lint/block_alignment_spec.rb +4 -4
  173. data/spec/rubocop/cop/lint/end_alignment_spec.rb +79 -47
  174. data/spec/rubocop/cop/lint/syntax_spec.rb +4 -3
  175. data/spec/rubocop/cop/rails/default_scope_spec.rb +31 -0
  176. data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +37 -2
  177. data/spec/rubocop/cop/style/accessor_method_name_spec.rb +81 -0
  178. data/spec/rubocop/cop/style/alias_spec.rb +10 -0
  179. data/spec/rubocop/cop/style/align_parameters_spec.rb +3 -3
  180. data/spec/rubocop/cop/style/block_nesting_spec.rb +4 -1
  181. data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +83 -0
  182. data/spec/rubocop/cop/style/case_indentation_spec.rb +227 -71
  183. data/spec/rubocop/cop/style/class_length_spec.rb +2 -0
  184. data/spec/rubocop/cop/style/constant_name_spec.rb +6 -0
  185. data/spec/rubocop/cop/style/cyclomatic_complexity_spec.rb +1 -0
  186. data/spec/rubocop/cop/style/documentation_spec.rb +12 -0
  187. data/spec/rubocop/cop/style/dot_position_spec.rb +10 -0
  188. data/spec/rubocop/cop/style/empty_lines_around_body_spec.rb +22 -0
  189. data/spec/rubocop/cop/style/empty_lines_spec.rb +6 -0
  190. data/spec/rubocop/cop/style/end_of_line_spec.rb +17 -0
  191. data/spec/rubocop/cop/style/favor_modifier_spec.rb +15 -0
  192. data/spec/rubocop/cop/style/flip_flop_spec.rb +23 -0
  193. data/spec/rubocop/cop/style/for_spec.rb +96 -18
  194. data/spec/rubocop/cop/style/hash_syntax_spec.rb +8 -2
  195. data/spec/rubocop/cop/style/indentation_width_spec.rb +185 -20
  196. data/spec/rubocop/cop/style/line_length_spec.rb +1 -0
  197. data/spec/rubocop/cop/style/method_def_parentheses_spec.rb +72 -0
  198. data/spec/rubocop/cop/style/multiline_if_then_spec.rb +16 -0
  199. data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +34 -3
  200. data/spec/rubocop/cop/style/predicate_name_spec.rb +25 -0
  201. data/spec/rubocop/cop/style/redundant_self_spec.rb +15 -0
  202. data/spec/rubocop/cop/style/regexp_literal_spec.rb +5 -0
  203. data/spec/rubocop/cop/style/semicolon_spec.rb +16 -16
  204. data/spec/rubocop/cop/style/{reduce_arguments_spec.rb → single_line_block_params_spec.rb} +12 -4
  205. data/spec/rubocop/cop/style/space_around_block_braces_spec.rb +58 -8
  206. data/spec/rubocop/cop/style/space_around_operators_spec.rb +71 -0
  207. data/spec/rubocop/cop/style/string_literals_spec.rb +18 -0
  208. data/spec/rubocop/file_inspector_spec.rb +78 -0
  209. data/spec/rubocop/formatter/clang_style_formatter_spec.rb +7 -7
  210. data/spec/rubocop/formatter/emacs_style_formatter_spec.rb +3 -3
  211. data/spec/rubocop/formatter/file_list_formatter_spec.rb +2 -2
  212. data/spec/rubocop/processed_source_spec.rb +7 -3
  213. data/spec/rubocop/token_spec.rb +1 -1
  214. data/spec/spec_helper.rb +3 -2
  215. data/spec/support/isolated_environment.rb +7 -0
  216. data/spec/support/shared_context.rb +5 -1
  217. metadata +35 -12
  218. data/lib/rubocop/cop/style/reduce_arguments.rb +0 -34
  219. data/lib/rubocop/cop/style/symbol_name.rb +0 -45
  220. data/spec/rubocop/cop/style/def_without_parentheses_spec.rb +0 -33
  221. data/spec/rubocop/cop/style/symbol_name_spec.rb +0 -138
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4147b39dd3f54752faac528951caeb3ccc5492b5
4
- data.tar.gz: 5f2818160c6acc8a895a30094b123d795695122d
3
+ metadata.gz: e1d53b4bf428418ce94f9957624298881e744d48
4
+ data.tar.gz: a8da381882375f2f62d9209a0c8b27bfae1647fe
5
5
  SHA512:
6
- metadata.gz: e2ff5ec56e71894fea1e05c25ec54fc1bcb942bf97309a7f1724723ad484abc17dced861d3c3d82018d09c189746d95115e210aaa5666b6e9262202dd48dc4c9
7
- data.tar.gz: 9039f3082e26b30e4c379ab0ee7263b78eed367dd46ab7170d71049ef621a79b3561e28e0a10d199e795cda699e64e21dd15e28442e56797a19db17f39dd78e9
6
+ metadata.gz: e77ffc73a8976e35a4fe77c8c95c84b9f15e46e83b43f559808736c236b6dbbdf07467c627e3fcce1f3ff730aa75b03222482d00d3da0122efeb3e163fe1fdd9
7
+ data.tar.gz: 100c16f188ae13fdbcb70393b966b559a839325a6c0531c2628385910567d6383059d8c049e2fff43857f32f16b319cd15994f3adf13704877daf239f5e62b93
@@ -1,12 +1,3 @@
1
1
  # This is the configuration used to check the rubocop source code.
2
2
 
3
- inherit_from: config/default.yml
4
-
5
- MethodLength:
6
- Max: 22
7
-
8
- ClassLength:
9
- Max: 140
10
-
11
- CyclomaticComplexity:
12
- Max: 12
3
+ inherit_from: rubocop-todo.yml
@@ -2,8 +2,9 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0-rc1
5
6
  - jruby-19mode
6
- - rbx-19mode
7
+ - rbx-2.1.1
7
8
  script:
8
9
  - bundle exec rspec
9
10
  - bundle exec rubocop
@@ -2,6 +2,52 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.16.0 (25/12/2013)
6
+
7
+ ### New features
8
+
9
+ * [#612](https://github.com/bbatsov/rubocop/pull/612): `BracesAroundHashParameters` cop does auto-correction. ([@dblock][])
10
+ * [#614](https://github.com/bbatsov/rubocop/pull/614): `ParenthesesAroundCondition` cop does auto-correction. ([@dblock][])
11
+ * [#624](https://github.com/bbatsov/rubocop/pull/624): `EmptyLines` cop does auto-correction. ([@dblock][])
12
+ * New Rails cop `DefaultScope` ensures `default_scope` is called properly with a block argument. ([@bbatsov][])
13
+ * All cops now support the `Include` param, which specifies the files on which they should operate. ([@bbatsov][])
14
+ * All cops now support the `Exclude` param, which specifies the files on which they should not operate. ([@bbatsov][])
15
+ * [#631](https://github.com/bbatsov/rubocop/issues/631): `IndentationWidth` cop now detects inconsistent indentation between lines that should have the same indentation. ([@jonas054][])
16
+ * [#649](https://github.com/bbatsov/rubocop/pull/649): `EmptyLinesAroundBody` cop does auto-correction. ([@dblock][])
17
+ * [#657](https://github.com/bbatsov/rubocop/pull/657): `Alias` cop does auto-correction. ([@dblock][])
18
+ * Rake task now support setting formatters. ([@pmenglund][])
19
+ * [#653](https://github.com/bbatsov/rubocop/issues/653): `CaseIndentation` cop is now configurable with parameters `IndentWhenRelativeTo` and `IndentOneStep`. ([@jonas054][])
20
+ * [#654](https://github.com/bbatsov/rubocop/pull/654): `For` cop is now configurable to enforce either `each` (default) or `for`. ([@jonas054][])
21
+ * [#661](https://github.com/bbatsov/rubocop/issue/661): `EndAlignment` cop is now configurable for alignment with `keyword` (default) or `variable`. ([@jonas054][])
22
+ * Allow to overwrite the severity of a cop with the new `Severity` param. ([@codez][])
23
+ * New cop `FlipFlop` checks for flip flops. ([@agrimm][])
24
+ * [#577](https://github.com/bbatsov/rubocop/issues/577): Introduced `MethodDefParentheses` to allow for for requiring either parentheses or no parentheses in method definitions. Replaces `DefWithoutParentheses`. ([@skanev][])
25
+ * [#693](https://github.com/bbatsov/rubocop/pull/693): Generation of parameter values (i.e., not only `Enabled: false`) in `rubocop-todo.yml` by the `--auto-gen-config` option is now supported for some cops. ([@jonas054][])
26
+ * New cop `AccessorMethodName` checks accessor method names for non-idiomatic names like `get_attribute` and `set_attribute`. ([@bbatsov][])
27
+ * New cop `PredicateName` checks the names of predicate methods for non-idiomatic names like `is_something`, `has_something`, etc. ([@bbatsov][])
28
+
29
+ ### Changes
30
+
31
+ * Removed `SymbolNames` as it was generating way too many false positives. ([@bbatsov][])
32
+ * Renamed `ReduceArguments` to `SingleLineBlockParams` and made it configurable. ([@bbatsov][])
33
+
34
+ ### Bugs fixed
35
+
36
+ * Handle properly heredocs in `StringLiterals` cop. ([@bbatsov][])
37
+ * Fix `SpaceAroundOperators` to not report missing space around operator for `def self.method *args`. ([@jonas054][])
38
+ * Properly handle `['AllCops']['Includes']` and `['AllCops']['Excludes']` when passing config via `-c`. ([@fancyremarker][], [@codez][])
39
+ * [#611](https://github.com/bbatsov/rubocop/pull/611): Fix crash when loading an empty config file ([@sinisterchipmunk][])
40
+ * Fix `DotPosition` cop with `trailing` style for method calls on same line. ([@vonTronje][])
41
+ * [#627](https://github.com/bbatsov/rubocop/pull/627): Fix counting of slashes in complicated regexps in `RegexpLiteral` cop. ([@jonas054][])
42
+ * [#638](https://github.com/bbatsov/rubocop/issues/638): Fix bug in auto-correct that changes `each{ |x|` to `each d o |x|`. ([@jonas054][])
43
+ * [#418](https://github.com/bbatsov/rubocop/issues/418): Stop searching for configuration files above the work directory of the isolated environment when running specs. ([@jonas054][])
44
+ * Fix error on implicit match conditionals (e.g. `if /pattern/; end`) in `MultilineIfThen`. ([@agrimm][])
45
+ * [#651](https://github.com/bbatsov/rubocop/issues/651): Handle properly method arguments in `RedundantSelf`. ([@bbatsov][])
46
+ * [#628](https://github.com/bbatsov/rubocop/issues/628): Allow `self.Foo` in `RedundantSelf` cop. ([@chulkilee][])
47
+ * [#668](https://github.com/bbatsov/rubocop/issues/668): Fix crash in `EndOfLine` that occurs when default encoding is `US_ASCII` and an inspected file has non-ascii characters. ([@jonas054][])
48
+ * [#664](https://github.com/bbatsov/rubocop/issues/664): Accept oneline while when condition has local variable assignment. ([@emou][])
49
+ * Fix auto-correct for `MethodDefParentheses` when parentheses are required. ([@skanev][])
50
+
5
51
  ## 0.15.0 (06/11/2013)
6
52
 
7
53
  ### New features
@@ -557,3 +603,12 @@
557
603
  [@nevir]: https://github.com/nevir
558
604
  [@daviddavis]: https://github.com/daviddavis
559
605
  [@sds]: https://github.com/sds
606
+ [@fancyremarker]: https://github.com/fancyremarker
607
+ [@sinisterchipmunk]: https://github.com/sinisterchipmunk
608
+ [@vonTronje]: https://github.com/vonTronje
609
+ [@agrimm]: https://github.com/agrimm
610
+ [@pmenglund]: https://github.com/pmenglund
611
+ [@chulkilee]: https://github.com/chulkilee
612
+ [@codez]: https://github.com/codez
613
+ [@emou]: https://github.com/emou
614
+ [@skanev]: http://github.com/skanev
data/Gemfile CHANGED
@@ -3,5 +3,8 @@ source 'http://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :test do
6
+ gem 'rubysl', platform: :rbx
7
+ gem 'rubinius-developer_tools', platform: :rbx
8
+ gem 'racc', platform: :rbx
6
9
  gem 'coveralls', require: false
7
10
  end
data/README.md CHANGED
@@ -213,6 +213,41 @@ subdirectories. This is different from all other parameters, who
213
213
  follow RuboCop's general principle that configuration for an inspected
214
214
  file is taken from the nearest `.rubocop.yml`, searching upwards.
215
215
 
216
+ Cops can be run only on specific sets of files when that's needed (for
217
+ instance you might want to run some Rails model checks only on files,
218
+ which paths match `app/models/*.rb`). All cops support the
219
+ `Include` param.
220
+
221
+ ```yaml
222
+ DefaultScope:
223
+ Include:
224
+ - app/models
225
+ ```
226
+
227
+ Cops can also exclude only specific sets of files when that's needed (for
228
+ instance you might want to run some cop only on a specific file). All cops support the
229
+ `Exclude` param.
230
+
231
+ ```yaml
232
+ DefaultScope:
233
+ Exclude:
234
+ - app/models/problematic.rb
235
+ ```
236
+
237
+ Specific cops can be disabled by setting `Enabled` to `false` for that specific cop.
238
+
239
+ ```yaml
240
+ LineLength:
241
+ Enabled: false
242
+ ```
243
+
244
+ Cops can customize their severity level. All cops support the `Severity` param.
245
+
246
+ ```yaml
247
+ CyclomaticComplexity:
248
+ Severity: warning
249
+ ```
250
+
216
251
  ### Automatically Generated Configuration
217
252
 
218
253
  If you have a code base with an overwhelming amount of offences, it can be a
@@ -486,6 +521,8 @@ require 'rubocop/rake_task'
486
521
  desc 'Run RuboCop on the lib directory'
487
522
  Rubocop::RakeTask.new(:rubocop) do |task|
488
523
  task.patterns = ['lib/**/*.rb']
524
+ # only show the files with failures
525
+ task.formatters = ['files']
489
526
  # don't abort rake on failure
490
527
  task.fail_on_error = false
491
528
  end
@@ -18,8 +18,10 @@ AllCops:
18
18
 
19
19
  # Indent private/protected/public as deep as method definitions
20
20
  AccessModifierIndentation:
21
- # supported styles are "indent" and "outdent"
22
21
  EnforcedStyle: indent
22
+ SupportedStyles:
23
+ - outdent
24
+ - indent
23
25
 
24
26
  # Align the elements of a hash literal if they span more than one line.
25
27
  AlignHash:
@@ -56,8 +58,16 @@ BlockNesting:
56
58
  Max: 3
57
59
 
58
60
  BracesAroundHashParameters:
59
- # Valid values are: braces, no_braces
60
61
  EnforcedStyle: no_braces
62
+ SupportedStyles:
63
+ - braces
64
+ - no_braces
65
+
66
+ # Indentation of `when`.
67
+ CaseIndentation:
68
+ # Valid values are: case, end
69
+ IndentWhenRelativeTo: case
70
+ IndentOneStep: false
61
71
 
62
72
  ClassLength:
63
73
  CountComments: false # count full line comments?
@@ -95,28 +105,57 @@ EmptyLineBetweenDefs:
95
105
  # need an empty line between them.
96
106
  AllowAdjacentOneLineDefs: false
97
107
 
108
+ # Align ends correctly.
109
+ EndAlignment:
110
+ # Valid valued are: keyword, variable
111
+ # The value `keyword` means that `end` should be aligned with the matching
112
+ # keyword (if, while, etc.).
113
+ # The value `variable` means that in assignments, `end` should be aligned
114
+ # with the start of the variable on the left hand side of `=`. In all other
115
+ # situations, `end` should still be aligned with the keyword.
116
+ AlignWith: keyword
117
+
118
+ # Checks use of for or each in multiline loops.
119
+ For:
120
+ EnforcedStyle: each
121
+ SupportedStyles:
122
+ - for
123
+ - each
124
+
98
125
  # Built-in global variables are allowed by default.
99
126
  GlobalVars:
100
127
  AllowedVariables: []
101
128
 
102
129
  HashSyntax:
103
- # Valid values are: ruby19, hash_rockets
104
130
  EnforcedStyle: ruby19
131
+ SupportedStyles:
132
+ - ruby19
133
+ - hash_rockets
105
134
 
106
135
  LambdaCall:
107
- # Valid values are: call, braces
108
136
  EnforcedStyle: call
137
+ SupportedStyles:
138
+ - call
139
+ - braces
109
140
 
110
141
  LineLength:
111
142
  Max: 79
112
143
 
144
+ MethodDefParentheses:
145
+ EnforcedStyle: require_parentheses
146
+ SupportedStyles:
147
+ - require_parentheses
148
+ - require_no_parentheses
149
+
113
150
  MethodLength:
114
151
  CountComments: false # count full line comments?
115
152
  Max: 10
116
153
 
117
154
  MethodName:
118
- # Valid values are: snake_case, camelCase
119
155
  EnforcedStyle: snake_case
156
+ SupportedStyles:
157
+ - snake_case
158
+ - camelCase
120
159
 
121
160
  NumericLiterals:
122
161
  MinDigits: 5
@@ -136,11 +175,18 @@ ParameterLists:
136
175
  ParenthesesAroundCondition:
137
176
  AllowSafeAssignment: true
138
177
 
178
+ PredicateName:
179
+ NamePrefixBlacklist:
180
+ - is_
181
+ - has_
182
+ - have_
183
+
139
184
  RaiseArgs:
140
- # Valid values are: compact and exploded
141
- # exploded: raise Exception, msg
142
- # compact: raise Exception.new(msg)
143
185
  EnforcedStyle: exploded
186
+ SupportedStyles:
187
+ - compact # raise Exception.new(msg)
188
+ - exploded # raise Exception, msg
189
+
144
190
 
145
191
  RedundantReturn:
146
192
  # When true allows code like `return x, y`.
@@ -154,32 +200,48 @@ Semicolon:
154
200
  AllowAsExpressionSeparator: false
155
201
 
156
202
  SignalException:
157
- # Valid values are: semantic, only_raise and only_fail
158
203
  EnforcedStyle: semantic
204
+ SupportedStyles:
205
+ - only_raise
206
+ - only_fail
207
+ - semantic
208
+
209
+
210
+ SingleLineBlockParams:
211
+ Methods:
212
+ - reduce:
213
+ - a
214
+ - e
215
+ - inject:
216
+ - a
217
+ - e
159
218
 
160
219
  SingleLineMethods:
161
220
  AllowIfMethodIsEmpty: true
162
221
 
163
222
  StringLiterals:
164
- # Valid values (denoting the preferred quote delimiters) are:
165
- # single_quotes, double_quotes
166
223
  EnforcedStyle: single_quotes
224
+ SupportedStyles:
225
+ - single_quotes
226
+ - double_quotes
167
227
 
168
228
  SpaceAroundBlockBraces:
169
- # Valid values are: space_inside_braces, no_space_inside_braces
170
229
  EnforcedStyle: space_inside_braces
230
+ SupportedStyles:
231
+ - space_inside_braces
232
+ - no_space_inside_braces
171
233
  # Valid values are: space, no_space
172
234
  EnforcedStyleForEmptyBraces: no_space
173
235
  # Space between { and |. Overrides EnforcedStyle if there is a conflict.
174
236
  SpaceBeforeBlockParameters: true
175
237
 
176
238
  SpaceInsideHashLiteralBraces:
177
- # Valid values (for both parameters) are: space, no_space
178
239
  EnforcedStyle: space
179
240
  EnforcedStyleForEmptyBraces: no_space
241
+ SupportedStyles:
242
+ - space
243
+ - no_space
180
244
 
181
- SymbolName:
182
- AllowCamelCase: true
183
245
 
184
246
  # TrivialAccessors doesn't require exact name matches and doesn't allow
185
247
  # predicated methods by default.
@@ -206,8 +268,29 @@ TrivialAccessors:
206
268
  - to_sym
207
269
 
208
270
  VariableName:
209
- # Valid values are: snake_case, camelCase
210
271
  EnforcedStyle: snake_case
272
+ SupportedStyles:
273
+ - snake_case
274
+ - camelCase
211
275
 
212
276
  WordArray:
213
277
  MinSize: 0
278
+
279
+ ##################### Rails ##################################
280
+
281
+ DefaultScope:
282
+ IncludePaths:
283
+ - app/models
284
+
285
+ HasAndBelongsToMany:
286
+ IncludePaths:
287
+ - app/models
288
+
289
+ ReadAttribute:
290
+ IncludePaths:
291
+ - app/models
292
+
293
+ Validation:
294
+ IncludePaths:
295
+ - app/models
296
+
@@ -4,6 +4,10 @@ AccessModifierIndentation:
4
4
  Description: Check indentation of private/protected visibility modifiers.
5
5
  Enabled: true
6
6
 
7
+ AccessorMethodName:
8
+ Description: Check the naming of accessor methods for get_/set_.
9
+ Enabled: true
10
+
7
11
  Alias:
8
12
  Description: 'Use alias_method instead of alias.'
9
13
  Enabled: true
@@ -66,7 +70,7 @@ CaseEquality:
66
70
  Enabled: true
67
71
 
68
72
  CaseIndentation:
69
- Description: 'Indent when as deep as case.'
73
+ Description: 'Indentation of when in a case/when/[else/]end.'
70
74
  Enabled: true
71
75
 
72
76
  CharacterLiteral:
@@ -109,12 +113,6 @@ DefWithParentheses:
109
113
  Description: 'Use def with parentheses when there are arguments.'
110
114
  Enabled: true
111
115
 
112
- DefWithoutParentheses:
113
- Description: >
114
- Omit the parentheses when the method doesn't accept
115
- any arguments.
116
- Enabled: true
117
-
118
116
  Documentation:
119
117
  Description: 'Document classes and non-namespace modules.'
120
118
  Enabled: true
@@ -189,8 +187,12 @@ FinalNewline:
189
187
  Description: 'Checks for a final newline in a source file.'
190
188
  Enabled: true
191
189
 
190
+ FlipFlop:
191
+ Description: 'Checks for flip flops'
192
+ Enabled: true
193
+
192
194
  For:
193
- Description: 'Prefer each over for.'
195
+ Description: 'Checks use of for or each in multiline loops.'
194
196
  Enabled: true
195
197
 
196
198
  GlobalVars:
@@ -251,6 +253,12 @@ MethodCallParentheses:
251
253
  Description: 'Do not use parentheses for method calls with no arguments.'
252
254
  Enabled: true
253
255
 
256
+ MethodDefParentheses:
257
+ Description: >
258
+ Checks if the method definitions have or don't have
259
+ parentheses.
260
+ Enabled: true
261
+
254
262
  MethodLength:
255
263
  Description: 'Avoid methods longer than 10 lines of code.'
256
264
  Enabled: true
@@ -319,6 +327,10 @@ PerlBackrefs:
319
327
  Description: 'Avoid Perl-style regex back references.'
320
328
  Enabled: true
321
329
 
330
+ PredicateName:
331
+ Description: 'Check the names of predicate methods.'
332
+ Enabled: true
333
+
322
334
  Proc:
323
335
  Description: 'Use proc instead of Proc.new.'
324
336
  Enabled: true
@@ -327,10 +339,6 @@ RaiseArgs:
327
339
  Description: 'Checks the arguments passed to raise/fail.'
328
340
  Enabled: true
329
341
 
330
- ReduceArguments:
331
- Description: 'Name reduce arguments |a, e| (accumulator, element)'
332
- Enabled: true
333
-
334
342
  RedundantBegin:
335
343
  Description: "Don't use begin blocks when they are not needed."
336
344
  Enabled: true
@@ -371,6 +379,10 @@ SignalException:
371
379
  Description: 'Checks for proper usage of fail and raise.'
372
380
  Enabled: true
373
381
 
382
+ SingleLineBlockParams:
383
+ Description: 'Enforces the names of some block params.'
384
+ Enabled: true
385
+
374
386
  SingleLineMethods:
375
387
  Description: 'Avoid single-line methods.'
376
388
  Enabled: true
@@ -442,10 +454,6 @@ StringLiterals:
442
454
  Description: 'Checks if uses of quotes match the configured preference.'
443
455
  Enabled: true
444
456
 
445
- SymbolName:
446
- Description: 'Symbol literals should use snake_case.'
447
- Enabled: true
448
-
449
457
  Tab:
450
458
  Description: 'No hard tabs.'
451
459
  Enabled: true
@@ -575,6 +583,10 @@ Void:
575
583
 
576
584
  ##################### Rails ##################################
577
585
 
586
+ DefaultScope:
587
+ Description: 'Checks if the argument passed to default_scope is a block.'
588
+ Enabled: true
589
+
578
590
  HasAndBelongsToMany:
579
591
  Description: 'Prefer has_many :through to has_and_belongs_to_many.'
580
592
  Enabled: true