rubocop 0.28.0 → 0.29.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 (211) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +7 -7
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG.md +59 -0
  5. data/README.md +62 -28
  6. data/config/default.yml +31 -0
  7. data/config/disabled.yml +1 -1
  8. data/config/enabled.yml +17 -0
  9. data/lib/rubocop.rb +4 -0
  10. data/lib/rubocop/cli.rb +1 -1
  11. data/lib/rubocop/config.rb +12 -8
  12. data/lib/rubocop/config_loader.rb +20 -10
  13. data/lib/rubocop/cop/cop.rb +13 -7
  14. data/lib/rubocop/cop/corrector.rb +10 -10
  15. data/lib/rubocop/cop/lint/assignment_in_condition.rb +6 -1
  16. data/lib/rubocop/cop/lint/block_alignment.rb +9 -2
  17. data/lib/rubocop/cop/lint/debugger.rb +13 -1
  18. data/lib/rubocop/cop/lint/duplicate_methods.rb +104 -0
  19. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
  20. data/lib/rubocop/cop/lint/require_parentheses.rb +3 -3
  21. data/lib/rubocop/cop/mixin/access_modifier_node.rb +27 -0
  22. data/lib/rubocop/cop/mixin/on_normal_if_unless.rb +0 -4
  23. data/lib/rubocop/cop/rails/delegate.rb +4 -5
  24. data/lib/rubocop/cop/rails/read_write_attribute.rb +33 -0
  25. data/lib/rubocop/cop/style/access_modifier_indentation.rb +0 -7
  26. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +4 -2
  27. data/lib/rubocop/cop/style/class_methods.rb +25 -9
  28. data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +7 -1
  29. data/lib/rubocop/cop/style/empty_literal.rb +25 -10
  30. data/lib/rubocop/cop/style/even_odd.rb +32 -14
  31. data/lib/rubocop/cop/style/first_parameter_indentation.rb +106 -0
  32. data/lib/rubocop/cop/style/format_string.rb +2 -2
  33. data/lib/rubocop/cop/style/global_vars.rb +1 -5
  34. data/lib/rubocop/cop/style/hash_syntax.rb +0 -4
  35. data/lib/rubocop/cop/style/indentation_consistency.rb +5 -5
  36. data/lib/rubocop/cop/style/indentation_width.rb +13 -14
  37. data/lib/rubocop/cop/style/lambda.rb +48 -2
  38. data/lib/rubocop/cop/style/line_end_concatenation.rb +43 -47
  39. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -3
  40. data/lib/rubocop/cop/style/module_function.rb +3 -3
  41. data/lib/rubocop/cop/style/multiline_block_layout.rb +65 -17
  42. data/lib/rubocop/cop/style/multiline_operation_indentation.rb +2 -1
  43. data/lib/rubocop/cop/style/perl_backrefs.rb +2 -2
  44. data/lib/rubocop/cop/style/redundant_exception.rb +12 -0
  45. data/lib/rubocop/cop/style/self_assignment.rb +27 -0
  46. data/lib/rubocop/cop/style/semicolon.rb +2 -1
  47. data/lib/rubocop/cop/style/space_around_block_parameters.rb +92 -0
  48. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +0 -8
  49. data/lib/rubocop/cop/style/struct_inheritance.rb +42 -0
  50. data/lib/rubocop/cop/style/trivial_accessors.rb +10 -4
  51. data/lib/rubocop/cop/util.rb +32 -7
  52. data/lib/rubocop/formatter/simple_text_formatter.rb +0 -15
  53. data/lib/rubocop/options.rb +28 -41
  54. data/lib/rubocop/processed_source.rb +6 -0
  55. data/lib/rubocop/rake_task.rb +6 -3
  56. data/lib/rubocop/runner.rb +55 -15
  57. data/lib/rubocop/version.rb +1 -1
  58. data/relnotes/v0.29.0.md +116 -0
  59. data/rubocop.gemspec +3 -3
  60. data/spec/rubocop/cli_spec.rb +329 -25
  61. data/spec/rubocop/config_loader_spec.rb +20 -0
  62. data/spec/rubocop/cop/lint/assignment_in_condition_spec.rb +27 -3
  63. data/spec/rubocop/cop/lint/block_alignment_spec.rb +3 -4
  64. data/spec/rubocop/cop/lint/condition_position_spec.rb +1 -1
  65. data/spec/rubocop/cop/lint/debugger_spec.rb +20 -7
  66. data/spec/rubocop/cop/lint/duplicate_methods_spec.rb +189 -0
  67. data/spec/rubocop/cop/lint/empty_interpolation_spec.rb +1 -1
  68. data/spec/rubocop/cop/lint/end_in_method_spec.rb +1 -1
  69. data/spec/rubocop/cop/lint/eval_spec.rb +4 -4
  70. data/spec/rubocop/cop/lint/literal_in_condition_spec.rb +18 -0
  71. data/spec/rubocop/cop/lint/literal_in_interpolation_spec.rb +2 -2
  72. data/spec/rubocop/cop/lint/loop_spec.rb +4 -4
  73. data/spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb +7 -7
  74. data/spec/rubocop/cop/lint/space_before_first_arg_spec.rb +5 -4
  75. data/spec/rubocop/cop/lint/useless_assignment_spec.rb +3 -9
  76. data/spec/rubocop/cop/lint/useless_comparison_spec.rb +1 -1
  77. data/spec/rubocop/cop/lint/void_spec.rb +1 -1
  78. data/spec/rubocop/cop/metrics/abc_size_spec.rb +10 -0
  79. data/spec/rubocop/cop/metrics/line_length_spec.rb +2 -2
  80. data/spec/rubocop/cop/metrics/parameter_lists_spec.rb +2 -2
  81. data/spec/rubocop/cop/rails/action_filter_spec.rb +6 -12
  82. data/spec/rubocop/cop/rails/default_scope_spec.rb +5 -5
  83. data/spec/rubocop/cop/rails/delegate_spec.rb +8 -0
  84. data/spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb +1 -1
  85. data/spec/rubocop/cop/rails/read_write_attribute_spec.rb +119 -8
  86. data/spec/rubocop/cop/rails/scope_args_spec.rb +3 -3
  87. data/spec/rubocop/cop/rails/validation_spec.rb +3 -3
  88. data/spec/rubocop/cop/style/alias_spec.rb +5 -5
  89. data/spec/rubocop/cop/style/align_hash_spec.rb +1 -1
  90. data/spec/rubocop/cop/style/align_parameters_spec.rb +8 -8
  91. data/spec/rubocop/cop/style/and_or_spec.rb +15 -30
  92. data/spec/rubocop/cop/style/array_join_spec.rb +4 -4
  93. data/spec/rubocop/cop/style/ascii_comments_spec.rb +1 -2
  94. data/spec/rubocop/cop/style/ascii_identifiers_spec.rb +2 -2
  95. data/spec/rubocop/cop/style/begin_block_spec.rb +1 -1
  96. data/spec/rubocop/cop/style/block_comments_spec.rb +1 -1
  97. data/spec/rubocop/cop/style/block_end_newline_spec.rb +1 -1
  98. data/spec/rubocop/cop/style/blocks_spec.rb +2 -2
  99. data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +38 -33
  100. data/spec/rubocop/cop/style/case_equality_spec.rb +1 -1
  101. data/spec/rubocop/cop/style/character_literal_spec.rb +4 -4
  102. data/spec/rubocop/cop/style/class_and_module_children_spec.rb +4 -2
  103. data/spec/rubocop/cop/style/class_methods_spec.rb +12 -0
  104. data/spec/rubocop/cop/style/class_vars_spec.rb +2 -2
  105. data/spec/rubocop/cop/style/collection_methods_spec.rb +4 -4
  106. data/spec/rubocop/cop/style/colon_method_call_spec.rb +8 -8
  107. data/spec/rubocop/cop/style/comment_annotation_spec.rb +10 -10
  108. data/spec/rubocop/cop/style/constant_name_spec.rb +7 -7
  109. data/spec/rubocop/cop/style/def_with_parentheses_spec.rb +1 -1
  110. data/spec/rubocop/cop/style/deprecated_hash_methods_spec.rb +4 -4
  111. data/spec/rubocop/cop/style/dot_position_spec.rb +8 -6
  112. data/spec/rubocop/cop/style/each_with_object_spec.rb +2 -2
  113. data/spec/rubocop/cop/style/else_alignment_spec.rb +2 -4
  114. data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +78 -0
  115. data/spec/rubocop/cop/style/empty_lines_around_class_body_spec.rb +60 -0
  116. data/spec/rubocop/cop/style/empty_lines_spec.rb +3 -3
  117. data/spec/rubocop/cop/style/empty_literal_spec.rb +29 -12
  118. data/spec/rubocop/cop/style/encoding_spec.rb +3 -3
  119. data/spec/rubocop/cop/style/end_block_spec.rb +1 -1
  120. data/spec/rubocop/cop/style/end_of_line_spec.rb +2 -2
  121. data/spec/rubocop/cop/style/even_odd_spec.rb +109 -20
  122. data/spec/rubocop/cop/style/extra_spacing_spec.rb +3 -3
  123. data/spec/rubocop/cop/style/first_parameter_indentation_spec.rb +293 -0
  124. data/spec/rubocop/cop/style/for_spec.rb +2 -2
  125. data/spec/rubocop/cop/style/format_string_spec.rb +45 -21
  126. data/spec/rubocop/cop/style/global_vars_spec.rb +4 -4
  127. data/spec/rubocop/cop/style/guard_clause_spec.rb +17 -0
  128. data/spec/rubocop/cop/style/hash_syntax_spec.rb +15 -15
  129. data/spec/rubocop/cop/{metrics → style}/if_unless_modifier_spec.rb +2 -2
  130. data/spec/rubocop/cop/style/if_with_semicolon_spec.rb +2 -2
  131. data/spec/rubocop/cop/style/indent_array_spec.rb +3 -6
  132. data/spec/rubocop/cop/style/indent_hash_spec.rb +4 -4
  133. data/spec/rubocop/cop/style/indentation_consistency_spec.rb +1 -2
  134. data/spec/rubocop/cop/style/indentation_width_spec.rb +1 -2
  135. data/spec/rubocop/cop/style/infinite_loop_spec.rb +1 -1
  136. data/spec/rubocop/cop/style/lambda_call_spec.rb +4 -4
  137. data/spec/rubocop/cop/style/lambda_spec.rb +37 -2
  138. data/spec/rubocop/cop/style/leading_comment_space_spec.rb +7 -12
  139. data/spec/rubocop/cop/style/line_end_concatenation_spec.rb +41 -1
  140. data/spec/rubocop/cop/style/method_call_parentheses_spec.rb +4 -4
  141. data/spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb +3 -3
  142. data/spec/rubocop/cop/style/method_name_spec.rb +1 -1
  143. data/spec/rubocop/cop/style/multiline_block_layout_spec.rb +61 -0
  144. data/spec/rubocop/cop/style/multiline_if_then_spec.rb +1 -3
  145. data/spec/rubocop/cop/style/multiline_operation_indentation_spec.rb +8 -0
  146. data/spec/rubocop/cop/style/multiline_ternary_operator_spec.rb +1 -1
  147. data/spec/rubocop/cop/style/nested_ternary_operator_spec.rb +1 -1
  148. data/spec/rubocop/cop/style/next_spec.rb +16 -0
  149. data/spec/rubocop/cop/style/numeric_literals_spec.rb +5 -5
  150. data/spec/rubocop/cop/style/one_line_conditional_spec.rb +1 -1
  151. data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +22 -4
  152. data/spec/rubocop/cop/style/percent_literal_delimiters_spec.rb +31 -31
  153. data/spec/rubocop/cop/style/percent_q_literals_spec.rb +12 -12
  154. data/spec/rubocop/cop/style/perl_backrefs_spec.rb +3 -3
  155. data/spec/rubocop/cop/style/proc_spec.rb +3 -3
  156. data/spec/rubocop/cop/style/raise_args_spec.rb +9 -9
  157. data/spec/rubocop/cop/style/redundant_begin_spec.rb +1 -1
  158. data/spec/rubocop/cop/style/redundant_exception_spec.rb +36 -4
  159. data/spec/rubocop/cop/style/redundant_self_spec.rb +89 -45
  160. data/spec/rubocop/cop/style/regexp_literal_spec.rb +9 -9
  161. data/spec/rubocop/cop/style/rescue_modifier_spec.rb +2 -2
  162. data/spec/rubocop/cop/style/self_assignment_spec.rb +16 -10
  163. data/spec/rubocop/cop/style/semicolon_spec.rb +9 -9
  164. data/spec/rubocop/cop/style/single_line_block_params_spec.rb +2 -2
  165. data/spec/rubocop/cop/style/single_space_before_first_arg_spec.rb +1 -1
  166. data/spec/rubocop/cop/style/space_after_colon_spec.rb +5 -5
  167. data/spec/rubocop/cop/style/space_after_comma_spec.rb +3 -3
  168. data/spec/rubocop/cop/style/space_after_control_keyword_spec.rb +4 -4
  169. data/spec/rubocop/cop/style/space_after_not_spec.rb +2 -2
  170. data/spec/rubocop/cop/style/space_after_semicolon_spec.rb +2 -2
  171. data/spec/rubocop/cop/style/space_around_block_parameters_spec.rb +150 -0
  172. data/spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb +18 -9
  173. data/spec/rubocop/cop/style/space_around_operators_spec.rb +24 -21
  174. data/spec/rubocop/cop/style/space_before_block_braces_spec.rb +4 -4
  175. data/spec/rubocop/cop/style/space_before_comma_spec.rb +4 -4
  176. data/spec/rubocop/cop/style/space_before_comment_spec.rb +3 -3
  177. data/spec/rubocop/cop/style/space_before_semicolon_spec.rb +2 -2
  178. data/spec/rubocop/cop/style/space_inside_block_braces_spec.rb +33 -24
  179. data/spec/rubocop/cop/style/space_inside_brackets_spec.rb +2 -2
  180. data/spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb +9 -9
  181. data/spec/rubocop/cop/style/space_inside_parens_spec.rb +1 -1
  182. data/spec/rubocop/cop/style/special_global_vars_spec.rb +6 -6
  183. data/spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb +3 -3
  184. data/spec/rubocop/cop/style/string_literals_spec.rb +16 -16
  185. data/spec/rubocop/cop/style/struct_inheritance_spec.rb +44 -0
  186. data/spec/rubocop/cop/style/symbol_array_spec.rb +9 -9
  187. data/spec/rubocop/cop/style/symbol_proc_spec.rb +12 -12
  188. data/spec/rubocop/cop/style/tab_spec.rb +4 -4
  189. data/spec/rubocop/cop/style/trailing_blank_lines_spec.rb +2 -2
  190. data/spec/rubocop/cop/style/trailing_whitespace_spec.rb +2 -2
  191. data/spec/rubocop/cop/style/trivial_accessors_spec.rb +16 -0
  192. data/spec/rubocop/cop/style/unneeded_capital_w_spec.rb +11 -22
  193. data/spec/rubocop/cop/style/variable_interpolation_spec.rb +7 -7
  194. data/spec/rubocop/cop/style/while_until_do_spec.rb +2 -2
  195. data/spec/rubocop/cop/{metrics → style}/while_until_modifier_spec.rb +2 -2
  196. data/spec/rubocop/cop/style/word_array_spec.rb +11 -11
  197. data/spec/rubocop/cop/util_spec.rb +51 -0
  198. data/spec/rubocop/cop/variable_force/reference_spec.rb +19 -0
  199. data/spec/rubocop/cop/variable_force/variable_table_spec.rb +7 -0
  200. data/spec/rubocop/formatter/disabled_lines_formatter_spec.rb +7 -8
  201. data/spec/rubocop/formatter/text_util_spec.rb +55 -0
  202. data/spec/rubocop/options_spec.rb +26 -20
  203. data/spec/rubocop/rake_task_spec.rb +122 -0
  204. data/spec/rubocop/runner_spec.rb +37 -2
  205. data/spec/rubocop/token_spec.rb +5 -1
  206. data/spec/spec_helper.rb +5 -2
  207. data/spec/support/cop_helper.rb +3 -0
  208. data/spec/support/cops/class_must_be_a_module_cop.rb +19 -0
  209. data/spec/support/cops/module_must_be_a_class_cop.rb +19 -0
  210. data/spec/support/custom_matchers.rb +1 -1
  211. metadata +35 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d09cfe000191e9a91719f1f3a75d401d97dcec7
