rubocop 0.19.1 → 0.20.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 (192) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -0
  3. data/CHANGELOG.md +60 -1
  4. data/CONTRIBUTING.md +2 -1
  5. data/README.md +9 -7
  6. data/config/default.yml +3 -3
  7. data/config/disabled.yml +4 -0
  8. data/config/enabled.yml +45 -21
  9. data/lib/rubocop.rb +30 -9
  10. data/lib/rubocop/cli.rb +1 -1
  11. data/lib/rubocop/comment_config.rb +4 -2
  12. data/lib/rubocop/config.rb +16 -22
  13. data/lib/rubocop/config_loader.rb +29 -26
  14. data/lib/rubocop/cop/commissioner.rb +1 -1
  15. data/lib/rubocop/cop/cop.rb +6 -6
  16. data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
  17. data/lib/rubocop/cop/lint/condition_position.rb +1 -1
  18. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  19. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +9 -7
  20. data/lib/rubocop/cop/lint/else_layout.rb +1 -1
  21. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  22. data/lib/rubocop/cop/lint/empty_interpolation.rb +22 -0
  23. data/lib/rubocop/cop/lint/end_in_method.rb +1 -1
  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/literal_in_condition.rb +2 -2
  27. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +9 -0
  28. data/lib/rubocop/cop/lint/loop.rb +2 -2
  29. data/lib/rubocop/cop/lint/require_parentheses.rb +0 -4
  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/space_before_first_arg.rb +36 -0
  33. data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +14 -2
  34. data/lib/rubocop/cop/lint/useless_access_modifier.rb +57 -0
  35. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  36. data/lib/rubocop/cop/lint/void.rb +3 -3
  37. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
  38. data/lib/rubocop/cop/offense.rb +3 -21
  39. data/lib/rubocop/cop/rails/action_filter.rb +1 -1
  40. data/lib/rubocop/cop/rails/default_scope.rb +1 -1
  41. data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +1 -1
  42. data/lib/rubocop/cop/rails/read_write_attribute.rb +43 -0
  43. data/lib/rubocop/cop/rails/scope_args.rb +1 -1
  44. data/lib/rubocop/cop/rails/validation.rb +1 -1
  45. data/lib/rubocop/cop/severity.rb +76 -0
  46. data/lib/rubocop/cop/style/access_modifier_indentation.rb +1 -1
  47. data/lib/rubocop/cop/style/accessor_method_name.rb +2 -2
  48. data/lib/rubocop/cop/style/alias.rb +1 -1
  49. data/lib/rubocop/cop/style/align_hash.rb +1 -1
  50. data/lib/rubocop/cop/style/and_or.rb +1 -1
  51. data/lib/rubocop/cop/style/{favor_join.rb → array_join.rb} +2 -2
  52. data/lib/rubocop/cop/style/begin_block.rb +1 -1
  53. data/lib/rubocop/cop/style/block_nesting.rb +12 -8
  54. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +1 -1
  55. data/lib/rubocop/cop/style/case_equality.rb +1 -1
  56. data/lib/rubocop/cop/style/case_indentation.rb +5 -5
  57. data/lib/rubocop/cop/style/class_methods.rb +19 -3
  58. data/lib/rubocop/cop/style/class_vars.rb +1 -1
  59. data/lib/rubocop/cop/style/collection_methods.rb +17 -7
  60. data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
  61. data/lib/rubocop/cop/style/{def_parentheses.rb → def_with_parentheses.rb} +0 -0
  62. data/lib/rubocop/cop/style/{hash_methods.rb → deprecated_hash_methods.rb} +5 -4
  63. data/lib/rubocop/cop/style/double_negation.rb +1 -1
  64. data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +1 -1
  65. data/lib/rubocop/cop/style/end_block.rb +1 -1
  66. data/lib/rubocop/cop/style/even_odd.rb +2 -2
  67. data/lib/rubocop/cop/style/file_name.rb +1 -1
  68. data/lib/rubocop/cop/style/for.rb +2 -2
  69. data/lib/rubocop/cop/style/format_string.rb +1 -1
  70. data/lib/rubocop/cop/style/guard_clause.rb +69 -0
  71. data/lib/rubocop/cop/style/hash_syntax.rb +6 -10
  72. data/lib/rubocop/cop/style/if_unless_modifier.rb +2 -2
  73. data/lib/rubocop/cop/style/lambda.rb +2 -2
  74. data/lib/rubocop/cop/style/line_end_concatenation.rb +16 -9
  75. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  76. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +2 -2
  77. data/lib/rubocop/cop/style/negated_if.rb +37 -0
  78. data/lib/rubocop/cop/style/negated_while.rb +33 -0
  79. data/lib/rubocop/cop/style/nested_ternary_operator.rb +1 -1
  80. data/lib/rubocop/cop/style/nil_comparison.rb +14 -10
  81. data/lib/rubocop/cop/style/non_nil_check.rb +70 -0
  82. data/lib/rubocop/cop/style/not.rb +25 -1
  83. data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
  84. data/lib/rubocop/cop/style/op_method.rb +4 -4
  85. data/lib/rubocop/cop/style/parentheses_around_condition.rb +1 -1
  86. data/lib/rubocop/cop/style/predicate_name.rb +1 -1
  87. data/lib/rubocop/cop/style/proc.rb +1 -1
  88. data/lib/rubocop/cop/style/raise_args.rb +3 -2
  89. data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
  90. data/lib/rubocop/cop/style/self_assignment.rb +2 -2
  91. data/lib/rubocop/cop/style/signal_exception.rb +6 -3
  92. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  93. data/lib/rubocop/cop/style/single_line_methods.rb +6 -5
  94. data/lib/rubocop/cop/style/single_space_before_first_arg.rb +41 -0
  95. data/lib/rubocop/cop/style/space_around_operators.rb +1 -2
  96. data/lib/rubocop/cop/style/special_global_vars.rb +8 -8
  97. data/lib/rubocop/cop/style/trailing_comma.rb +1 -1
  98. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  99. data/lib/rubocop/cop/style/unless_else.rb +1 -1
  100. data/lib/rubocop/cop/style/variable_interpolation.rb +10 -5
  101. data/lib/rubocop/cop/style/when_then.rb +1 -1
  102. data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
  103. data/lib/rubocop/cop/style/word_array.rb +1 -1
  104. data/lib/rubocop/cop/team.rb +12 -13
  105. data/lib/rubocop/cop/util.rb +4 -0
  106. data/lib/rubocop/cop/variable_inspector/locatable.rb +1 -1
  107. data/lib/rubocop/cop/variable_inspector/variable_table.rb +1 -1
  108. data/lib/rubocop/file_inspector.rb +46 -10
  109. data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
  110. data/lib/rubocop/formatter/disabled_lines_formatter.rb +56 -0
  111. data/lib/rubocop/formatter/emacs_style_formatter.rb +1 -1
  112. data/lib/rubocop/formatter/formatter_set.rb +2 -1
  113. data/lib/rubocop/formatter/fuubar_style_formatter.rb +2 -4
  114. data/lib/rubocop/formatter/json_formatter.rb +3 -7
  115. data/lib/rubocop/formatter/progress_formatter.rb +1 -3
  116. data/lib/rubocop/formatter/simple_text_formatter.rb +7 -3
  117. data/lib/rubocop/options.rb +29 -10
  118. data/lib/rubocop/path_util.rb +2 -1
  119. data/lib/rubocop/processed_source.rb +8 -0
  120. data/lib/rubocop/target_finder.rb +33 -12
  121. data/lib/rubocop/version.rb +1 -1
  122. data/relnotes/v0.20.0.md +69 -0
  123. data/rubocop-todo.yml +2 -2
  124. data/spec/rubocop/cli_spec.rb +269 -94
  125. data/spec/rubocop/config_loader_spec.rb +14 -14
  126. data/spec/rubocop/config_spec.rb +8 -8
  127. data/spec/rubocop/cop/lint/deprecated_class_methods_spec.rb +11 -6
  128. data/spec/rubocop/cop/lint/empty_interpolation_spec.rb +18 -0
  129. data/spec/rubocop/cop/lint/eval_spec.rb +2 -4
  130. data/spec/rubocop/cop/lint/literal_in_interpolation_spec.rb +10 -0
  131. data/spec/rubocop/cop/lint/rescue_exception_spec.rb +0 -8
  132. data/spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb +4 -4
  133. data/spec/rubocop/cop/lint/space_before_first_arg_spec.rb +48 -0
  134. data/spec/rubocop/cop/lint/string_conversion_in_interpolation_spec.rb +10 -0
  135. data/spec/rubocop/cop/lint/useless_access_modifier_spec.rb +154 -0
  136. data/spec/rubocop/cop/offense_spec.rb +1 -1
  137. data/spec/rubocop/cop/rails/read_write_attribute_spec.rb +19 -0
  138. data/spec/rubocop/cop/severity_spec.rb +113 -0
  139. data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +10 -10
  140. data/spec/rubocop/cop/style/alias_spec.rb +2 -2
  141. data/spec/rubocop/cop/style/and_or_spec.rb +2 -2
  142. data/spec/rubocop/cop/style/{favor_join_spec.rb → array_join_spec.rb} +1 -3
  143. data/spec/rubocop/cop/style/block_nesting_spec.rb +4 -4
  144. data/spec/rubocop/cop/style/case_equality_spec.rb +1 -0
  145. data/spec/rubocop/cop/style/case_indentation_spec.rb +12 -9
  146. data/spec/rubocop/cop/style/class_methods_spec.rb +23 -0
  147. data/spec/rubocop/cop/style/collection_methods_spec.rb +2 -2
  148. data/spec/rubocop/cop/style/{hash_methods_spec.rb → deprecated_hash_methods_spec.rb} +3 -3
  149. data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +2 -2
  150. data/spec/rubocop/cop/style/even_odd_spec.rb +8 -8
  151. data/spec/rubocop/cop/style/file_name_spec.rb +55 -42
  152. data/spec/rubocop/cop/style/for_spec.rb +4 -4
  153. data/spec/rubocop/cop/style/format_string_spec.rb +10 -10
  154. data/spec/rubocop/cop/style/guard_clause_spec.rb +77 -0
  155. data/spec/rubocop/cop/style/hash_syntax_spec.rb +4 -2
  156. data/spec/rubocop/cop/style/if_unless_modifier_spec.rb +4 -4
  157. data/spec/rubocop/cop/style/lambda_spec.rb +2 -2
  158. data/spec/rubocop/cop/style/line_end_concatenation_spec.rb +21 -0
  159. data/spec/rubocop/cop/style/multiline_if_then_spec.rb +1 -1
  160. data/spec/rubocop/cop/style/{favor_unless_over_negated_if_spec.rb → negated_if_spec.rb} +8 -3
  161. data/spec/rubocop/cop/style/{favor_until_over_negated_while_spec.rb → negated_while_spec.rb} +8 -3
  162. data/spec/rubocop/cop/style/nil_comparison_spec.rb +7 -13
  163. data/spec/rubocop/cop/style/non_nil_check_spec.rb +35 -0
  164. data/spec/rubocop/cop/style/not_spec.rb +11 -0
  165. data/spec/rubocop/cop/style/numeric_literals_spec.rb +0 -2
  166. data/spec/rubocop/cop/style/op_method_spec.rb +10 -2
  167. data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +2 -2
  168. data/spec/rubocop/cop/style/predicate_name_spec.rb +2 -1
  169. data/spec/rubocop/cop/style/raise_args_spec.rb +5 -0
  170. data/spec/rubocop/cop/style/rescue_modifier_spec.rb +2 -2
  171. data/spec/rubocop/cop/style/self_assignment_spec.rb +4 -4
  172. data/spec/rubocop/cop/style/signal_exception_spec.rb +24 -0
  173. data/spec/rubocop/cop/style/single_line_block_params_spec.rb +2 -0
  174. data/spec/rubocop/cop/style/single_space_before_first_arg_spec.rb +63 -0
  175. data/spec/rubocop/cop/style/special_global_vars_spec.rb +6 -5
  176. data/spec/rubocop/cop/style/trivial_accessors_spec.rb +6 -3
  177. data/spec/rubocop/cop/style/unless_else_spec.rb +2 -4
  178. data/spec/rubocop/cop/style/variable_interpolation_spec.rb +15 -6
  179. data/spec/rubocop/cop/style/when_then_spec.rb +3 -4
  180. data/spec/rubocop/cop/team_spec.rb +4 -18
  181. data/spec/rubocop/file_inspector_spec.rb +4 -0
  182. data/spec/rubocop/formatter/disabled_config_formatter_spec.rb +1 -1
  183. data/spec/rubocop/formatter/disabled_lines_formatter_spec.rb +69 -0
  184. data/spec/rubocop/options_spec.rb +5 -0
  185. data/spec/rubocop/target_finder_spec.rb +42 -11
  186. data/spec/support/shared_context.rb +1 -1
  187. data/spec/support/statement_modifier_helper.rb +1 -1
  188. metadata +75 -50
  189. data/lib/rubocop/cop/rails/read_attribute.rb +0 -28
  190. data/lib/rubocop/cop/style/favor_unless_over_negated_if.rb +0 -24
  191. data/lib/rubocop/cop/style/favor_until_over_negated_while.rb +0 -20
  192. data/spec/rubocop/cop/rails/read_attribute_spec.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7123eae3f7c324c84d026c2aeb11ebddb376064
