rubocop 0.18.1 → 0.19.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 (398) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +65 -1
  4. data/Gemfile +0 -3
  5. data/LICENSE.txt +1 -1
  6. data/README.md +179 -77
  7. data/Rakefile +8 -0
  8. data/config/default.yml +151 -14
  9. data/config/enabled.yml +65 -8
  10. data/lib/rubocop.rb +19 -4
  11. data/lib/rubocop/cli.rb +2 -1
  12. data/lib/rubocop/comment_config.rb +97 -0
  13. data/lib/rubocop/config.rb +1 -1
  14. data/lib/rubocop/config_loader.rb +3 -2
  15. data/lib/rubocop/config_store.rb +6 -2
  16. data/lib/rubocop/cop/commissioner.rb +2 -2
  17. data/lib/rubocop/cop/cop.rb +22 -26
  18. data/lib/rubocop/cop/lint/ambiguous_operator.rb +2 -2
  19. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +1 -1
  20. data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
  21. data/lib/rubocop/cop/lint/block_alignment.rb +6 -6
  22. data/lib/rubocop/cop/lint/condition_position.rb +1 -1
  23. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  24. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +60 -0
  25. data/lib/rubocop/cop/lint/else_layout.rb +1 -1
  26. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  27. data/lib/rubocop/cop/lint/end_alignment.rb +14 -12
  28. data/lib/rubocop/cop/lint/end_in_method.rb +1 -1
  29. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  30. data/lib/rubocop/cop/lint/eval.rb +1 -1
  31. data/lib/rubocop/cop/lint/handle_exceptions.rb +1 -1
  32. data/lib/rubocop/cop/lint/literal_in_condition.rb +13 -2
  33. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +28 -0
  34. data/lib/rubocop/cop/lint/loop.rb +4 -4
  35. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
  36. data/lib/rubocop/cop/lint/require_parentheses.rb +6 -6
  37. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  38. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +2 -2
  39. data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +30 -0
  40. data/lib/rubocop/cop/lint/syntax.rb +5 -5
  41. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  42. data/lib/rubocop/cop/lint/useless_assignment.rb +5 -5
  43. data/lib/rubocop/cop/lint/useless_comparison.rb +1 -1
  44. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  45. data/lib/rubocop/cop/lint/void.rb +5 -5
  46. data/lib/rubocop/cop/mixin/autocorrect_alignment.rb +8 -5
  47. data/lib/rubocop/cop/mixin/code_length.rb +2 -2
  48. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +7 -7
  49. data/lib/rubocop/cop/mixin/configurable_max.rb +1 -1
  50. data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
  51. data/lib/rubocop/cop/mixin/if_then_else.rb +1 -1
  52. data/lib/rubocop/cop/mixin/negative_conditional.rb +1 -1
  53. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +2 -2
  54. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +3 -2
  55. data/lib/rubocop/cop/mixin/space_inside.rb +1 -1
  56. data/lib/rubocop/cop/mixin/statement_modifier.rb +1 -0
  57. data/lib/rubocop/cop/mixin/string_help.rb +4 -4
  58. data/lib/rubocop/cop/{offence.rb → offense.rb} +7 -7
  59. data/lib/rubocop/cop/rails/action_filter.rb +73 -0
  60. data/lib/rubocop/cop/rails/default_scope.rb +1 -1
  61. data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +1 -1
  62. data/lib/rubocop/cop/rails/output.rb +1 -10
  63. data/lib/rubocop/cop/rails/read_attribute.rb +1 -1
  64. data/lib/rubocop/cop/rails/scope_args.rb +33 -0
  65. data/lib/rubocop/cop/rails/validation.rb +1 -1
  66. data/lib/rubocop/cop/style/access_modifier_indentation.rb +1 -1
  67. data/lib/rubocop/cop/style/accessor_method_name.rb +2 -2
  68. data/lib/rubocop/cop/style/alias.rb +2 -2
  69. data/lib/rubocop/cop/style/align_array.rb +1 -1
  70. data/lib/rubocop/cop/style/align_hash.rb +29 -2
  71. data/lib/rubocop/cop/style/align_parameters.rb +16 -2
  72. data/lib/rubocop/cop/style/and_or.rb +2 -2
  73. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  74. data/lib/rubocop/cop/style/ascii_identifiers.rb +1 -1
  75. data/lib/rubocop/cop/style/attr.rb +1 -1
  76. data/lib/rubocop/cop/style/begin_block.rb +1 -1
  77. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  78. data/lib/rubocop/cop/style/block_nesting.rb +1 -1
  79. data/lib/rubocop/cop/style/blocks.rb +2 -2
  80. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +2 -2
  81. data/lib/rubocop/cop/style/case_equality.rb +1 -1
  82. data/lib/rubocop/cop/style/case_indentation.rb +2 -2
  83. data/lib/rubocop/cop/style/character_literal.rb +2 -2
  84. data/lib/rubocop/cop/style/class_and_module_camel_case.rb +1 -1
  85. data/lib/rubocop/cop/style/class_and_module_children.rb +69 -0
  86. data/lib/rubocop/cop/style/class_methods.rb +1 -1
  87. data/lib/rubocop/cop/style/class_vars.rb +3 -3
  88. data/lib/rubocop/cop/style/collection_methods.rb +4 -4
  89. data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
  90. data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
  91. data/lib/rubocop/cop/style/constant_name.rb +1 -1
  92. data/lib/rubocop/cop/style/cyclomatic_complexity.rb +2 -2
  93. data/lib/rubocop/cop/style/def_parentheses.rb +2 -2
  94. data/lib/rubocop/cop/style/documentation.rb +1 -1
  95. data/lib/rubocop/cop/style/dot_position.rb +10 -11
  96. data/lib/rubocop/cop/style/double_negation.rb +40 -0
  97. data/lib/rubocop/cop/style/empty_line_between_defs.rb +8 -1
  98. data/lib/rubocop/cop/style/empty_lines.rb +3 -2
  99. data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +1 -1
  100. data/lib/rubocop/cop/style/empty_lines_around_body.rb +1 -1
  101. data/lib/rubocop/cop/style/empty_literal.rb +3 -3
  102. data/lib/rubocop/cop/style/encoding.rb +1 -1
  103. data/lib/rubocop/cop/style/end_block.rb +1 -1
  104. data/lib/rubocop/cop/style/end_of_line.rb +2 -2
  105. data/lib/rubocop/cop/style/even_odd.rb +2 -2
  106. data/lib/rubocop/cop/style/favor_join.rb +1 -1
  107. data/lib/rubocop/cop/style/file_name.rb +29 -0
  108. data/lib/rubocop/cop/style/final_newline.rb +1 -1
  109. data/lib/rubocop/cop/style/flip_flop.rb +2 -2
  110. data/lib/rubocop/cop/style/for.rb +2 -2
  111. data/lib/rubocop/cop/style/format_string.rb +66 -0
  112. data/lib/rubocop/cop/style/global_vars.rb +2 -2
  113. data/lib/rubocop/cop/style/hash_methods.rb +1 -1
  114. data/lib/rubocop/cop/style/hash_syntax.rb +3 -3
  115. data/lib/rubocop/cop/style/if_unless_modifier.rb +2 -1
  116. data/lib/rubocop/cop/style/indent_array.rb +41 -0
  117. data/lib/rubocop/cop/style/indent_hash.rb +119 -0
  118. data/lib/rubocop/cop/style/indentation_consistency.rb +3 -11
  119. data/lib/rubocop/cop/style/indentation_width.rb +44 -23
  120. data/lib/rubocop/cop/style/lambda.rb +2 -2
  121. data/lib/rubocop/cop/style/lambda_call.rb +3 -3
  122. data/lib/rubocop/cop/style/leading_comment_space.rb +1 -1
  123. data/lib/rubocop/cop/style/line_end_concatenation.rb +7 -3
  124. data/lib/rubocop/cop/style/line_length.rb +2 -2
  125. data/lib/rubocop/cop/style/method_call_parentheses.rb +2 -2
  126. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +2 -2
  127. data/lib/rubocop/cop/style/method_def_parentheses.rb +9 -7
  128. data/lib/rubocop/cop/style/module_function.rb +1 -1
  129. data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
  130. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
  131. data/lib/rubocop/cop/style/nested_ternary_operator.rb +2 -2
  132. data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
  133. data/lib/rubocop/cop/style/not.rb +1 -1
  134. data/lib/rubocop/cop/style/numeric_literals.rb +5 -5
  135. data/lib/rubocop/cop/style/op_method.rb +2 -2
  136. data/lib/rubocop/cop/style/parameter_lists.rb +1 -1
  137. data/lib/rubocop/cop/style/parentheses_around_condition.rb +5 -4
  138. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +143 -0
  139. data/lib/rubocop/cop/style/perl_backrefs.rb +1 -1
  140. data/lib/rubocop/cop/style/predicate_name.rb +1 -1
  141. data/lib/rubocop/cop/style/proc.rb +1 -1
  142. data/lib/rubocop/cop/style/raise_args.rb +2 -2
  143. data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
  144. data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
  145. data/lib/rubocop/cop/style/redundant_return.rb +1 -1
  146. data/lib/rubocop/cop/style/redundant_self.rb +2 -2
  147. data/lib/rubocop/cop/style/regexp_literal.rb +45 -19
  148. data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
  149. data/lib/rubocop/cop/style/self_assignment.rb +73 -0
  150. data/lib/rubocop/cop/style/semicolon.rb +12 -8
  151. data/lib/rubocop/cop/style/signal_exception.rb +2 -2
  152. data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
  153. data/lib/rubocop/cop/style/single_line_methods.rb +38 -1
  154. data/lib/rubocop/cop/style/space_after_colon.rb +3 -3
  155. data/lib/rubocop/cop/style/space_after_comma.rb +1 -1
  156. data/lib/rubocop/cop/style/space_after_control_keyword.rb +1 -1
  157. data/lib/rubocop/cop/style/space_after_method_name.rb +11 -3
  158. data/lib/rubocop/cop/style/space_after_not.rb +1 -1
  159. data/lib/rubocop/cop/style/space_after_semicolon.rb +1 -1
  160. data/lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb +41 -6
  161. data/lib/rubocop/cop/style/space_around_operators.rb +4 -4
  162. data/lib/rubocop/cop/style/space_before_block_braces.rb +63 -0
  163. data/lib/rubocop/cop/style/space_before_modifier_keyword.rb +1 -1
  164. data/lib/rubocop/cop/style/{space_around_block_braces.rb → space_inside_block_braces.rb} +15 -24
  165. data/lib/rubocop/cop/style/space_inside_hash_literal_braces.rb +14 -7
  166. data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
  167. data/lib/rubocop/cop/style/string_literals.rb +1 -1
  168. data/lib/rubocop/cop/style/symbol_array.rb +1 -1
  169. data/lib/rubocop/cop/style/tab.rb +1 -1
  170. data/lib/rubocop/cop/style/trailing_blank_lines.rb +2 -2
  171. data/lib/rubocop/cop/style/trailing_comma.rb +4 -4
  172. data/lib/rubocop/cop/style/trailing_whitespace.rb +1 -1
  173. data/lib/rubocop/cop/style/trivial_accessors.rb +2 -2
  174. data/lib/rubocop/cop/style/unless_else.rb +1 -1
  175. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
  176. data/lib/rubocop/cop/style/when_then.rb +1 -1
  177. data/lib/rubocop/cop/style/while_until_do.rb +1 -1
  178. data/lib/rubocop/cop/style/while_until_modifier.rb +2 -1
  179. data/lib/rubocop/cop/style/word_array.rb +2 -2
  180. data/lib/rubocop/cop/team.rb +24 -7
  181. data/lib/rubocop/cop/util.rb +3 -3
  182. data/lib/rubocop/cop/variable_inspector.rb +25 -13
  183. data/lib/rubocop/cop/variable_inspector/assignment.rb +1 -1
  184. data/lib/rubocop/cop/variable_inspector/reference.rb +1 -1
  185. data/lib/rubocop/cop/variable_inspector/scope.rb +1 -1
  186. data/lib/rubocop/cop/variable_inspector/variable.rb +2 -2
  187. data/lib/rubocop/cop/variable_inspector/variable_table.rb +1 -1
  188. data/lib/rubocop/file_inspector.rb +12 -13
  189. data/lib/rubocop/formatter/base_formatter.rb +4 -4
  190. data/lib/rubocop/formatter/clang_style_formatter.rb +2 -2
  191. data/lib/rubocop/formatter/disabled_config_formatter.rb +12 -12
  192. data/lib/rubocop/formatter/emacs_style_formatter.rb +3 -2
  193. data/lib/rubocop/formatter/file_list_formatter.rb +4 -4
  194. data/lib/rubocop/formatter/formatter_set.rb +2 -1
  195. data/lib/rubocop/formatter/fuubar_style_formatter.rb +76 -0
  196. data/lib/rubocop/formatter/json_formatter.rb +17 -16
  197. data/lib/rubocop/formatter/offense_count_formatter.rb +54 -0
  198. data/lib/rubocop/formatter/progress_formatter.rb +16 -16
  199. data/lib/rubocop/formatter/simple_text_formatter.rb +25 -25
  200. data/lib/rubocop/options.rb +8 -7
  201. data/lib/rubocop/processed_source.rb +3 -2
  202. data/lib/rubocop/source_parser.rb +1 -59
  203. data/lib/rubocop/version.rb +3 -3
  204. data/relnotes/0.19.0.md +70 -0
  205. data/rubocop-todo.yml +6 -6
  206. data/rubocop.gemspec +2 -1
  207. data/spec/rubocop/cli_spec.rb +431 -268
  208. data/spec/rubocop/comment_config_spec.rb +103 -0
  209. data/spec/rubocop/config_loader_spec.rb +4 -4
  210. data/spec/rubocop/cop/commissioner_spec.rb +7 -7
  211. data/spec/rubocop/cop/cop_spec.rb +17 -17
  212. data/spec/rubocop/cop/lint/ambiguous_operator_spec.rb +16 -16
  213. data/spec/rubocop/cop/lint/ambiguous_regexp_literal_spec.rb +5 -5
  214. data/spec/rubocop/cop/lint/assignment_in_condition_spec.rb +19 -19
  215. data/spec/rubocop/cop/lint/block_alignment_spec.rb +52 -52
  216. data/spec/rubocop/cop/lint/condition_position_spec.rb +7 -7
  217. data/spec/rubocop/cop/lint/debugger_spec.rb +10 -10
  218. data/spec/rubocop/cop/lint/deprecated_class_methods_spec.rb +33 -0
  219. data/spec/rubocop/cop/lint/else_layout_spec.rb +7 -7
  220. data/spec/rubocop/cop/lint/empty_ensure_spec.rb +4 -4
  221. data/spec/rubocop/cop/lint/end_alignment_spec.rb +33 -34
  222. data/spec/rubocop/cop/lint/end_in_method_spec.rb +5 -5
  223. data/spec/rubocop/cop/lint/ensure_return_spec.rb +4 -4
  224. data/spec/rubocop/cop/lint/eval_spec.rb +8 -8
  225. data/spec/rubocop/cop/lint/handle_exceptions_spec.rb +4 -4
  226. data/spec/rubocop/cop/lint/invalid_character_literal_spec.rb +3 -3
  227. data/spec/rubocop/cop/lint/literal_in_condition_spec.rb +65 -10
  228. data/spec/rubocop/cop/lint/literal_in_interpolation_spec.rb +21 -0
  229. data/spec/rubocop/cop/lint/loop_spec.rb +6 -6
  230. data/spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb +14 -14
  231. data/spec/rubocop/cop/lint/require_parentheses_spec.rb +15 -15
  232. data/spec/rubocop/cop/lint/rescue_exception_spec.rb +21 -21
  233. data/spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb +16 -16
  234. data/spec/rubocop/cop/lint/string_conversion_in_interpolation_spec.rb +27 -0
  235. data/spec/rubocop/cop/lint/syntax_spec.rb +11 -11
  236. data/spec/rubocop/cop/lint/unreachable_code_spec.rb +8 -8
  237. data/spec/rubocop/cop/lint/useless_assignment_spec.rb +207 -169
  238. data/spec/rubocop/cop/lint/useless_comparison_spec.rb +5 -5
  239. data/spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb +4 -4
  240. data/spec/rubocop/cop/lint/useless_setter_call_spec.rb +17 -17
  241. data/spec/rubocop/cop/lint/void_spec.rb +8 -8
  242. data/spec/rubocop/cop/{offence_spec.rb → offense_spec.rb} +17 -17
  243. data/spec/rubocop/cop/rails/action_filter_spec.rb +69 -0
  244. data/spec/rubocop/cop/rails/default_scope_spec.rb +9 -9
  245. data/spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb +2 -2
  246. data/spec/rubocop/cop/rails/output_spec.rb +8 -18
  247. data/spec/rubocop/cop/rails/read_attribute_spec.rb +2 -2
  248. data/spec/rubocop/cop/rails/scope_args_spec.rb +25 -0
  249. data/spec/rubocop/cop/rails/validation_spec.rb +3 -3
  250. data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +38 -38
  251. data/spec/rubocop/cop/style/accessor_method_name_spec.rb +14 -14
  252. data/spec/rubocop/cop/style/alias_spec.rb +11 -11
  253. data/spec/rubocop/cop/style/align_array_spec.rb +23 -7
  254. data/spec/rubocop/cop/style/align_hash_spec.rb +111 -30
  255. data/spec/rubocop/cop/style/align_parameters_spec.rb +260 -187
  256. data/spec/rubocop/cop/style/and_or_spec.rb +6 -6
  257. data/spec/rubocop/cop/style/ascii_comments_spec.rb +3 -3
  258. data/spec/rubocop/cop/style/ascii_identifiers_spec.rb +5 -5
  259. data/spec/rubocop/cop/style/attr_spec.rb +2 -2
  260. data/spec/rubocop/cop/style/begin_block_spec.rb +2 -2
  261. data/spec/rubocop/cop/style/block_comments_spec.rb +3 -3
  262. data/spec/rubocop/cop/style/block_nesting_spec.rb +26 -26
  263. data/spec/rubocop/cop/style/blocks_spec.rb +8 -8
  264. data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +8 -8
  265. data/spec/rubocop/cop/style/case_equality_spec.rb +2 -2
  266. data/spec/rubocop/cop/style/case_indentation_spec.rb +21 -21
  267. data/spec/rubocop/cop/style/character_literal_spec.rb +6 -6
  268. data/spec/rubocop/cop/style/class_and_module_camel_case_spec.rb +4 -4
  269. data/spec/rubocop/cop/style/class_and_module_children_spec.rb +129 -0
  270. data/spec/rubocop/cop/style/class_length_spec.rb +9 -9
  271. data/spec/rubocop/cop/style/class_methods_spec.rb +8 -8
  272. data/spec/rubocop/cop/style/class_vars_spec.rb +4 -4
  273. data/spec/rubocop/cop/style/collection_methods_spec.rb +6 -6
  274. data/spec/rubocop/cop/style/colon_method_call_spec.rb +16 -16
  275. data/spec/rubocop/cop/style/comment_annotation_spec.rb +16 -16
  276. data/spec/rubocop/cop/style/constant_name_spec.rb +12 -12
  277. data/spec/rubocop/cop/style/cyclomatic_complexity_spec.rb +16 -16
  278. data/spec/rubocop/cop/style/def_with_parentheses_spec.rb +6 -6
  279. data/spec/rubocop/cop/style/documentation_spec.rb +14 -14
  280. data/spec/rubocop/cop/style/dot_position_spec.rb +23 -26
  281. data/spec/rubocop/cop/style/double_negation_spec.rb +22 -0
  282. data/spec/rubocop/cop/style/empty_line_between_defs_spec.rb +22 -14
  283. data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +4 -4
  284. data/spec/rubocop/cop/style/empty_lines_around_body_spec.rb +20 -20
  285. data/spec/rubocop/cop/style/empty_lines_spec.rb +17 -6
  286. data/spec/rubocop/cop/style/empty_literal_spec.rb +20 -20
  287. data/spec/rubocop/cop/style/encoding_spec.rb +5 -5
  288. data/spec/rubocop/cop/style/end_block_spec.rb +2 -2
  289. data/spec/rubocop/cop/style/end_of_line_spec.rb +4 -4
  290. data/spec/rubocop/cop/style/even_odd_spec.rb +18 -18
  291. data/spec/rubocop/cop/style/favor_join_spec.rb +7 -7
  292. data/spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb +7 -7
  293. data/spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb +3 -3
  294. data/spec/rubocop/cop/style/file_name_spec.rb +71 -0
  295. data/spec/rubocop/cop/style/final_newline_spec.rb +4 -4
  296. data/spec/rubocop/cop/style/flip_flop_spec.rb +4 -4
  297. data/spec/rubocop/cop/style/for_spec.rb +13 -13
  298. data/spec/rubocop/cop/style/format_string_spec.rb +136 -0
  299. data/spec/rubocop/cop/style/global_vars_spec.rb +7 -7
  300. data/spec/rubocop/cop/style/hash_methods_spec.rb +6 -6
  301. data/spec/rubocop/cop/style/hash_syntax_spec.rb +11 -11
  302. data/spec/rubocop/cop/style/if_unless_modifier_spec.rb +29 -11
  303. data/spec/rubocop/cop/style/if_with_semicolon_spec.rb +1 -1
  304. data/spec/rubocop/cop/style/indent_array_spec.rb +136 -0
  305. data/spec/rubocop/cop/style/indent_hash_spec.rb +238 -0
  306. data/spec/rubocop/cop/style/indentation_consistency_spec.rb +69 -49
  307. data/spec/rubocop/cop/style/indentation_width_spec.rb +264 -128
  308. data/spec/rubocop/cop/style/lambda_call_spec.rb +14 -14
  309. data/spec/rubocop/cop/style/lambda_spec.rb +7 -7
  310. data/spec/rubocop/cop/style/leading_comment_space_spec.rb +15 -15
  311. data/spec/rubocop/cop/style/line_end_concatenation_spec.rb +11 -4
  312. data/spec/rubocop/cop/style/line_length_spec.rb +5 -5
  313. data/spec/rubocop/cop/style/method_call_parentheses_spec.rb +5 -5
  314. data/spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb +9 -9
  315. data/spec/rubocop/cop/style/method_def_parentheses_spec.rb +19 -19
  316. data/spec/rubocop/cop/style/method_length_spec.rb +17 -17
  317. data/spec/rubocop/cop/style/method_name_spec.rb +21 -21
  318. data/spec/rubocop/cop/style/module_function_spec.rb +3 -3
  319. data/spec/rubocop/cop/style/multiline_block_chain_spec.rb +13 -13
  320. data/spec/rubocop/cop/style/multiline_if_then_spec.rb +10 -10
  321. data/spec/rubocop/cop/style/multiline_ternary_operator_spec.rb +3 -3
  322. data/spec/rubocop/cop/style/nested_ternary_operator_spec.rb +3 -3
  323. data/spec/rubocop/cop/style/nil_comparison_spec.rb +7 -7
  324. data/spec/rubocop/cop/style/not_spec.rb +6 -11
  325. data/spec/rubocop/cop/style/numeric_literals_spec.rb +8 -8
  326. data/spec/rubocop/cop/style/one_line_conditional_spec.rb +1 -1
  327. data/spec/rubocop/cop/style/op_method_spec.rb +13 -13
  328. data/spec/rubocop/cop/style/parameter_lists_spec.rb +6 -6
  329. data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +11 -10
  330. data/spec/rubocop/cop/style/percent_literal_delimiters_spec.rb +250 -0
  331. data/spec/rubocop/cop/style/perl_backrefs_spec.rb +2 -2
  332. data/spec/rubocop/cop/style/predicate_name_spec.rb +3 -3
  333. data/spec/rubocop/cop/style/proc_spec.rb +4 -4
  334. data/spec/rubocop/cop/style/raise_args_spec.rb +20 -20
  335. data/spec/rubocop/cop/style/redundant_begin_spec.rb +6 -6
  336. data/spec/rubocop/cop/style/redundant_exception_spec.rb +6 -6
  337. data/spec/rubocop/cop/style/redundant_return_spec.rb +22 -22
  338. data/spec/rubocop/cop/style/redundant_self_spec.rb +14 -14
  339. data/spec/rubocop/cop/style/regexp_literal_spec.rb +88 -67
  340. data/spec/rubocop/cop/style/rescue_modifier_spec.rb +17 -17
  341. data/spec/rubocop/cop/style/self_assignment_spec.rb +43 -0
  342. data/spec/rubocop/cop/style/semicolon_spec.rb +31 -17
  343. data/spec/rubocop/cop/style/signal_exception_spec.rb +29 -29
  344. data/spec/rubocop/cop/style/single_line_block_params_spec.rb +6 -6
  345. data/spec/rubocop/cop/style/single_line_methods_spec.rb +44 -6
  346. data/spec/rubocop/cop/style/space_after_colon_spec.rb +1 -1
  347. data/spec/rubocop/cop/style/space_after_comma_spec.rb +3 -3
  348. data/spec/rubocop/cop/style/space_after_control_keyword_spec.rb +12 -12
  349. data/spec/rubocop/cop/style/space_after_method_name_spec.rb +8 -8
  350. data/spec/rubocop/cop/style/space_after_not_spec.rb +3 -3
  351. data/spec/rubocop/cop/style/space_after_semicolon_spec.rb +1 -1
  352. data/spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb +63 -21
  353. data/spec/rubocop/cop/style/space_around_operators_spec.rb +24 -24
  354. data/spec/rubocop/cop/style/space_before_block_braces_spec.rb +72 -0
  355. data/spec/rubocop/cop/style/space_before_modifier_keyword_spec.rb +4 -4
  356. data/spec/rubocop/cop/style/{space_around_block_braces_spec.rb → space_inside_block_braces_spec.rb} +39 -41
  357. data/spec/rubocop/cop/style/space_inside_brackets_spec.rb +1 -1
  358. data/spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb +15 -15
  359. data/spec/rubocop/cop/style/space_inside_parens_spec.rb +1 -1
  360. data/spec/rubocop/cop/style/special_global_vars_spec.rb +10 -10
  361. data/spec/rubocop/cop/style/string_literals_spec.rb +31 -31
  362. data/spec/rubocop/cop/style/symbol_array_spec.rb +9 -9
  363. data/spec/rubocop/cop/style/tab_spec.rb +3 -3
  364. data/spec/rubocop/cop/style/trailing_blank_lines_spec.rb +3 -3
  365. data/spec/rubocop/cop/style/trailing_comma_spec.rb +32 -32
  366. data/spec/rubocop/cop/style/trailing_whitespace_spec.rb +5 -5
  367. data/spec/rubocop/cop/style/trivial_accessors_spec.rb +39 -39
  368. data/spec/rubocop/cop/style/unless_else_spec.rb +1 -1
  369. data/spec/rubocop/cop/style/variable_interpolation_spec.rb +12 -12
  370. data/spec/rubocop/cop/style/variable_name_spec.rb +21 -21
  371. data/spec/rubocop/cop/style/when_then_spec.rb +1 -1
  372. data/spec/rubocop/cop/style/while_until_do_spec.rb +8 -8
  373. data/spec/rubocop/cop/style/while_until_modifier_spec.rb +25 -7
  374. data/spec/rubocop/cop/style/word_array_spec.rb +23 -23
  375. data/spec/rubocop/cop/team_spec.rb +14 -14
  376. data/spec/rubocop/file_inspector_spec.rb +14 -12
  377. data/spec/rubocop/formatter/base_formatter_spec.rb +19 -19
  378. data/spec/rubocop/formatter/clang_style_formatter_spec.rb +14 -14
  379. data/spec/rubocop/formatter/disabled_config_formatter_spec.rb +7 -7
  380. data/spec/rubocop/formatter/emacs_style_formatter_spec.rb +7 -7
  381. data/spec/rubocop/formatter/file_list_formatter_spec.rb +4 -4
  382. data/spec/rubocop/formatter/fuubar_style_formatter_spec.rb +129 -0
  383. data/spec/rubocop/formatter/json_formatter_spec.rb +23 -19
  384. data/spec/rubocop/formatter/offense_count_formatter_spec.rb +77 -0
  385. data/spec/rubocop/formatter/progress_formatter_spec.rb +27 -27
  386. data/spec/rubocop/formatter/simple_text_formatter_spec.rb +16 -16
  387. data/spec/rubocop/options_spec.rb +7 -8
  388. data/spec/rubocop/source_parser_spec.rb +0 -54
  389. data/spec/spec_helper.rb +11 -7
  390. data/spec/support/file_helper.rb +1 -1
  391. data/spec/support/mri_syntax_checker.rb +4 -4
  392. data/spec/support/shared_examples.rb +6 -6
  393. data/spec/support/statement_modifier_helper.rb +3 -3
  394. metadata +76 -16
  395. data/lib/rubocop/cop/style/favor_sprintf.rb +0 -26
  396. data/lib/rubocop/formatter/offence_count_formatter.rb +0 -49
  397. data/spec/rubocop/cop/style/favor_sprintf_spec.rb +0 -47
  398. data/spec/rubocop/formatter/offence_count_formatter_spec.rb +0 -52
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ea14f3e307dd68df2a7359211b40d0b7bcf4993
4
- data.tar.gz: a7c9a1f47f05baf47d33ccc0a814d759f2da54c0
3
+ metadata.gz: 82c2dad15c79e06c81a7f3bb945c2086d18ac7f6
4
+ data.tar.gz: ebe3136adc26d0eeddc507e977239efa9ac772b1
5
5
  SHA512:
6
- metadata.gz: 18b74d226546c2306d3450acc0c3a09e8cef00900b4699b578de51512e7a6f85cb73544dec43882646eb3e8ca8e5ba312f1cea8b9d5e2543238084c556c1b1f9
7
- data.tar.gz: e4b061fc7821f68ac1ee1f6556c4fb871dea79ad6f32a551d6fad683271b3c44549c6fd7d845e897e9b2015d46ec247bc7348dd8bd62013d46d4d2fabfbc69e3
6
+ metadata.gz: c52ae88687c5aa6fd5048689592f311c0da53c89b8da0423f4632861bc11ea6b95a1759e0fccb4981a300a615a15aadae1e8bd8849231aeeeab3e91c26b92883
7
+ data.tar.gz: 9e844e818bf7891135442313b7807417ade15c002334e982c07fa49baaa82e6960e9cfe40056dc76f6552d501a75a8a4391167cac68a34f923cbdd412f6a56ff
@@ -5,7 +5,7 @@ rvm:
5
5
  - 2.0.0
6
6
  - 2.1.0
7
7
  - jruby-19mode
8
- - rbx-2.1.1
8
+ - rbx-2
9
9
  before_install: gem update --remote bundler
10
10
  script:
11
11
  - bundle exec rspec
@@ -2,6 +2,66 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ### New features
6
+
7
+ * New cop `FileName` makes sure that source files have snake_case names. ([@bbatsov][])
8
+ * New cop `DeprecatedClassMethods` checks for deprecated class methods. ([@bbatsov][])
9
+ * New cop `StringConversionInInterpolation` checks for redundant `Object#to_s` in string interpolation. ([@bbatsov][])
10
+ * New cop `LiteralInInterpolation` checks for interpolated string literals. ([@bbatsov][])
11
+ * New cop `SelfAssignment` checks for places where the self-assignment shorthand should have been used. ([@bbatsov][])
12
+ * New cop `DoubleNegation` checks for uses of `!!`. ([@bbatsov][])
13
+ * New cop `PercentLiteralDelimiters` enforces consistent usage of `%`-literal delimiters. ([@hannestyden][])
14
+ * New Rails cop `ActionFilter` enforces the use of `_filter` or `_action` action filter methods. ([@bbatsov][])
15
+ * New Rails cop `ScopeArgs` makes sure you invoke the `scope` method properly. ([@bbatsov][])
16
+ * Add `with_fixed_indentation` style to `AlignParameters` cop. ([@hannestyden][])
17
+ * Add `IgnoreLastArgumentHash` option to `AlignHash` cop. ([@hannestyden][])
18
+ * [#743](https://github.com/bbatsov/rubocop/issues/743): `SingleLineMethods` cop does auto-correction. ([@jonas054][])
19
+ * [#743](https://github.com/bbatsov/rubocop/issues/743): `Semicolon` cop does auto-correction. ([@jonas054][])
20
+ * [#743](https://github.com/bbatsov/rubocop/issues/743): `EmptyLineBetweenDefs` cop does auto-correction. ([@jonas054][])
21
+ * [#743](https://github.com/bbatsov/rubocop/issues/743): `IndentationWidth` cop does auto-correction. ([@jonas054][])
22
+ * [#743](https://github.com/bbatsov/rubocop/issues/743): `IndentationConsistency` cop does auto-correction. ([@jonas054][])
23
+ * [#809](https://github.com/bbatsov/rubocop/issues/809): New formatter `fuubar` displays a progress bar and shows details of offenses as soon as they are detected. ([@yujinakayama][])
24
+ * [#797](https://github.com/bbatsov/rubocop/issues/797): New cop `IndentHash` checks the indentation of the first key in multi-line hash literals. ([@jonas054][])
25
+ * [#797](https://github.com/bbatsov/rubocop/issues/797): New cop `IndentArray` checks the indentation of the first element in multi-line array literals. ([@jonas054][])
26
+ * [#806](https://github.com/bbatsov/rubocop/issues/806): Now excludes files in `vendor/**` by default. ([@jeremyolliver][])
27
+ * [#795](https://github.com/bbatsov/rubocop/issues/795): `IfUnlessModifier` and `WhileUntilModifier` supports `MaxLineLength`, which is independent of `LineLength` parameter `Max`. ([@agrimm][])
28
+ * [#868](https://github.com/bbatsov/rubocop/issues/868): New cop `ClassAndModuleChildren` checks the style of children definitions at classes and modules: nested / compact. ([@geniou][])
29
+
30
+ ### Changes
31
+
32
+ * [#793](https://github.com/bbatsov/rubocop/issues/793): Add printing total count when `rubocop --format offences`. ([@ma2gedev][])
33
+ * Remove `Ignore` param from the Rails `Output` cop. The standard `Exclude/Include` should be used instead. ([@bbatsov][])
34
+ * Renamed `FavorSprintf` to `FormatString` and made it configurable. ([@bbatsov][])
35
+ * Renamed `Offence` to `Offense`. ([@bbatsov][])
36
+ * Use `offense` in all messages instead of `offence`. ([@bbatsov][])
37
+ * For indentation of `if`/`unless`/`while`/`until` bodies when the result is assigned to a variable, instead of supporting two styles simultaneously, `IndentationWidth` now supports one style of indentation at a time, specified by `EndAlignment`/`AlignWith`. ([@jonas054][])
38
+ * Renamed `Style` param of `DotPosition` cop to `EnforcedStyle`. ([@bbatsov][])
39
+ * Add `length` value to locations of offense in JSON formatter. ([@yujinakayama][])
40
+ * `SpaceAroundBlockBraces` cop replaced by `SpaceBeforeBlockBraces` and `SpaceInsideBlockBraces`. ([@jonas054][])
41
+ * `SpaceAroundEqualsInParameterDefault` cop is now configurable with the `EnforcedStyle` option. ([@jonas054][])
42
+
43
+ ### Bugs fixed
44
+
45
+ * [#790](https://github.com/bbatsov/rubocop/issues/790): Fix auto-correction interference problem between `MethodDefParentheses` and other cops. ([@jonas054][])
46
+ * [#794](https://github.com/bbatsov/rubocop/issues/794): Fix handling of modifier keywords with required parentheses in `ParenthesesAroundCondition`. ([@bbatsov][])
47
+ * [#804](https://github.com/bbatsov/rubocop/issues/804): Fix a false positive with operator assignments in a loop (including `begin..rescue..end` with `retry`) in `UselessAssignment`. ([@yujinakayama][])
48
+ * [#815](https://github.com/bbatsov/rubocop/issues/815): Fix a false positive for heredocs with blank lines in them in `EmptyLines`. ([@bbatsov][])
49
+ * Auto-correction is now more robust and less likely to die because of `RangeError` or "clobbering". ([@jonas054][])
50
+ * Offenses always reported in order of position in file, also during `--auto-correct` runs. ([@jonas054][])
51
+ * Fix problem with `[Corrected]` tag sometimes missing in output from `--auto-correct` runs. ([@jonas054][])
52
+ * Fix message from `EndAlignment` cop when `AlignWith` is `keyword`. ([@jonas054][])
53
+ * Handle `case` conditions in `LiteralInCondition`. ([@bbatsov][])
54
+ * [#822](https://github.com/bbatsov/rubocop/issues/822): Fix a false positive in `DotPosition` when enforced style is set to `trailing`. ([@bbatsov][])
55
+ * Handle properly dynamic strings in `LineEndConcatenation`. ([@bbatsov][])
56
+ * [#832](https://github.com/bbatsov/rubocop/issues/832): Fix auto-correction interference problem between `BracesAroundHashParameters` and `SpaceInsideHashLiteralBraces`. ([@jonas054][])
57
+ * Fix bug in auto-correction of alignment so that only space can be removed. ([@jonas054][])
58
+ * Fix bug in `IndentationWidth` auto-correction so it doesn't correct things that `IndentationConsistency` should correct. ([@jonas054][])
59
+ * [#847](https://github.com/bbatsov/rubocop/issues/847): Fix bug in `RegexpLiteral` concerning `--auto-gen-config`. ([@jonas054][])
60
+ * [#848](https://github.com/bbatsov/rubocop/issues/848): Fix bug in `--show-cops` that made it print the default configuration rather than the current configuration. ([@jonas054][])
61
+ * [#862](https://github.com/bbatsov/rubocop/issues/862): Fix a bug where single line `rubocop:disable` comments with indentations were treated as multiline cop disabling comments. ([@yujinakayama][])
62
+ * Fix a bug where `rubocop:disable` comments with a cop name including `all` (e.g. `MethodCallParentheses`) were disabling all cops. ([@yujinakayama][])
63
+ * Fix a bug where string and regexp literals including `# rubocop:disable` were confused with real comments. ([@yujinakayama][])
64
+
5
65
  ## 0.18.1 (02/02/2014)
6
66
 
7
67
  ### Bugs fixed
@@ -9,7 +69,7 @@
9
69
  * Remove double reporting in `EmptyLinesAroundBody` of empty line inside otherwise empty class/module/method that caused crash in autocorrect. ([@jonas054][])
10
70
  * [#779](https://github.com/bbatsov/rubocop/issues/779): Fix a false positive in `LineEndConcatenation`. ([@bbatsov][])
11
71
  * [#751](https://github.com/bbatsov/rubocop/issues/751): Fix `Documentation` cop so that a comment followed by an empty line and then a class definition is not considered to be class documentation. ([@jonas054][])
12
- * [#783](https://github.com/bbatsov/rubocop/issues/783): Fix a false positive in `ParethesesAroundCondition` when the parentheses are actually required. ([@bbatsov][])
72
+ * [#783](https://github.com/bbatsov/rubocop/issues/783): Fix a false positive in `ParenthesesAroundCondition` when the parentheses are actually required. ([@bbatsov][])
13
73
  * [#781](https://github.com/bbatsov/rubocop/issues/781): Fix problem with back-and-forth auto-correction in `AccessModifierIndentation`. ([@jonas054][])
14
74
  * [#785](https://github.com/bbatsov/rubocop/issues/785): Fix false positive on `%w` arrays in `TrailingComma`. ([@jonas054][])
15
75
  * [#782](https://github.com/bbatsov/rubocop/issues/782): Fix false positive in `AlignHash` for single line hashes. ([@jonas054][])
@@ -691,3 +751,7 @@
691
751
  [@claco]: http://github.com/claco
692
752
  [@rifraf]: http://github.com/rifraf
693
753
  [@scottmatthewman]: https://github.com/scottmatthewman
754
+ [@ma2gedev]: http://github.com/ma2gedev
755
+ [@jeremyolliver]: https://github.com/jeremyolliver
756
+ [@hannestyden]: https://github.com/hannestyden
757
+ [@geniou]: https://github.com/geniou
data/Gemfile CHANGED
@@ -3,9 +3,6 @@ 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
9
6
  gem 'coveralls', require: false
10
7
  end
11
8
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Bozhidar Batsov
1
+ Copyright (c) 2012-14 Bozhidar Batsov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/bbatsov/rubocop.png?branch=master)](https://travis-ci.org/bbatsov/rubocop)
4
4
  [![Coverage Status](https://coveralls.io/repos/bbatsov/rubocop/badge.png?branch=master)](https://coveralls.io/r/bbatsov/rubocop)
5
5
  [![Code Climate](https://codeclimate.com/github/bbatsov/rubocop.png)](https://codeclimate.com/github/bbatsov/rubocop)
6
+ [![Inline docs](http://inch-pages.github.io/github/bbatsov/rubocop.png)](http://inch-pages.github.io/github/bbatsov/rubocop)
6
7
 
7
8
  # RuboCop
8
9
 
@@ -21,33 +22,38 @@ automatically fix some of the problems for you.
21
22
 
22
23
  - [Installation](#installation)
23
24
  - [Basic Usage](#basic-usage)
24
- - [Cops](#cops)
25
- - [Style](#style)
26
- - [Lint](#lint)
27
- - [Rails](#rails)
25
+ - [Cops](#cops)
26
+ - [Style](#style)
27
+ - [Lint](#lint)
28
+ - [Rails](#rails)
28
29
  - [Configuration](#configuration)
29
- - [Inheritance](#inheritance)
30
- - [Defaults](#defaults)
31
- - [Including/Excluding files](#includingexcluding-files)
32
- - [Automatically Generated Configuration](#automatically-generated-configuration)
30
+ - [Inheritance](#inheritance)
31
+ - [Defaults](#defaults)
32
+ - [Including/Excluding files](#includingexcluding-files)
33
+ - [Automatically Generated Configuration](#automatically-generated-configuration)
33
34
  - [Disabling Cops within Source Code](#disabling-cops-within-source-code)
34
35
  - [Formatters](#formatters)
35
- - [Clang Formatter (default)](#clang-formatter-default)
36
- - [Emacs](#emacs)
37
- - [Simple](#simple)
38
- - [File List Formatter](#file-list-formatter)
39
- - [JSON Formatter](#json-formatter)
40
- - [OffenceCount Formatter](#offencecount-formatter)
41
- - [Custom Formatters](#custom-formatters)
42
- - [Creating Custom Formatter](#creating-custom-formatter)
43
- - [Using Custom Formatter in Command Line](#using-custom-formatter-in-command-line)
36
+ - [Progress Formatter (default)](#progress-formatter-default)
37
+ - [Clang Style Formatter](#clang-style-formatter)
38
+ - [Fuubar Style Formatter](#fuubar-style-formatter)
39
+ - [Emacs Style Formatter](#emacs-style-formatter)
40
+ - [Simple Formatter](#simple-formatter)
41
+ - [File List Formatter](#file-list-formatter)
42
+ - [JSON Formatter](#json-formatter)
43
+ - [Offense Count Formatter](#offense-count-formatter)
44
+ - [Custom Formatters](#custom-formatters)
45
+ - [Creating Custom Formatter](#creating-custom-formatter)
46
+ - [Using Custom Formatter in Command Line](#using-custom-formatter-in-command-line)
44
47
  - [Compatibility](#compatibility)
45
48
  - [Editor integration](#editor-integration)
46
- - [Emacs](#emacs-1)
47
- - [Vim](#vim)
48
- - [Sublime Text 2](#sublime-text-2)
49
- - [Brackets](#brackets)
50
- - [Other Editors](#other-editors)
49
+ - [Emacs](#emacs)
50
+ - [Vim](#vim)
51
+ - [Sublime Text](#sublime-text)
52
+ - [Brackets](#brackets)
53
+ - [TextMate2](#textmate2)
54
+ - [Atom](#atom)
55
+ - [LightTable](#lighttable)
56
+ - [Other Editors](#other-editors)
51
57
  - [Guard integration](#guard-integration)
52
58
  - [Rake integration](#rake-integration)
53
59
  - [Team](#team)
@@ -60,7 +66,7 @@ automatically fix some of the problems for you.
60
66
 
61
67
  **RuboCop**'s installation is pretty standard:
62
68
 
63
- ```bash
69
+ ```
64
70
  $ gem install rubocop
65
71
  ```
66
72
 
@@ -69,13 +75,13 @@ $ gem install rubocop
69
75
  Running `rubocop` with no arguments will check all Ruby source files
70
76
  in the current directory:
71
77
 
72
- ```bash
78
+ ```
73
79
  $ rubocop
74
80
  ```
75
81
 
76
82
  Alternatively you can pass `rubocop` a list of files and directories to check:
77
83
 
78
- ```bash
84
+ ```
79
85
  $ rubocop app spec lib/something.rb
80
86
  ```
81
87
 
@@ -92,7 +98,7 @@ end
92
98
  Running RuboCop on it (assuming it's in a file named `test.rb`) would produce the following report:
93
99
 
94
100
  ```
95
- Offences:
101
+ Offenses:
96
102
 
97
103
  test.rb:1:5: C: Use snake_case for methods and variables.
98
104
  def badName
@@ -104,12 +110,12 @@ test.rb:4:5: W: end at 4, 4 is not aligned with if at 2, 2
104
110
  end
105
111
  ^^^
106
112
 
107
- 1 file inspected, 3 offences detected
113
+ 1 file inspected, 3 offenses detected
108
114
  ```
109
115
 
110
116
  For more details check the available command-line options:
111
117
 
112
- ```bash
118
+ ```
113
119
  $ rubocop -h
114
120
  ```
115
121
 
@@ -118,14 +124,14 @@ Command flag | Description
118
124
  `-v/--version` | Displays the current version and exits
119
125
  `-V/--verbose-version` | Displays the current version plus the version of Parser and Ruby
120
126
  `-d/--debug` | Displays some extra debug output
121
- `-D/--display-cop-names` | Displays cop names in offence messages.
127
+ `-D/--display-cop-names` | Displays cop names in offense messages.
122
128
  `-c/--config` | Run with specified config file
123
129
  `-f/--format` | Choose a formatter
124
130
  `-o/--out` | Write output to a file instead of STDOUT
125
131
  `-r/--require` | Require Ruby file
126
132
  `-R/--rails` | Run extra Rails cops
127
133
  `-l/--lint` | Run only lint cops
128
- `-a/--auto-correct` | Auto-correct certain offences *Note:* Experimental - use with caution
134
+ `-a/--auto-correct` | Auto-correct certain offenses *Note:* Experimental - use with caution
129
135
  `--only` | Run only the specified cop
130
136
  `--auto-gen-config` | Generate a configuration file acting as a TODO list
131
137
  `--show-cops` | Shows available cops and their configuration
@@ -289,12 +295,12 @@ CyclomaticComplexity:
289
295
 
290
296
  ### Automatically Generated Configuration
291
297
 
292
- If you have a code base with an overwhelming amount of offences, it can be a
298
+ If you have a code base with an overwhelming amount of offenses, it can be a
293
299
  good idea to use `rubocop --auto-gen-config` and add an `inherit_from:
294
300
  rubocop-todo.yml` in your `.rubocop.yml`. The generated file `rubocop-todo.yml`
295
- contains configuration to disable all cops that currently detect an offence in
301
+ contains configuration to disable all cops that currently detect an offense in
296
302
  the code. Then you can start removing the entries in the generated file one by
297
- one as you work through all the offences in the code.
303
+ one as you work through all the offenses in the code.
298
304
 
299
305
  ## Disabling Cops within Source Code
300
306
 
@@ -324,72 +330,147 @@ for x in (0..19) # rubocop:disable AvoidFor
324
330
 
325
331
  ## Formatters
326
332
 
327
- ### Clang Formatter (default)
333
+ You can change the output format of RuboCop by specifying formatters with the `-f/--format` option.
334
+ RuboCop ships with several built-in formatters, and also you can create your custom formatter.
335
+
336
+ Additionaly the output can be redirected to a file instead of `$stdout` with the `-o/--out` option.
337
+
338
+ Some of the built-in formatters produce **machine-parsable** output
339
+ and they are considered public APIs.
340
+ The rest of the formatters are for humans, so parsing their outputs is discouraged.
341
+
342
+ You can enable multiple formatters at the same time by specifying `-f/--format` multiple times.
343
+ The `-o/--out` option applies to the previously specified `-f/--format`,
344
+ or the default `progress` format if no `-f/--format` is specified before the `-o/--out` option.
345
+
346
+ ```bash
347
+ # Simple format to $stdout.
348
+ $ rubocop --format simple
349
+
350
+ # Progress (default) format to the file result.txt.
351
+ $ rubocop --out result.txt
352
+
353
+ # Both progress and offense count formats to $stdout.
354
+ # The offense count formatter outputs only the final summary,
355
+ # so you'll mostly see the outputs from the progress formatter,
356
+ # and at the end the offense count summary will be outputted.
357
+ $ rubocop --format progress --format offenses
358
+
359
+ # Progress format to $stdout, and JSON format to the file rubocop.json.
360
+ $ rubocop --format progress --format json --out rubocop.json
361
+ # ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
362
+ # | |_______________|
363
+ # $stdout
364
+
365
+ # Progress format to result.txt, and simple format to $stdout.
366
+ $ rubocop --output result.txt --format simple
367
+ # ~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
368
+ # | |
369
+ # default format $stdout
370
+ ```
371
+
372
+ ### Progress Formatter (default)
373
+
374
+ The default `progress` formatter outputs a character for each inspected file,
375
+ and at the end it displays all detected offenses in the `clang` format.
376
+ A `.` represents a clean file, and each of the capital letters means
377
+ the severest offense (convention, warning, error or fatal) found in a file.
378
+
379
+ ```
380
+ $ rubocop
381
+ Inspecting 26 files
382
+ ..W.C....C..CWCW.C...WC.CC
383
+
384
+ Offenses:
385
+
386
+ lib/foo.rb:6:5: C: Missing top-level class documentation comment.
387
+ class Foo
388
+ ^^^^^
328
389
 
329
- The `Clang` formatter displays the offences in a manner similar to `clang`:
390
+ ...
330
391
 
392
+ 26 files inspected, 46 offenses detected
331
393
  ```
332
- rubocop test.rb
333
394
 
334
- Inspecting 1 file
335
- W
395
+ ### Clang Style Formatter
336
396
 
337
- Offences:
397
+ The `clang` formatter displays the offenses in a manner similar to `clang`:
338
398
 
399
+ ```
400
+ $ rubocop test.rb
339
401
  test.rb:1:1: C: Use snake_case for methods and variables.
340
402
  def badName
341
- ^^^
403
+ ^^^^^^^
342
404
  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 &&/||.
343
405
  if something
344
- ^^^^^
406
+ ^^
345
407
  test.rb:4:5: W: end at 4, 4 is not aligned with if at 2, 2
346
408
  end
347
409
  ^^^
348
410
 
349
- 1 file inspected, 3 offences detected
411
+ 1 file inspected, 3 offenses detected
350
412
  ```
351
413
 
352
- ### Emacs
414
+ ### Fuubar Style Formatter
353
415
 
354
- The `Emacs` formatter displays the offences in a format suitable for consumption by `Emacs` (and possibly other tools).
416
+ The `fuubar` style formatter displays a progress bar
417
+ and shows details of offenses in the `clang` format as soon as they are detected.
418
+ This is inspired by the [Fuubar](https://github.com/jeffkreeftmeijer/fuubar) formatter for RSpec.
355
419
 
356
420
  ```
357
- rubocop --format emacs test.rb
421
+ $ rubocop --format fuubar
422
+ lib/foo.rb.rb:1:1: C: Use snake_case for methods and variables.
423
+ def badName
424
+ ^^^^^^^
425
+ lib/bar.rb:13:14: W: File.exists? is deprecated in favor of File.exist?.
426
+ File.exists?(path)
427
+ ^^^^^^^
428
+ 22/53 files |======== 43 ========> | ETA: 00:00:02
429
+ ```
430
+
431
+ ### Emacs Style Formatter
432
+
433
+ **Machine-parsable**
358
434
 
435
+ The `emacs` formatter displays the offenses in a format suitable for consumption by `Emacs` (and possibly other tools).
436
+
437
+ ```
438
+ $ rubocop --format emacs test.rb
359
439
  /Users/bozhidar/projects/test.rb:1:1: C: Use snake_case for methods and variables.
360
440
  /Users/bozhidar/projects/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 &&/||.
361
441
  /Users/bozhidar/projects/test.rb:4:5: W: end at 4, 4 is not aligned with if at 2, 2
362
-
363
- 1 file inspected, 3 offences detected
364
442
  ```
365
443
 
366
- ### Simple
444
+ ### Simple Formatter
367
445
 
368
446
  The name of the formatter says it all :-)
369
447
 
370
448
  ```
371
- rubocop --format simple test.rb
372
-
449
+ $ rubocop --format simple test.rb
373
450
  == test.rb ==
374
451
  C: 1: 1: Use snake_case for methods and variables.
375
452
  C: 2: 3: Favor modifier if/unless usage when you have a single-line body. Another good alternative is the usage of control flow &&/||.
376
453
  W: 4: 5: end at 4, 4 is not aligned with if at 2, 2
377
454
 
378
- 1 file inspected, 3 offences detected
455
+ 1 file inspected, 3 offenses detected
379
456
  ```
380
457
 
381
458
  ### File List Formatter
382
459
 
383
- Sometimes you might want to just open all files with offences in your
460
+ **Machine-parsable**
461
+
462
+ Sometimes you might want to just open all files with offenses in your
384
463
  favorite editor. This formatter outputs just the names of the files
385
- with offences in them and makes it possible to do something like:
464
+ with offenses in them and makes it possible to do something like:
386
465
 
387
466
  ```
388
- rubocop --format files | xargs vim
467
+ $ rubocop --format files | xargs vim
389
468
  ```
390
469
 
391
470
  ### JSON Formatter
392
471
 
472
+ **Machine-parsable**
473
+
393
474
  You can get RuboCop's inspection result in JSON format by passing `--format json` option in command line.
394
475
  The JSON structure is like the following example:
395
476
 
@@ -404,17 +485,18 @@ The JSON structure is like the following example:
404
485
  },
405
486
  "files": [{
406
487
  "path": "lib/foo.rb",
407
- "offences": []
488
+ "offenses": []
408
489
  }, {
409
490
  "path": "lib/bar.rb",
410
- "offences": [{
491
+ "offenses": [{
411
492
  "severity": "convention",
412
493
  "message": "Line is too long. [81/79]",
413
494
  "cop_name": "LineLength",
414
495
  "corrected": true,
415
496
  "location": {
416
497
  "line": 546,
417
- "column": 80
498
+ "column": 80,
499
+ "length": 4
418
500
  }
419
501
  }, {
420
502
  "severity": "warning",
@@ -423,42 +505,45 @@ The JSON structure is like the following example:
423
505
  "corrected": false,
424
506
  "location": {
425
507
  "line": 15,
426
- "column": 9
508
+ "column": 9,
509
+ "length": 10
427
510
  }
428
511
  }
429
512
  ]
430
513
  }
431
514
  ],
432
515
  "summary": {
433
- "offence_count": 2,
516
+ "offense_count": 2,
434
517
  "target_file_count": 2,
435
518
  "inspected_file_count": 2
436
519
  }
437
520
  }
438
521
  ```
439
522
 
440
- ### OffenceCount Formatter
523
+ ### Offense Count Formatter
441
524
 
442
525
  Sometimes when first applying RuboCop to a codebase, it's nice to be able to
443
526
  see where most of your style cleanup is going to be spent.
444
527
 
445
- With this in mind, you can use the offence count formatter to outline the offended
446
- cops and the number of offences found for each by running:
528
+ With this in mind, you can use the offense count formatter to outline the offended
529
+ cops and the number of offenses found for each by running:
447
530
 
448
531
  ```
449
- rubocop --format offences
532
+ $ rubocop --format offenses
450
533
 
451
- (87) Documentation
452
- (12) DotPosition
453
- (8) AvoidGlobalVars
454
- (7) EmptyLines
455
- (6) AssignmentInCondition
456
- (4) Blocks
457
- (4) CommentAnnotation
458
- (3) BlockAlignment
459
- (1) IndentationWidth
460
- (1) AvoidPerlBackrefs
461
- (1) ColonMethodCall
534
+ 87 Documentation
535
+ 12 DotPosition
536
+ 8 AvoidGlobalVars
537
+ 7 EmptyLines
538
+ 6 AssignmentInCondition
539
+ 4 Blocks
540
+ 4 CommentAnnotation
541
+ 3 BlockAlignment
542
+ 1 IndentationWidth
543
+ 1 AvoidPerlBackrefs
544
+ 1 ColonMethodCall
545
+ --
546
+ 134 Total
462
547
  ```
463
548
 
464
549
  ### Custom Formatters
@@ -474,7 +559,7 @@ or implement all formatter API methods by duck typing.
474
559
  Please see the documents below for more formatter API details.
475
560
 
476
561
  * [Rubocop::Formatter::BaseFormatter](http://rubydoc.info/gems/rubocop/Rubocop/Formatter/BaseFormatter)
477
- * [Rubocop::Cop::Offence](http://rubydoc.info/gems/rubocop/Rubocop/Cop/Offence)
562
+ * [Rubocop::Cop::Offense](http://rubydoc.info/gems/rubocop/Rubocop/Cop/Offense)
478
563
  * [Parser::Source::Range](http://rubydoc.info/github/whitequark/parser/Parser/Source/Range)
479
564
 
480
565
  #### Using Custom Formatter in Command Line
@@ -484,7 +569,7 @@ You can tell RuboCop to use your custom formatter with a combination of
484
569
  For example, when you have defined `MyCustomFormatter` in
485
570
  `./path/to/my_custom_formatter.rb`, you would type this command:
486
571
 
487
- ```bash
572
+ ```
488
573
  $ rubocop --require ./path/to/my_custom_formatter --format MyCustomFormatter
489
574
  ```
490
575
 
@@ -530,10 +615,27 @@ If you're a ST user you might find the
530
615
  useful.
531
616
 
532
617
  ### Brackets
618
+
533
619
  The [brackets-rubocop](https://github.com/smockle/brackets-rubocop)
534
620
  extension displays RuboCop results in Brackets.
535
621
  It can be installed via the extension manager in Brackets.
536
622
 
623
+ ### TextMate2
624
+
625
+ The [textmate2-rubocop](https://github.com/mrdougal/textmate2-rubocop)
626
+ bundle displays formatted RuboCop results in a new window.
627
+ Installation instructions can be found [here](https://github.com/mrdougal/textmate2-rubocop#installation).
628
+
629
+ ### Atom
630
+
631
+ The [atom-lint](https://github.com/yujinakayama/atom-lint) package
632
+ runs RuboCop and highlights the offenses in Atom.
633
+
634
+ ### LightTable
635
+
636
+ The [lt-rubocop](https://github.com/seancaffery/lt-rubocop) plugin
637
+ provides LightTable integration.
638
+
537
639
  ### Other Editors
538
640
 
539
641
  Here's one great opportunity to contribute to RuboCop - implement
@@ -611,5 +713,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
611
713
 
612
714
  ## Copyright
613
715
 
614
- Copyright (c) 2012-2013 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
716
+ Copyright (c) 2012-2014 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
615
717
  further details.