4
- data.tar.gz: a4528c98896b1d0330be5138b4509ccabb0bf0cc
3
+ metadata.gz: 2a1f32b26b9ff39fe0348f90855ab63dccc0e3c8
4
+ data.tar.gz: 30d21bcc89c00bb7cd629b9c5089fc4d041afeb7
5
5
  SHA512:
6
- metadata.gz: b51f275c969f27f455f3f14e260452a7f52b8142cb0389020dddb1391ae61dd22f320658fdb20f041210dec8aa9513113981fd1a8913dcc90b91b65d32e8a5a2
7
- data.tar.gz: 06784538ec77970b8f0fdd76c037d0bd6d4aa70a26f5181705f413d245e5364abf2d4d7644c769286c9f5e735f71712bfeba9e6a4b4bd5681431050dba16df71
6
+ metadata.gz: a82dd617f97b5bf6bacc3cab91c1888ba9db3d78dd866ae8a5c58fdf2235cff8ffc354ee0c99e69506db4353571d7292fc1ed4e03b20d1b590597be8dfeea45e
7
+ data.tar.gz: af859406fb7c0100a90e2cd1356550124b7d473c252da59b15034d55a08a9c786cad6c3efd5906100a565acfd62ce5cf6488483561db2e8903f82c9a5adf762a
@@ -1,28 +1,28 @@
1
1
  # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-10-22 08:31:49 +0200 using RuboCop version 0.26.1.