4
- data.tar.gz: 18fe22cdfb3bebefc347a49510eddfc2ef5bc39b
3
+ metadata.gz: 9bfa5cdcf23439710744d9065a22970e4c30918d
4
+ data.tar.gz: c931f4765d359ef1bf54ebb76c5393e6d0c223de
5
5
  SHA512:
6
- metadata.gz: d3435aa3b04824630ecccfbc802c7d4ef8c74f4d8b0c7d697cd2e2b6d535ca0c6e7953ddb2a2f741303f3fc307776725053c6d9e3dc7b7a61d4e73811cadf6bb
7
- data.tar.gz: dbc6fd5c8ab02d9f759c416d6a2e111f2715c4a9cb93620980e6bd8dac59b03d3b5c1b349fd59b86f0693b0dff9b66f1924870868e58c2a1245a5d90158c00d1
6
+ metadata.gz: cd67703e4e607f48f45618e3c28a250528dd658ab9d7258e93ad678978e6c17f1d0c47d57a4eafe0adbd1f796450de89f4d62fa144c008f343db8dfc314b32c6
7
+ data.tar.gz: c9812cfa4889a4f15c1f81bef017f5e256551cbcc43716f501609a06ef8d518b6514ed98a7c1784cadfe805db23b6e5180932551767b8e35b88050fbde557c30
@@ -4,8 +4,12 @@ rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
6
  - 2.1.0