2
+ # on 2014-12-19 23:52:21 +0100 using RuboCop version 0.28.0.
3
3
  # The point is for the user to remove these configuration records
4
4
  # one by one as the offenses are removed from the code base.
5
5
  # Note that changes in the inspected code, or installation of new
6
6
  # versions of RuboCop, may require this file to be generated again.
7
7
 
8
- # Offense count: 116
8
+ # Offense count: 122
9
9
  Metrics/AbcSize:
10
10
  Max: 38
11
11
 
12
- # Offense count: 10
12
+ # Offense count: 9
13
13
  # Configuration parameters: CountComments.
14
14
  Metrics/ClassLength:
15
- Max: 131
15
+ Max: 138
16
16
 
17
- # Offense count: 27
17
+ # Offense count: 28
18
18
  Metrics/CyclomaticComplexity:
19
19
  Max: 10
20
20
 
21
- # Offense count: 129
21
+ # Offense count: 130
22
22
  # Configuration parameters: CountComments.
23
23
  Metrics/MethodLength:
24
24
  Max: 16
25
25
 
26
- # Offense count: 16
26
+ # Offense count: 18
27
27
  Metrics/PerceivedComplexity:
28
28
  Max: 11
@@ -1,14 +1,18 @@
1
+ sudo: false
2
+ cache: bundler
1
3
  language: ruby
2
4
  rvm:
3
5
  - 1.9.3
4
6
  - 2.0.0
5
7
  - 2.1
8
+ - 2.2
6
9
  - ruby-head
7
10
  - jruby-19mode
8
11
  - rbx-2
9
12
  matrix:
10
13
  allow_failures:
11
14
  - rvm: ruby-head
15
+ - rvm: jruby-19mode
12
16
  - rvm: rbx-2
13
17
  before_install: gem update --remote bundler
14
18
  install:
@@ -2,6 +2,56 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.29.0 (05/02/2015)
6
+
7
+ ### New features
8
+
9
+ * [#1430](https://github.com/bbatsov/rubocop/issues/1430): Add `--except` option for disabling cops on the command line. ([@jonas054][])
10
+ * [#1506](https://github.com/bbatsov/rubocop/pull/1506): Add auto-correct from `EvenOdd` cop. ([@blainesch][])
11
+ * [#1507](https://github.com/bbatsov/rubocop/issues/1507): `Debugger` cop now checks for the Capybara debug methods `save_and_open_page` and `save_and_open_screenshot`. ([@rrosenblum][])
12
+ * [#1539](https://github.com/bbatsov/rubocop/pull/1539): Implement autocorrection for Rails/ReadWriteAttribute cop. ([@huerlisi][])
13
+ * [#1324](https://github.com/bbatsov/rubocop/issues/1324): Add `AllCops/DisplayCopNames` configuration option for showing cop names in reports, like `--display-cop-names`. ([@jonas054][])
14
+ * [#1271](https://github.com/bbatsov/rubocop/issues/1271): `Lambda` cop does auto-correction. ([@lumeet][])
15
+ * [#1284](https://github.com/bbatsov/rubocop/issues/1284): Support namespaces, e.g. `Lint`, in the arguments to `--only` and `--except`. ([@jonas054][])
16
+ * [#1276](https://github.com/bbatsov/rubocop/issues/1276): `SelfAssignment` cop does auto-correction. ([@lumeet][])
17
+ * Add autocorrect to `RedundantException`. ([@mattjmcnaughton][])
18
+ * [#1571](https://github.com/bbatsov/rubocop/pull/1571): New cop `StructInheritance` checks for inheritance from Struct.new. ([@mmozuras][])
19
+ * [#1575](https://github.com/bbatsov/rubocop/issues/1575): New cop `DuplicateMethods` points out duplicate method name in class and module. ([@d4rk5eed][])
20
+ * [#1144](https://github.com/bbatsov/rubocop/issues/1144): New cop `FirstParameterIndentation` checks the indentation of the first parameter in a method call. ([@jonas054][])
21
+ * [#1627](https://github.com/bbatsov/rubocop/issues/1627): New cop `SpaceAroundBlockParameters` checks the spacing inside and after block parameters pipes. ([@jonas054][])
22
+
23
+ ### Changes
24
+
25
+ * [#1492](https://github.com/bbatsov/rubocop/pull/1492): Abort when auto-correct causes an infinite loop. ([@dblock][])
26
+ * Options `-e`/`--emacs` and `-s`/`--silent` are no longer recognized. Using them will now raise an error. ([@bquorning][])
27
+ * [#1565](https://github.com/bbatsov/rubocop/issues/1565): Let `--fail-level A` cause exit with error if all offenses are auto-corrected. ([@jonas054][])
28
+ * [#1309](https://github.com/bbatsov/rubocop/issues/1309): Add argument handling to `MultilineBlockLayout`. ([@lumeet][])
29
+
30
+ ### Bugs fixed
31
+
32
+ * [#1634](https://github.com/bbatsov/rubocop/pull/1634): Fix `PerlBackrefs` Cop Autocorrections to Not Raise. ([@cshaffer][])
33
+ * [#1553](https://github.com/bbatsov/rubocop/pull/1553): Fix bug where `Style/EmptyLinesAroundAccessModifier` interfered with `Style/EmptyLinesAroundBlockBody` when there is and access modifier at the beginning of a block. ([@volkert][])
34
+ * Handle element assignment in `Lint/AssignmentInCondition`. ([@jonas054][])
35
+ * [#1484](https://github.com/bbatsov/rubocop/issues/1484): Fix `EmptyLinesAroundAccessModifier` incorrectly finding a violation inside method calls with names identical to an access modifier. ([@dblock][])
36
+ * Fix bug concerning `Exclude` properties inherited from a higher directory level. ([@jonas054][])
37
+ * [#1500](https://github.com/bbatsov/rubocop/issues/1500): Fix crashing `--auto-correct --only IndentationWidth`. ([@jonas054][])
38
+ * [#1512](https://github.com/bbatsov/rubocop/issues/1512): Fix false negative for typical string formatting examples. ([@kakutani][], [@jonas054][])
39
+ * [#1504](https://github.com/bbatsov/rubocop/issues/1504): Fail with a meaningful error if the configuration file is malformed. ([@bquorning][])
40
+ * Fix bug where `auto_correct` Rake tasks does not take in the options specified in its parent task. ([@rrosenblum][])
41
+ * [#1054](https://github.com/bbatsov/rubocop/issues/1054): Handle comments within concatenated strings in `LineEndConcatenation`. ([@yujinakayama][], [@jonas054][])
42
+ * [#1527](https://github.com/bbatsov/rubocop/issues/1527): Make autocorrect `BracesAroundHashParameter` leave the correct number of spaces. ([@mattjmcnaughton][])
43
+ * [#1547](https://github.com/bbatsov/rubocop/issues/1547): Don't print `[Corrected]` when auto-correction was avoided in `Style/Semicolon`. ([@jonas054][])
44
+ * [#1573](https://github.com/bbatsov/rubocop/issues/1573): Fix assignment-related auto-correction for `BlockAlignment`. ([@lumeet][])
45
+ * [#1587](https://github.com/bbatsov/rubocop/pull/1587): Exit with exit code 1 if there were errors ("crashing" cops). ([@jonas054][])
46
+ * [#1574](https://github.com/bbatsov/rubocop/issues/1574): Avoid auto-correcting `Hash.new` to `{}` when braces would be interpreted as a block. ([@jonas054][])
47
+ * [#1591](https://github.com/bbatsov/rubocop/issues/1591): Don't check parameters inside `[]` in `MultilineOperationIndentation`. ([@jonas054][])
48
+ * [#1509](https://github.com/bbatsov/rubocop/issues/1509): Ignore class methods in `Rails/Delegate`. ([@bbatsov][])
49
+ * [#1594](https://github.com/bbatsov/rubocop/issues/1594): Fix `@example` warnings in Yard Doc documentation generation. ([@mattjmcnaughton][])
50
+ * [#1598](https://github.com/bbatsov/rubocop/issues/1598): Fix bug in file inclusion when running from another directory. ([@jonas054][])
51
+ * [#1580](https://github.com/bbatsov/rubocop/issues/1580): Don't print `[Corrected]` when auto-correction was avoided in `TrivialAccessors`. ([@lumeet][])
52
+ * [#1612](https://github.com/bbatsov/rubocop/issues/1612): Allow `expand_path` on `inherit_from` in `.rubocop.yml`. ([@mattjmcnaughton][])
53
+ * [#1610](https://github.com/bbatsov/rubocop/issues/1610): Check that class method names actually match the name of the containing class/module in `Style/ClassMethods`. ([@bbatsov][])
54
+
5
55
  ## 0.28.0 (10/12/2014)
6
56
 
7
57
  ### New features
@@ -1190,3 +1240,12 @@
1190
1240
  [@blainesch]: https://github.com/blainesch
1191
1241
  [@marxarelli]: https://github.com/marxarelli
1192
1242
  [@katieschilling]: https://github.com/katieschilling
1243
+ [@kakutani]: https://github.com/kakutani
1244
+ [@rrosenblum]: https://github.com/rrosenblum
1245
+ [@mattjmcnaughton]: https://github.com/mattjmcnaughton
1246
+ [@huerlisi]: https://github.com/huerlisi
1247
+ [@volkert]: https://github.com/volkert
1248
+ [@lumeet]: https://github.com/lumeet
1249
+ [@mmozuras]: https://github.com/mmozuras
1250
+ [@d4rk5eed]: https://github.com/d4rk5eed
1251
+ [@cshaffer]: https://github.com/cshaffer
data/README.md CHANGED
@@ -44,6 +44,7 @@ release.**
44
44
  - [Inheritance](#inheritance)
45
45
  - [Defaults](#defaults)
46
46
  - [Including/Excluding files](#includingexcluding-files)
47
+ - [Generic configuration parameters](#generic-configuration-parameters)
47
48
  - [Automatically Generated Configuration](#automatically-generated-configuration)
48
49
  - [Disabling Cops within Source Code](#disabling-cops-within-source-code)
49
50
  - [Formatters](#formatters)
@@ -125,19 +126,25 @@ end
125
126
  Running RuboCop on it (assuming it's in a file named `test.rb`) would produce the following report:
126
127
 
127
128
  ```
129
+ Inspecting 1 file
130
+ W
131
+
128
132
  Offenses:
129
133
 
130
- test.rb:1:5: C: Use snake_case for methods and variables.
134
+ test.rb:1:5: C: Use snake_case for method names.
131
135
  def badName
132
136
  ^^^^^^^
133
- test.rb:2:3: C: Favor modifier if/unless usage when you have a single-line body. Another good alternative is the usage of control flow &&/||.
137
+ test.rb:2:3: C: Use a guard clause instead of wrapping the code inside a conditional expression.
138
+ if something
139
+ ^^
140
+ test.rb:2:3: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
134
141
  if something
135
142
  ^^
136
143
  test.rb:4:5: W: end at 4, 4 is not aligned with if at 2, 2
137
144
  end
138
145
  ^^^
139
146
 
140
- 1 file inspected, 3 offenses detected
147
+ 1 file inspected, 4 offenses detected
141
148
  ```
142
149
 
143
150
  For more details check the available command-line options:
@@ -148,22 +155,23 @@ $ rubocop -h
148
155
 
149
156
  Command flag | Description
150
157
  --------------------------|------------------------------------------------------------
151
- `-v/--version` | Displays the current version and exits
152
- `-V/--verbose-version` | Displays the current version plus the version of Parser and Ruby
153
- `-F/--fail-fast` | Inspects in modification time order and stops after first file with offenses
154
- `-d/--debug` | Displays some extra debug output
158
+ `-v/--version` | Displays the current version and exits.
159
+ `-V/--verbose-version` | Displays the current version plus the version of Parser and Ruby.
160
+ `-F/--fail-fast` | Inspects in modification time order and stops after first file with offenses.
161
+ `-d/--debug` | Displays some extra debug output.
155
162
  `-D/--display-cop-names` | Displays cop names in offense messages.
156
- `-c/--config` | Run with specified config file
157
- `-f/--format` | Choose a formatter
158
- `-o/--out` | Write output to a file instead of STDOUT
159
- `-r/--require` | Require Ruby file (see [Loading Extensions](#loading-extensions))
160
- `-R/--rails` | Run extra Rails cops
161
- `-l/--lint` | Run only lint cops
162
- `-a/--auto-correct` | Auto-correct certain offenses *Note:* Experimental - use with caution
163
- `--only` | Run only the specified cop(s)
164
- `--auto-gen-config` | Generate a configuration file acting as a TODO list
165
- `--show-cops` | Shows available cops and their configuration
166
- `--fail-level` | Minimum severity for exit with error code
163
+ `-c/--config` | Run with specified config file.
164
+ `-f/--format` | Choose a formatter.
165
+ `-o/--out` | Write output to a file instead of STDOUT.
166
+ `-r/--require` | Require Ruby file (see [Loading Extensions](#loading-extensions)).
167
+ `-R/--rails` | Run extra Rails cops.
168
+ `-l/--lint` | Run only lint cops.
169
+ `-a/--auto-correct` | Auto-correct certain offenses. *Note:* Experimental - use with caution.
170
+ `--only` | Run only the specified cop(s) and/or cops in the specified departments.
171
+ `--except` | Run all cops enabled by configuration except the specified cop(s) and/or departments.
172
+ `--auto-gen-config` | Generate a configuration file acting as a TODO list.
173
+ `--show-cops` | Shows available cops and their configuration.
174
+ `--fail-level` | Minimum [severity](#severity) for exit with error code. Full severity name or upper case initial can be given. Normally, auto-corrected offenses are ignored. Use `A` or `autocorrect` if you'd like them to trigger failure.
167
175
 
168
176
  ### Cops
169
177
 
@@ -343,6 +351,13 @@ Rails/DefaultScope:
343
351
  - app/models/problematic.rb
344
352
  ```
345
353
 
354
+ ### Generic configuration parameters
355
+
356
+ In addition to `Include` and `Exclude`, the following parameters are available
357
+ for every cop.
358
+
359
+ #### Enabled
360
+
346
361
  Specific cops can be disabled by setting `Enabled` to `false` for that specific cop.
347
362
 
348
363
  ```yaml
@@ -350,8 +365,17 @@ Metrics/LineLength:
350
365
  Enabled: false
351
366
  ```
352
367
 
353
- Cops can customize their severity level. All cops support the `Severity` param.
354
- Allowed params are `refactor`, `convention`, `warning`, `error` and `fatal`.
368
+ #### Severity
369
+
370
+ Each cop has a default severity level based on which department it belongs
371
+ to. The level is `warning` for `Lint` and `convention` for all the others.
372
+ Cops can customize their severity level. Allowed params are `refactor`,
373
+ `convention`, `warning`, `error` and `fatal`.
374
+
375
+ There is one exception from the general rule above and that is `Lint/Syntax`, a
376
+ special cop that checks for syntax errors before the other cops are invoked. It
377
+ can not be disabled and its severity (`fatal`) can not be changed in
378
+ configuration.
355
379
 
356
380
  ```yaml
357
381
  Metrics/CyclomaticComplexity:
@@ -399,7 +423,7 @@ for x in (0..19) # rubocop:disable Style/AvoidFor
399
423
  You can change the output format of RuboCop by specifying formatters with the `-f/--format` option.
400
424
  RuboCop ships with several built-in formatters, and also you can create your custom formatter.
401
425
 
402
- Additionaly the output can be redirected to a file instead of `$stdout` with the `-o/--out` option.
426
+ Additionally the output can be redirected to a file instead of `$stdout` with the `-o/--out` option.
403
427
 
404
428
  Some of the built-in formatters produce **machine-parsable** output
405
429
  and they are considered public APIs.
@@ -466,17 +490,25 @@ The `clang` formatter displays the offenses in a manner similar to `clang`:
466
490
 
467
491
  ```
468
492
  $ rubocop test.rb
469
- test.rb:1:1: C: Use snake_case for methods and variables.
493
+ Inspecting 1 file
494
+ W
495
+
496
+ Offenses:
497
+
498
+ test.rb:1:5: C: Use snake_case for method names.
470
499
  def badName
471
500
  ^^^^^^^
472
- test.rb:2:3: C: Favor modifier if/unless usage when you have a single-line body. Another good alternative is the usage of control flow &&/||.
501
+ test.rb:2:3: C: Use a guard clause instead of wrapping the code inside a conditional expression.
502
+ if something
503
+ ^^
504
+ test.rb:2:3: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
473
505
  if something
474
506
  ^^
475
507
  test.rb:4:5: W: end at 4, 4 is not aligned with if at 2, 2
476
508
  end
477
509
  ^^^
478
510
 
479
- 1 file inspected, 3 offenses detected
511
+ 1 file inspected, 4 offenses detected
480
512
  ```
481
513
 
482
514
  ### Fuubar Style Formatter
@@ -516,11 +548,12 @@ The name of the formatter says it all :-)
516
548
  ```
517
549
  $ rubocop --format simple test.rb
518
550
  == test.rb ==
519
- C: 1: 1: Use snake_case for methods and variables.
520
- C: 2: 3: Favor modifier if/unless usage when you have a single-line body. Another good alternative is the usage of control flow &&/||.
551
+ C: 1: 5: Use snake_case for method names.
552
+ C: 2: 3: Use a guard clause instead of wrapping the code inside a conditional expression.
553
+ C: 2: 3: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
521
554
  W: 4: 5: end at 4, 4 is not aligned with if at 2, 2
522
555
 
523
- 1 file inspected, 3 offenses detected
556
+ 1 file inspected, 4 offenses detected
524
557
  ```
525
558
 
526
559
  ### File List Formatter
@@ -629,6 +662,7 @@ RuboCop supports the following Ruby implementations:
629
662
  * MRI 1.9.3
630
663
  * MRI 2.0
631
664
  * MRI 2.1
665
+ * MRI 2.2
632
666
  * JRuby in 1.9 mode
633
667
  * Rubinius 2.0+
634
668
 
@@ -839,5 +873,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
839
873
 
840
874
  ## Copyright
841
875
 
842
- Copyright (c) 2012-2014 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
876
+ Copyright (c) 2012-2015 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
843
877
  further details.
@@ -29,6 +29,14 @@ AllCops:
29
29
  # By default, the rails cops are not run. Override in project or home
30
30
  # directory .rubocop.yml files, or by giving the -R/--rails option.
31
31
  RunRailsCops: false
32
+ # Cop names are not displayed in offense messages by default. Change behavior
33
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
34
+ # option.
35
+ DisplayCopNames: false
36
+ # Additional cops that do not reference a style guide rule may be enabled by
37
+ # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
38
+ # the --only-guide-cops option.
39
+ StyleGuideCopsOnly: false
32
40
 
33
41
  # Indent private/protected/public as deep as method definitions
34
42
  Style/AccessModifierIndentation:
@@ -252,6 +260,21 @@ Style/FileName:
252
260
  # excludes here.
253
261
  Exclude: []
254
262
 
263
+ Style/FirstParameterIndentation:
264
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
265
+ SupportedStyles:
266
+ # The first parameter should always be indented one step more than the
267
+ # preceding line.
268
+ - consistent
269
+ # The first parameter should normally be indented one step more than the
270
+ # preceding line, but if it's a parameter for a method call that is itself
271
+ # a parameter in a method call, then the inner parameter should be indented
272
+ # relative to the inner method.
273
+ - special_for_inner_method_call
274
+ # Same as special_for_inner_method_call except that the special rule only
275
+ # applies if the outer method call encloses its arguments in parentheses.
276
+ - special_for_inner_method_call_in_parentheses
277
+
255
278
  # Checks use of for or each in multiline loops.
256
279
  Style/For:
257
280
  EnforcedStyle: each
@@ -435,6 +458,12 @@ Style/StringLiteralsInInterpolation:
435
458
  - single_quotes
436
459
  - double_quotes
437
460
 
461
+ Style/SpaceAroundBlockParameters:
462
+ EnforcedStyleInsidePipes: no_space
463
+ SupportedStyles:
464
+ - space
465
+ - no_space
466
+
438
467
  Style/SpaceAroundEqualsInParameterDefault:
439
468
  EnforcedStyle: space
440
469
  SupportedStyles:
@@ -551,6 +580,8 @@ Metrics/CyclomaticComplexity:
551
580
 
552
581
  Metrics/LineLength:
553
582
  Max: 80
583
+ # To make it possible to copy or click on URIs in the code, we allow lines
584
+ # contaning a URI to be longer than Max.
554
585
  AllowURI: true
555
586
  URISchemes:
556
587
  - http
@@ -2,7 +2,7 @@
2
2
 
3
3
  Style/CollectionMethods:
4
4
  Description: 'Preferred collection methods.'
5
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-fine-select-reduce-size'
5
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size'
6
6
  Enabled: false
7
7
 
8
8
  Style/Encoding:
@@ -239,6 +239,10 @@ Style/FileName:
239
239
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
240
240
  Enabled: true
241
241
 
242
+ Style/FirstParameterIndentation:
243
+ Description: 'Checks the indentation of the first parameter in a method call.'
244
+ Enabled: true
245
+
242
246
  Style/FlipFlop:
243
247
  Description: 'Checks for flip flops'
244
248
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
@@ -594,6 +598,10 @@ Style/SpaceInsideBlockBraces:
594
598
  or doesn't have trailing space.
595
599
  Enabled: true
596
600
 
601
+ Style/SpaceAroundBlockParameters:
602
+ Description: 'Checks the spacing inside and after block parameters pipes.'
603
+ Enabled: true
604
+
597
605
  Style/SpaceAroundEqualsInParameterDefault:
598
606
  Description: >-
599
607
  Checks that the equals signs in parameter default assignments
@@ -647,6 +655,11 @@ Style/StringLiteralsInInterpolation:
647
655
  strings match the configured preference.
648
656
  Enabled: true
649
657
 
658
+ Style/StructInheritance:
659
+ Description: 'Checks for inheritance from Struct.new.'
660
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new'
661
+ Enabled: true
662
+
650
663
  Style/SymbolProc:
651
664
  Description: 'Use symbols as procs instead of blocks when possible.'
652
665
  Enabled: true
@@ -819,6 +832,10 @@ Lint/DeprecatedClassMethods:
819
832
  Description: 'Check for deprecated class method calls.'
820
833
  Enabled: true
821
834
 
835
+ Lint/DuplicateMethods:
836
+ Description: 'Check for duplicate methods calls.'
837
+ Enabled: true
838
+
822
839
  Lint/ElseLayout:
823
840
  Description: 'Check for odd code arrangement in an else block.'
824
841
  Enabled: true
@@ -73,6 +73,7 @@ require 'rubocop/cop/lint/condition_position'
73
73
  require 'rubocop/cop/lint/debugger'
74
74
  require 'rubocop/cop/lint/def_end_alignment'
75
75
  require 'rubocop/cop/lint/deprecated_class_methods'
76
+ require 'rubocop/cop/lint/duplicate_methods'
76
77
  require 'rubocop/cop/lint/else_layout'
77
78
  require 'rubocop/cop/lint/empty_ensure'
78
79
  require 'rubocop/cop/lint/empty_interpolation'
@@ -164,6 +165,7 @@ require 'rubocop/cop/style/end_of_line'
164
165
  require 'rubocop/cop/style/even_odd'
165
166
  require 'rubocop/cop/style/extra_spacing'
166
167
  require 'rubocop/cop/style/file_name'
168
+ require 'rubocop/cop/style/first_parameter_indentation'
167
169
  require 'rubocop/cop/style/flip_flop'
168
170
  require 'rubocop/cop/style/for'
169
171
  require 'rubocop/cop/style/format_string'
@@ -227,6 +229,7 @@ require 'rubocop/cop/style/space_after_control_keyword'
227
229
  require 'rubocop/cop/style/space_after_method_name'
228
230
  require 'rubocop/cop/style/space_after_not'
229
231
  require 'rubocop/cop/style/space_after_semicolon'
232
+ require 'rubocop/cop/style/space_around_block_parameters'
230
233
  require 'rubocop/cop/style/space_around_equals_in_parameter_default'
231
234
  require 'rubocop/cop/style/space_around_operators'
232
235
  require 'rubocop/cop/style/space_before_block_braces'
@@ -242,6 +245,7 @@ require 'rubocop/cop/style/space_inside_range_literal'
242
245
  require 'rubocop/cop/style/special_global_vars'
243
246
  require 'rubocop/cop/style/string_literals'
244
247
  require 'rubocop/cop/style/string_literals_in_interpolation'
248
+ require 'rubocop/cop/style/struct_inheritance'
245
249
  require 'rubocop/cop/style/symbol_array'
246
250
  require 'rubocop/cop/style/symbol_proc'
247
251
  require 'rubocop/cop/style/tab'