7
+ - ruby-head
7
8
  - jruby-19mode
8
9
  - rbx-2
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: ruby-head
9
13
  before_install: gem update --remote bundler
10
14
  script:
11
15
  - bundle exec rspec
@@ -1,7 +1,62 @@
1
- # Changelog
1
+ # Change log
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.20.0 (02/04/2014)
6
+
7
+ ### New features
8
+
9
+ * New cop `GuardClause` checks for conditionals that can be replaced by guard clauses. ([@bbatsov][])
10
+ * New cop `EmptyInterpolation` checks for empty interpolation in double-quoted strings. ([@bbatsov][])
11
+ * [#899](https://github.com/bbatsov/rubocop/issues/899): Make `LineEndConcatenation` cop `<<` aware. ([@mockdeep][])
12
+ * [#896](https://github.com/bbatsov/rubocop/issues/896): New option `--fail-level` changes minimum severity for exit with error code. ([@hiroponz][])
13
+ * [#893](https://github.com/bbatsov/rubocop/issues/893): New option `--force-exclusion` forces excluding files specified in the configuration `Exclude` even if they are explicitly passed as arguments. ([@yujinakayama][])
14
+ * `VariableInterpolation` cop does auto-correction. ([@bbatsov][])
15
+ * `Not` cop does auto-correction. ([@bbatsov][])
16
+ * `ClassMethods` cop does auto-correction. ([@bbatsov][])
17
+ * `StringConversionInInterpolation` cop does auto-correction. ([@bbatsov][])
18
+ * `NilComparison` cop does auto-correction. ([@bbatsov][])
19
+ * `NonNilComparison` cop does auto-correction. ([@bbatsov][])
20
+ * `NegatedIf` cop does auto-correction. ([@bbatsov][])
21
+ * `NegatedWhile` cop does auto-correction. ([@bbatsov][])
22
+ * New lint cop `SpaceBeforeFirstArg` checks for space between the method name and the first argument in method calls without parentheses. ([@jonas054][])
23
+ * New style cop `SingleSpaceBeforeFirstArg` checks that no more than one space is used between the method name and the first argument in method calls without parentheses. ([@jonas054][])
24
+ * New formatter `disabled_lines` displays cops and line ranges disabled by inline comments. ([@fshowalter][])
25
+ * New cop `UselessAccessModifiers` checks for access modifiers that have no effect. ([@fshowalter][])
26
+
27
+ ### Changes
28
+
29
+ * [#913](https://github.com/bbatsov/rubocop/issues/913): `FileName` accepts multiple extensions. ([@tamird][])
30
+ * `AllCops/Excludes` and `AllCops/Includes` were renamed to `AllCops/Exclude` and `AllCops/Include` for consistency with standard cop params. ([@bbatsov][])
31
+ * Extract `NonNilCheck` cop from `NilComparison`. ([@bbatsov][])
32
+ * Renamed `FavorJoin` to `ArrayJoin`. ([@bbatsov][])
33
+ * Renamed `FavorUnlessOverNegatedIf` to `NegatedIf`. ([@bbatsov][])
34
+ * Renamed `FavorUntilOverNegatedWhile`to `NegatedWhile`. ([@bbatsov][])
35
+ * Renamed `HashMethods` to `DeprecatedHashMethods`. ([@bbatsov][])
36
+ * Renamed `ReadAttribute` to `ReadWriteAttribute` and extended it to check for uses of `write_attribute`. ([@bbatsov][])
37
+ * Add experimental support for Ruby 2.2 (development version) by falling back to Ruby 2.1 parser. ([@yujinakayama][])
38
+
39
+ ### Bugs fixed
40
+
41
+ * [#926](https://github.com/bbatsov/rubocop/issues/926): Fixed `BlockNesting` not auto-generating correctly. ([@tmorris-fiksu][])
42
+ * [#904](https://github.com/bbatsov/rubocop/issues/904): Fixed a NPE in `LiteralInInterpolation`. ([@bbatsov][])
43
+ * [#904](https://github.com/bbatsov/rubocop/issues/904): Fixed a NPE in `StringConversionInInterpolation`. ([@bbatsov][])
44
+ * [#892](https://github.com/bbatsov/rubocop/issues/892): Make sure `Include` and `Exclude` paths in a `.rubocop.yml` are interpreted as relative to the directory of that file. ([@jonas054][])
45
+ * [#906](https://github.com/bbatsov/rubocop/issues/906): Fixed a false positive in `LiteralInInterpolation`. ([@bbatsov][])
46
+ * [#909](https://github.com/bbatsov/rubocop/issues/909): Handle properly multiple `rescue` clauses in `SignalException`. ([@bbatsov][])
47
+ * [#876](https://github.com/bbatsov/rubocop/issues/876): Do a deep merge of hashes when overriding default configuration in a `.rubocop.yml` file. ([@jonas054][])
48
+ * [#912](https://github.com/bbatsov/rubocop/issues/912): Fix a false positive in `LineEndConcatenation` for `%` string literals. ([@bbatsov][])
49
+ * [#912](https://github.com/bbatsov/rubocop/issues/912): Handle top-level constant resolution in `DeprecatedClassMethods` (e.g. `::File.exists?`). ([@bbatsov][])
50
+ * [#914](https://github.com/bbatsov/rubocop/issues/914): Fixed rdoc error during gem installation. ([@bbatsov][])
51
+ * The `--only` option now enables the given cop in case it is disabled in configuration. ([@jonas054][])
52
+ * Fix path resolution so that the default exclusion of `vendor` directories works. ([@jonas054][])
53
+ * [#908](https://github.com/bbatsov/rubocop/issues/908): Fixed hanging while auto correct for `SpaceAfterComma` and `SpaceInsideBrackets`. ([@hiroponz][])
54
+ * [#919](https://github.com/bbatsov/rubocop/issues/919): Don't avoid auto-correction in `HashSyntax` when there is missing space around operator. ([@jonas054][])
55
+ * Fixed handling of floats in `NumericLiterals`. ([@bbatsov][])
56
+ * [#927](https://github.com/bbatsov/rubocop/issues/927): Let `--auto-gen-config` overwrite an existing `rubocop-todo.yml` file instead of asking the user to remove it. ([@jonas054][])
57
+ * [#936](https://github.com/bbatsov/rubocop/issues/936): Allow `_other` as well as `other` in `OpMethod`. ([@bbatsov][])
58
+
59
+
5
60
  ## 0.19.1 (17/03/2014)
6
61
 
7
62
  ### Bugs fixed
@@ -772,3 +827,7 @@
772
827
  [@geniou]: https://github.com/geniou
773
828
  [@jkogara]: https://github.com/jkogara
774
829
  [@tmorris-fiksu]: https://github.com/tmorris-fiksu
830
+ [@mockdeep]: https://github.com/mockdeep
831
+ [@hiroponz]: https://github.com/hiroponz
832
+ [@tamird]: https://github.com/tamird
833
+ [@fshowalter]: https://github.com/fshowalter
@@ -37,7 +37,7 @@ $ rubocop -V
37
37
  you want to have your own version, or is otherwise necessary, that
38
38
  is fine, but please isolate to its own commit so I can cherry-pick
39
39
  around it.
40
- * Make sure the test suite is passing and the code you wrote doesn't produce
40
+ * Make sure the test suite is passing ([including rbx and jruby][7]) and the code you wrote doesn't produce
41
41
  RuboCop offences.
42
42
  * [Squash related commits together][5].
43
43
  * Open a [pull request][4] that relates to *only* one subject with a clear title
@@ -65,3 +65,4 @@ Here are a few examples:
65
65
  [4]: https://help.github.com/articles/using-pull-requests
66
66
  [5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
67
67
  [6]: http://daringfireball.net/projects/markdown/syntax
68
+ [7]: http://blog.stwrt.ca/2013/09/06/installing-rubinius-with-rbenv
data/README.md CHANGED
@@ -141,6 +141,7 @@ Command flag | Description
141
141
  `--only` | Run only the specified cop
142
142
  `--auto-gen-config` | Generate a configuration file acting as a TODO list
143
143
  `--show-cops` | Shows available cops and their configuration
144
+ `--fail-level` | Minimum severity for exit with error code
144
145
 
145
146
  ### Cops
146
147
 
@@ -165,7 +166,7 @@ own. You can run only the lint cops like this:
165
166
  $ rubocop -l
166
167
  ```
167
168
 
168
- Disabling any of the lint cops in generally a bad idea.
169
+ Disabling any of the lint cops is generally a bad idea.
169
170
 
170
171
  #### Rails
171
172
 
@@ -235,17 +236,17 @@ RuboCop checks all files recursively within the directory it is run
235
236
  on. However, it only recognizes files ending with `.rb` or
236
237
  extensionless files with a `#!.*ruby` declaration as Ruby files. If
237
238
  you'd like it to check other files you'll need to manually pass them
238
- in, or to add entries for them under `AllCops`/`Includes`. Files and
239
- directories can also be ignored through `AllCops`/`Excludes`.
239
+ in, or to add entries for them under `AllCops`/`Include`. Files and
240
+ directories can also be ignored through `AllCops`/`Exclude`.
240
241
 
241
242
  Here is an example that might be used for a Rails project:
242
243
 
243
244
  ```yaml
244
245
  AllCops:
245
- Includes:
246
+ Include:
246
247
  - Rakefile
247
248
  - config.ru
248
- Excludes:
249
+ Exclude:
249
250
  - db/**
250
251
  - config/**
251
252
  - script/**
@@ -257,9 +258,9 @@ AllCops:
257
258
 
258
259
  Files and directories are specified relative to the `.rubocop.yml` file.
259
260
 
260
- **Note**: The `Excludes` parameter is special. It is valid for the
261
+ **Note**: The `Exclude` parameter is special. It is valid for the
261
262
  directory tree starting where it is defined. It is not shadowed by the
262
- setting of `Excludes` in other `.rubocop.yml` files in
263
+ setting of `Exclude` in other `.rubocop.yml` files in
263
264
  subdirectories. This is different from all other parameters, who
264
265
  follow RuboCop's general principle that configuration for an inspected
265
266
  file is taken from the nearest `.rubocop.yml`, searching upwards.
@@ -293,6 +294,7 @@ LineLength:
293
294
  ```
294
295
 
295
296
  Cops can customize their severity level. All cops support the `Severity` param.
297
+ Allowed params are `refactor`, `convention`, `warning`, `error` and `fatal`.
296
298
 
297
299
  ```yaml
298
300
  CyclomaticComplexity:
@@ -8,10 +8,10 @@ inherit_from:
8
8
  # Common configuration.
9
9
  AllCops:
10
10
  # Include gemspec and Rakefile
11
- Includes:
11
+ Include:
12
12
  - '**/*.gemspec'
13
13
  - '**/Rakefile'
14
- Excludes:
14
+ Exclude:
15
15
  - 'vendor/**'
16
16
  # By default, the rails cops are not run. Override in project or home
17
17
  # directory .rubocop.yml files, or by giving the -R/--rails option.
@@ -437,7 +437,7 @@ HasAndBelongsToMany:
437
437
  Include:
438
438
  - app/models/*.rb
439
439
 
440
- ReadAttribute:
440
+ ReadWriteAttribute:
441
441
  Include:
442
442
  - app/models/*.rb
443
443
 
@@ -1,5 +1,9 @@
1
1
  # These are all the cops that are disabled in the default configuration.
2
2
 
3
+ GuardClause:
4
+ Description: 'Check for conditionals that can be replaced with guard clauses'
5
+ Enabled: false
6
+
3
7
  MethodCalledOnDoEndBlock:
4
8
  Description: 'Avoid chaining a method call on a do...end block.'
5
9
  Enabled: false
@@ -34,6 +34,10 @@ AndOr:
34
34
  Description: 'Use &&/|| instead of and/or.'
35
35
  Enabled: true
36
36
 
37
+ ArrayJoin:
38
+ Description: 'Use Array#join instead of Array#*.'
39
+ Enabled: true
40
+
37
41
  AsciiComments:
38
42
  Description: 'Use only ascii symbols in comments.'
39
43
  Enabled: true
@@ -127,6 +131,10 @@ DefWithParentheses:
127
131
  Description: 'Use def with parentheses when there are arguments.'
128
132
  Enabled: true
129
133
 
134
+ DeprecatedHashMethods:
135
+ Description: 'Checks for use of deprecated Hash methods.'
136
+ Enabled: true
137
+
130
138
  Documentation:
131
139
  Description: 'Document classes and non-namespace modules.'
132
140
  Enabled: true
@@ -175,20 +183,6 @@ EvenOdd:
175
183
  Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
176
184
  Enabled: true
177
185
 
178
- FavorJoin:
179
- Description: 'Use Array#join instead of Array#*.'
180
- Enabled: true
181
-
182
- FavorUnlessOverNegatedIf:
183
- Description: >-
184
- Favor unless over if for negative conditions
185
- (or control flow or).
186
- Enabled: true
187
-
188
- FavorUntilOverNegatedWhile:
189
- Description: 'Favor until over while for negative conditions.'
190
- Enabled: true
191
-
192
186
  FileName:
193
187
  Description: 'Use snake_case for source file names.'
194
188
  Enabled: true
@@ -213,10 +207,6 @@ GlobalVars:
213
207
  Description: 'Do not introduce global variables.'
214
208
  Enabled: true
215
209
 
216
- HashMethods:
217
- Description: 'Checks for use of deprecated Hash methods.'
218
- Enabled: true
219
-
220
210
  HashSyntax:
221
211
  Description: >-
222
212
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -307,6 +297,16 @@ MultilineTernaryOperator:
307
297
  use if/unless instead.
308
298
  Enabled: true
309
299
 
300
+ NegatedIf:
301
+ Description: >-
302
+ Favor unless over if for negative conditions
303
+ (or control flow or).
304
+ Enabled: true
305
+
306
+ NegatedWhile:
307
+ Description: 'Favor until over while for negative conditions.'
308
+ Enabled: true
309
+
310
310
  NestedTernaryOperator:
311
311
  Description: 'Use one expression per branch in a ternary operator.'
312
312
  Enabled: true
@@ -315,6 +315,10 @@ NilComparison:
315
315
  Description: 'Prefer x.nil? to x == nil.'
316
316
  Enabled: true
317
317
 
318
+ NonNilCheck:
319
+ Description: 'Checks for redundant nil checks.'
320
+ Enabled: true
321
+
318
322
  Not:
319
323
  Description: 'Use ! instead of not.'
320
324
  Enabled: true
@@ -413,6 +417,12 @@ SingleLineMethods:
413
417
  Description: 'Avoid single-line methods.'
414
418
  Enabled: true
415
419
 
420
+ SingleSpaceBeforeFirstArg:
421
+ Description: >-
422
+ Checks that exactly one space is used between a method name
423
+ and the first argument for method calls without parentheses.
424
+ Enabled: true
425
+
416
426
  SpaceAfterColon:
417
427
  Description: 'Use spaces after colons.'
418
428
  Enabled: true
@@ -428,7 +438,7 @@ SpaceAfterControlKeyword:
428
438
  SpaceAfterMethodName:
429
439
  Description: >-
430
440
  Never put a space between a method name and the opening
431
- parenthesis.
441
+ parenthesis in a method definition.
432
442
  Enabled: true
433
443
 
434
444
  SpaceAfterNot:
@@ -584,6 +594,10 @@ EmptyEnsure:
584
594
  Description: 'Checks for empty ensure block.'
585
595
  Enabled: true
586
596
 
597
+ EmptyInterpolation:
598
+ Description: 'Checks for empty string interpolation.'
599
+ Enabled: true
600
+
587
601
  EndAlignment:
588
602
  Description: 'Align ends correctly.'
589
603
  Enabled: true
@@ -646,6 +660,12 @@ ShadowingOuterLocalVariable:
646
660
  for block arguments or block local variables.
647
661
  Enabled: true
648
662
 
663
+ SpaceBeforeFirstArg:
664
+ Description: >-
665
+ Put a space between a method name and the first argument
666
+ in a method call wihtout parentheses.
667
+ Enabled: true
668
+
649
669
  StringConversionInInterpolation:
650
670
  Description: 'Checks for Object#to_s usage in string interpolation.'
651
671
  Enabled: true
@@ -654,6 +674,10 @@ UnreachableCode:
654
674
  Description: 'Unreachable code.'
655
675
  Enabled: true
656
676
 
677
+ UselessAccessModifier:
678
+ Description: 'Checks for useless access modifiers.'
679
+ Enabled: true
680
+
657
681
  UselessAssignment:
658
682
  Description: 'Checks for useless assignment to a local variable.'
659
683
  Enabled: true
@@ -692,8 +716,8 @@ Output:
692
716
  Description: 'Checks for calls to puts, print, etc.'
693
717
  Enabled: true
694
718
 
695
- ReadAttribute:
696
- Description: 'Prefer self[:attribute] over read_attribute(:attribute).'
719
+ ReadWriteAttribute:
720
+ Description: 'Checks for read_attribute(:attr) and write_attribute(:attr, val).'
697
721
  Enabled: true
698
722
 
699
723
  ScopeArgs:
@@ -1,14 +1,27 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # Try to load the latest parser and fall back to the latest supported version,
4
+ # if parser does not yet support the current Ruby version.
5
+ # This should only be problem when using development Ruby builds.
6
+ begin
7
+ require 'parser/current'
8
+ rescue NotImplementedError => error
9
+ warn "Falling back to Ruby 2.1 parser: #{error.message}"
10
+ require 'parser/ruby21'
11
+ Parser::CurrentRuby = Parser::Ruby21
12
+ end
13
+
3
14
  require 'rainbow'
4
15
  # Rainbow 2.0 does not load the monkey-patch for String by default.
5
16
  require 'rainbow/ext/string' unless String.method_defined?(:color)
6
17
 
7
18
  require 'English'
8
19
  require 'set'
9
- require 'parser/current'
10
20
  require 'ast/sexp'
11
- require 'powerpack'
21
+ require 'powerpack/enumerable/drop_last'
22
+ require 'powerpack/hash/symbolize_keys'
23
+ require 'powerpack/string/blank'
24
+ require 'powerpack/string/strip_indent'
12
25
 
13
26
  require 'rubocop/version'
14
27
 
@@ -21,6 +34,7 @@ require 'rubocop/cop/cop'
21
34
  require 'rubocop/cop/commissioner'
22
35
  require 'rubocop/cop/corrector'
23
36
  require 'rubocop/cop/team'
37
+ require 'rubocop/cop/severity'
24
38
 
25
39
  require 'rubocop/cop/variable_inspector'
26
40
  require 'rubocop/cop/variable_inspector/locatable'
@@ -59,6 +73,7 @@ require 'rubocop/cop/lint/debugger'
59
73
  require 'rubocop/cop/lint/deprecated_class_methods'
60
74
  require 'rubocop/cop/lint/else_layout'
61
75
  require 'rubocop/cop/lint/empty_ensure'
76
+ require 'rubocop/cop/lint/empty_interpolation'
62
77
  require 'rubocop/cop/lint/end_alignment'
63
78
  require 'rubocop/cop/lint/end_in_method'
64
79
  require 'rubocop/cop/lint/ensure_return'
@@ -69,12 +84,14 @@ require 'rubocop/cop/lint/literal_in_condition'
69
84
  require 'rubocop/cop/lint/literal_in_interpolation'
70
85
  require 'rubocop/cop/lint/loop'
71
86
  require 'rubocop/cop/lint/parentheses_as_grouped_expression'
72
- require 'rubocop/cop/lint/rescue_exception'
73
87
  require 'rubocop/cop/lint/require_parentheses'
88
+ require 'rubocop/cop/lint/rescue_exception'
74
89
  require 'rubocop/cop/lint/shadowing_outer_local_variable'
90
+ require 'rubocop/cop/lint/space_before_first_arg'
75
91
  require 'rubocop/cop/lint/string_conversion_in_interpolation'
76
92
  require 'rubocop/cop/lint/syntax'
77
93
  require 'rubocop/cop/lint/unreachable_code'
94
+ require 'rubocop/cop/lint/useless_access_modifier'
78
95
  require 'rubocop/cop/lint/useless_assignment'
79
96
  require 'rubocop/cop/lint/useless_comparison'
80
97
  require 'rubocop/cop/lint/useless_else_without_rescue'
@@ -88,6 +105,7 @@ require 'rubocop/cop/style/align_array'
88
105
  require 'rubocop/cop/style/align_hash'
89
106
  require 'rubocop/cop/style/align_parameters'
90
107
  require 'rubocop/cop/style/and_or'
108
+ require 'rubocop/cop/style/array_join'
91
109
  require 'rubocop/cop/style/ascii_comments'
92
110
  require 'rubocop/cop/style/ascii_identifiers'
93
111
  require 'rubocop/cop/style/attr'
@@ -109,7 +127,8 @@ require 'rubocop/cop/style/colon_method_call'
109
127
  require 'rubocop/cop/style/comment_annotation'
110
128
  require 'rubocop/cop/style/constant_name'
111
129
  require 'rubocop/cop/style/cyclomatic_complexity'
112
- require 'rubocop/cop/style/def_parentheses'
130
+ require 'rubocop/cop/style/def_with_parentheses'
131
+ require 'rubocop/cop/style/deprecated_hash_methods'
113
132
  require 'rubocop/cop/style/documentation'
114
133
  require 'rubocop/cop/style/dot_position'
115
134
  require 'rubocop/cop/style/double_negation'
@@ -122,16 +141,13 @@ require 'rubocop/cop/style/encoding'
122
141
  require 'rubocop/cop/style/end_block'
123
142
  require 'rubocop/cop/style/end_of_line'
124
143
  require 'rubocop/cop/style/even_odd'
125
- require 'rubocop/cop/style/favor_join'
126
- require 'rubocop/cop/style/favor_unless_over_negated_if'
127
- require 'rubocop/cop/style/favor_until_over_negated_while'
128
144
  require 'rubocop/cop/style/file_name'
129
145
  require 'rubocop/cop/style/final_newline'
130
146
  require 'rubocop/cop/style/flip_flop'
131
147
  require 'rubocop/cop/style/for'
132
148
  require 'rubocop/cop/style/format_string'
133
149
  require 'rubocop/cop/style/global_vars'
134
- require 'rubocop/cop/style/hash_methods'
150
+ require 'rubocop/cop/style/guard_clause'
135
151
  require 'rubocop/cop/style/hash_syntax'
136
152
  require 'rubocop/cop/style/if_unless_modifier'
137
153
  require 'rubocop/cop/style/if_with_semicolon'
@@ -153,8 +169,11 @@ require 'rubocop/cop/style/module_function'
153
169
  require 'rubocop/cop/style/multiline_block_chain'
154
170
  require 'rubocop/cop/style/multiline_if_then'
155
171
  require 'rubocop/cop/style/multiline_ternary_operator'
172
+ require 'rubocop/cop/style/negated_if'
173
+ require 'rubocop/cop/style/negated_while'
156
174
  require 'rubocop/cop/style/nested_ternary_operator'
157
175
  require 'rubocop/cop/style/nil_comparison'
176
+ require 'rubocop/cop/style/non_nil_check'
158
177
  require 'rubocop/cop/style/not'
159
178
  require 'rubocop/cop/style/numeric_literals'
160
179
  require 'rubocop/cop/style/one_line_conditional'
@@ -177,6 +196,7 @@ require 'rubocop/cop/style/semicolon'
177
196
  require 'rubocop/cop/style/signal_exception'
178
197
  require 'rubocop/cop/style/single_line_block_params'
179
198
  require 'rubocop/cop/style/single_line_methods'
199
+ require 'rubocop/cop/style/single_space_before_first_arg'
180
200
  require 'rubocop/cop/style/space_after_colon'
181
201
  require 'rubocop/cop/style/space_after_comma'
182
202
  require 'rubocop/cop/style/space_after_control_keyword'
@@ -211,12 +231,13 @@ require 'rubocop/cop/rails/action_filter'
211
231
  require 'rubocop/cop/rails/default_scope'
212
232
  require 'rubocop/cop/rails/has_and_belongs_to_many'
213
233
  require 'rubocop/cop/rails/output'
214
- require 'rubocop/cop/rails/read_attribute'
234
+ require 'rubocop/cop/rails/read_write_attribute'
215
235
  require 'rubocop/cop/rails/scope_args'
216
236
  require 'rubocop/cop/rails/validation'
217
237
 
218
238
  require 'rubocop/formatter/base_formatter'
219
239
  require 'rubocop/formatter/simple_text_formatter'
240
+ require 'rubocop/formatter/disabled_lines_formatter'
220
241
  require 'rubocop/formatter/disabled_config_formatter'
221
242
  require 'rubocop/formatter/emacs_style_formatter'
222
243
  require 'rubocop/formatter/clang_style_formatter'