rubocop 0.49.1 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (506) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -9
  3. data/bin/rubocop +1 -1
  4. data/config/default.yml +264 -118
  5. data/config/disabled.yml +13 -9
  6. data/config/enabled.yml +1156 -918
  7. data/lib/rubocop.rb +555 -489
  8. data/lib/rubocop/ast/builder.rb +6 -1
  9. data/lib/rubocop/ast/node.rb +68 -52
  10. data/lib/rubocop/ast/node/args_node.rb +15 -10
  11. data/lib/rubocop/ast/node/array_node.rb +10 -1
  12. data/lib/rubocop/ast/node/block_node.rb +9 -0
  13. data/lib/rubocop/ast/node/def_node.rb +71 -0
  14. data/lib/rubocop/ast/node/for_node.rb +8 -0
  15. data/lib/rubocop/ast/node/if_node.rb +10 -2
  16. data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +16 -0
  17. data/lib/rubocop/ast/node/mixin/collection_node.rb +15 -0
  18. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +174 -0
  19. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +89 -0
  20. data/lib/rubocop/ast/node/mixin/parameterized_node.rb +18 -31
  21. data/lib/rubocop/ast/node/regexp_node.rb +35 -0
  22. data/lib/rubocop/ast/node/send_node.rb +21 -150
  23. data/lib/rubocop/ast/node/str_node.rb +14 -0
  24. data/lib/rubocop/ast/node/super_node.rb +3 -24
  25. data/lib/rubocop/ast/node/symbol_node.rb +20 -0
  26. data/lib/rubocop/ast/node/yield_node.rb +21 -0
  27. data/lib/rubocop/ast/traversal.rb +7 -7
  28. data/lib/rubocop/cached_data.rb +1 -6
  29. data/lib/rubocop/cli.rb +59 -13
  30. data/lib/rubocop/comment_config.rb +2 -5
  31. data/lib/rubocop/config.rb +136 -29
  32. data/lib/rubocop/config_loader.rb +61 -104
  33. data/lib/rubocop/config_loader_resolver.rb +102 -4
  34. data/lib/rubocop/cop/autocorrect_logic.rb +1 -1
  35. data/lib/rubocop/cop/bundler/duplicated_gem.rb +13 -11
  36. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +67 -0
  37. data/lib/rubocop/cop/bundler/ordered_gems.rb +7 -58
  38. data/lib/rubocop/cop/commissioner.rb +6 -3
  39. data/lib/rubocop/cop/cop.rb +11 -6
  40. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +102 -0
  41. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +97 -0
  42. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +87 -0
  43. data/lib/rubocop/cop/generator.rb +122 -25
  44. data/lib/rubocop/cop/internal_affairs.rb +6 -2
  45. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +46 -0
  46. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +16 -5
  47. data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +54 -0
  48. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +59 -0
  49. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +71 -0
  50. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +3 -3
  51. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +6 -10
  52. data/lib/rubocop/cop/layout/align_array.rb +2 -2
  53. data/lib/rubocop/cop/layout/align_hash.rb +18 -18
  54. data/lib/rubocop/cop/layout/align_parameters.rb +11 -23
  55. data/lib/rubocop/cop/layout/block_end_newline.rb +20 -6
  56. data/lib/rubocop/cop/layout/case_indentation.rb +15 -18
  57. data/lib/rubocop/cop/layout/class_structure.rb +306 -0
  58. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +7 -6
  59. data/lib/rubocop/cop/layout/comment_indentation.rb +42 -3
  60. data/lib/rubocop/cop/layout/dot_position.rb +31 -13
  61. data/lib/rubocop/cop/layout/else_alignment.rb +37 -17
  62. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +1 -1
  63. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +22 -18
  64. data/lib/rubocop/cop/layout/empty_lines.rb +16 -2
  65. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +23 -6
  66. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +89 -0
  67. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +2 -2
  68. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +4 -8
  69. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +30 -5
  70. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +10 -6
  71. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +5 -5
  72. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +22 -7
  73. data/lib/rubocop/cop/layout/end_of_line.rb +2 -2
  74. data/lib/rubocop/cop/layout/extra_spacing.rb +23 -26
  75. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +3 -3
  76. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +9 -3
  77. data/lib/rubocop/cop/layout/indent_array.rb +68 -21
  78. data/lib/rubocop/cop/layout/indent_hash.rb +71 -26
  79. data/lib/rubocop/cop/layout/indent_heredoc.rb +70 -35
  80. data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -2
  81. data/lib/rubocop/cop/layout/indentation_width.rb +40 -27
  82. data/lib/rubocop/cop/layout/initial_indentation.rb +10 -7
  83. data/lib/rubocop/cop/layout/leading_comment_space.rb +32 -17
  84. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +47 -14
  85. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +12 -11
  86. data/lib/rubocop/cop/layout/multiline_block_layout.rb +19 -16
  87. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +46 -13
  88. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +29 -27
  89. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +7 -3
  90. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +6 -0
  91. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +12 -4
  92. data/lib/rubocop/cop/layout/space_after_colon.rb +13 -6
  93. data/lib/rubocop/cop/layout/space_after_comma.rb +11 -1
  94. data/lib/rubocop/cop/layout/space_after_method_name.rb +8 -6
  95. data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
  96. data/lib/rubocop/cop/layout/space_after_semicolon.rb +8 -1
  97. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +32 -25
  98. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +28 -17
  99. data/lib/rubocop/cop/layout/space_around_keyword.rb +22 -16
  100. data/lib/rubocop/cop/layout/space_around_operators.rb +27 -14
  101. data/lib/rubocop/cop/layout/space_before_block_braces.rb +61 -12
  102. data/lib/rubocop/cop/layout/space_before_comma.rb +12 -1
  103. data/lib/rubocop/cop/layout/space_before_comment.rb +10 -5
  104. data/lib/rubocop/cop/layout/space_before_first_arg.rb +5 -4
  105. data/lib/rubocop/cop/layout/space_before_semicolon.rb +8 -1
  106. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +12 -14
  107. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +235 -0
  108. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +4 -4
  109. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +89 -18
  110. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +62 -36
  111. data/lib/rubocop/cop/layout/space_inside_parens.rb +40 -3
  112. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +1 -1
  113. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +15 -15
  114. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +81 -0
  115. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +32 -17
  116. data/lib/rubocop/cop/layout/tab.rb +7 -4
  117. data/lib/rubocop/cop/layout/trailing_blank_lines.rb +11 -9
  118. data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
  119. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +12 -19
  120. data/lib/rubocop/cop/lint/assignment_in_condition.rb +16 -2
  121. data/lib/rubocop/cop/lint/block_alignment.rb +42 -30
  122. data/lib/rubocop/cop/lint/boolean_symbol.rb +38 -0
  123. data/lib/rubocop/cop/lint/circular_argument_reference.rb +3 -14
  124. data/lib/rubocop/cop/lint/condition_position.rb +5 -1
  125. data/lib/rubocop/cop/lint/debugger.rb +18 -11
  126. data/lib/rubocop/cop/lint/def_end_alignment.rb +9 -14
  127. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +4 -4
  128. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +3 -3
  129. data/lib/rubocop/cop/lint/duplicate_methods.rb +75 -5
  130. data/lib/rubocop/cop/lint/duplicated_key.rb +1 -1
  131. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  132. data/lib/rubocop/cop/lint/else_layout.rb +3 -3
  133. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  134. data/lib/rubocop/cop/lint/empty_expression.rb +1 -1
  135. data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
  136. data/lib/rubocop/cop/lint/empty_when.rb +1 -1
  137. data/lib/rubocop/cop/lint/end_alignment.rb +13 -14
  138. data/lib/rubocop/cop/lint/end_in_method.rb +1 -1
  139. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  140. data/lib/rubocop/cop/lint/float_out_of_range.rb +5 -5
  141. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +36 -41
  142. data/lib/rubocop/cop/lint/handle_exceptions.rb +1 -1
  143. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
  144. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +25 -20
  145. data/lib/rubocop/cop/lint/inherit_exception.rb +16 -19
  146. data/lib/rubocop/cop/lint/interpolation_check.rb +37 -0
  147. data/lib/rubocop/cop/lint/{literal_in_condition.rb → literal_as_condition.rb} +21 -7
  148. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +1 -1
  149. data/lib/rubocop/cop/lint/loop.rb +1 -1
  150. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +81 -0
  151. data/lib/rubocop/cop/lint/multiple_compare.rb +1 -1
  152. data/lib/rubocop/cop/lint/nested_method_definition.rb +6 -8
  153. data/lib/rubocop/cop/lint/nested_percent_literal.rb +58 -0
  154. data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
  155. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +4 -4
  156. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +4 -3
  157. data/lib/rubocop/cop/lint/percent_string_array.rb +13 -22
  158. data/lib/rubocop/cop/lint/percent_symbol_array.rb +12 -12
  159. data/lib/rubocop/cop/lint/rand_one.rb +8 -2
  160. data/lib/rubocop/cop/lint/redundant_with_index.rb +80 -0
  161. data/lib/rubocop/cop/lint/redundant_with_object.rb +81 -0
  162. data/lib/rubocop/cop/lint/regexp_as_condition.rb +29 -0
  163. data/lib/rubocop/cop/lint/require_parentheses.rb +5 -3
  164. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  165. data/lib/rubocop/cop/lint/rescue_type.rb +18 -9
  166. data/lib/rubocop/cop/lint/return_in_void_context.rb +74 -0
  167. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -1
  168. data/lib/rubocop/cop/lint/script_permission.rb +8 -1
  169. data/lib/rubocop/cop/lint/shadowed_argument.rb +146 -0
  170. data/lib/rubocop/cop/lint/shadowed_exception.rb +37 -10
  171. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +1 -1
  172. data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +7 -7
  173. data/lib/rubocop/cop/lint/syntax.rb +23 -20
  174. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
  175. data/lib/rubocop/cop/lint/unified_integer.rb +5 -4
  176. data/lib/rubocop/cop/lint/unneeded_disable.rb +41 -16
  177. data/lib/rubocop/cop/lint/unneeded_require_statement.rb +51 -0
  178. data/lib/rubocop/cop/lint/unneeded_splat_expansion.rb +45 -19
  179. data/lib/rubocop/cop/lint/unreachable_code.rb +53 -8
  180. data/lib/rubocop/cop/lint/unused_method_argument.rb +2 -1
  181. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +74 -0
  182. data/lib/rubocop/cop/lint/uri_regexp.rb +73 -0
  183. data/lib/rubocop/cop/lint/useless_access_modifier.rb +12 -16
  184. data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
  185. data/lib/rubocop/cop/lint/useless_comparison.rb +1 -1
  186. data/lib/rubocop/cop/lint/useless_setter_call.rb +15 -12
  187. data/lib/rubocop/cop/lint/void.rb +38 -27
  188. data/lib/rubocop/cop/message_annotator.rb +4 -2
  189. data/lib/rubocop/cop/metrics/abc_size.rb +2 -2
  190. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  191. data/lib/rubocop/cop/metrics/class_length.rb +3 -1
  192. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +2 -1
  193. data/lib/rubocop/cop/metrics/line_length.rb +8 -5
  194. data/lib/rubocop/cop/metrics/method_length.rb +8 -3
  195. data/lib/rubocop/cop/metrics/module_length.rb +3 -1
  196. data/lib/rubocop/cop/metrics/parameter_lists.rb +14 -5
  197. data/lib/rubocop/cop/metrics/perceived_complexity.rb +2 -1
  198. data/lib/rubocop/cop/mixin/array_hash_indentation.rb +3 -2
  199. data/lib/rubocop/cop/mixin/autocorrect_alignment.rb +2 -2
  200. data/lib/rubocop/cop/mixin/code_length.rb +1 -1
  201. data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -1
  202. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  203. data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
  204. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +14 -7
  205. data/lib/rubocop/cop/mixin/empty_parameter.rb +23 -0
  206. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +8 -4
  207. data/lib/rubocop/cop/mixin/enforce_superclass.rb +3 -3
  208. data/lib/rubocop/cop/mixin/first_element_line_break.rb +12 -3
  209. data/lib/rubocop/cop/mixin/heredoc.rb +28 -0
  210. data/lib/rubocop/cop/mixin/method_complexity.rb +33 -7
  211. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +74 -33
  212. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +34 -8
  213. data/lib/rubocop/cop/mixin/negative_conditional.rb +4 -1
  214. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +67 -0
  215. data/lib/rubocop/cop/mixin/parentheses.rb +12 -0
  216. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +4 -1
  217. data/lib/rubocop/cop/mixin/percent_array.rb +52 -0
  218. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +9 -8
  219. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +11 -10
  220. data/lib/rubocop/cop/mixin/statement_modifier.rb +7 -17
  221. data/lib/rubocop/cop/mixin/string_help.rb +1 -1
  222. data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
  223. data/lib/rubocop/cop/mixin/surrounding_space.rb +95 -8
  224. data/lib/rubocop/cop/mixin/too_many_lines.rb +2 -2
  225. data/lib/rubocop/cop/mixin/trailing_comma.rb +25 -17
  226. data/lib/rubocop/cop/mixin/unused_argument.rb +6 -2
  227. data/lib/rubocop/cop/naming/accessor_method_name.rb +55 -0
  228. data/lib/rubocop/cop/{style → naming}/ascii_identifiers.rb +35 -2
  229. data/lib/rubocop/cop/{style/op_method.rb → naming/binary_operator_parameter_name.rb} +7 -6
  230. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +33 -0
  231. data/lib/rubocop/cop/naming/constant_name.rb +58 -0
  232. data/lib/rubocop/cop/{style → naming}/file_name.rb +28 -13
  233. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +62 -0
  234. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +59 -0
  235. data/lib/rubocop/cop/naming/method_name.rb +40 -0
  236. data/lib/rubocop/cop/naming/predicate_name.rb +101 -0
  237. data/lib/rubocop/cop/naming/variable_name.rb +50 -0
  238. data/lib/rubocop/cop/{style → naming}/variable_number.rb +11 -28
  239. data/lib/rubocop/cop/offense.rb +6 -1
  240. data/lib/rubocop/cop/performance/caller.rb +39 -11
  241. data/lib/rubocop/cop/performance/case_when_splat.rb +3 -7
  242. data/lib/rubocop/cop/performance/casecmp.rb +9 -8
  243. data/lib/rubocop/cop/performance/compare_with_block.rb +23 -13
  244. data/lib/rubocop/cop/performance/count.rb +7 -4
  245. data/lib/rubocop/cop/performance/detect.rb +9 -6
  246. data/lib/rubocop/cop/performance/double_start_end_with.rb +12 -20
  247. data/lib/rubocop/cop/performance/end_with.rb +6 -6
  248. data/lib/rubocop/cop/performance/fixed_size.rb +1 -1
  249. data/lib/rubocop/cop/performance/flat_map.rb +5 -2
  250. data/lib/rubocop/cop/performance/hash_each_methods.rb +85 -40
  251. data/lib/rubocop/cop/performance/lstrip_rstrip.rb +9 -6
  252. data/lib/rubocop/cop/performance/range_include.rb +3 -3
  253. data/lib/rubocop/cop/performance/redundant_block_call.rb +28 -28
  254. data/lib/rubocop/cop/performance/redundant_match.rb +13 -12
  255. data/lib/rubocop/cop/performance/redundant_merge.rb +44 -26
  256. data/lib/rubocop/cop/performance/redundant_sort_by.rb +9 -6
  257. data/lib/rubocop/cop/performance/regexp_match.rb +19 -10
  258. data/lib/rubocop/cop/performance/reverse_each.rb +1 -1
  259. data/lib/rubocop/cop/performance/sample.rb +1 -1
  260. data/lib/rubocop/cop/performance/size.rb +3 -3
  261. data/lib/rubocop/cop/performance/start_with.rb +6 -6
  262. data/lib/rubocop/cop/performance/string_replacement.rb +6 -6
  263. data/lib/rubocop/cop/performance/times_map.rb +32 -22
  264. data/lib/rubocop/cop/performance/unfreeze_string.rb +50 -0
  265. data/lib/rubocop/cop/performance/uri_default_parser.rb +47 -0
  266. data/lib/rubocop/cop/rails/action_filter.rb +23 -1
  267. data/lib/rubocop/cop/rails/active_support_aliases.rb +4 -5
  268. data/lib/rubocop/cop/rails/application_job.rb +5 -3
  269. data/lib/rubocop/cop/rails/application_record.rb +5 -3
  270. data/lib/rubocop/cop/rails/blank.rb +20 -17
  271. data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +82 -0
  272. data/lib/rubocop/cop/rails/date.rb +7 -6
  273. data/lib/rubocop/cop/rails/delegate.rb +53 -29
  274. data/lib/rubocop/cop/rails/delegate_allow_blank.rb +4 -4
  275. data/lib/rubocop/cop/rails/dynamic_find_by.rb +2 -2
  276. data/lib/rubocop/cop/rails/enum_uniqueness.rb +4 -4
  277. data/lib/rubocop/cop/rails/environment_comparison.rb +66 -0
  278. data/lib/rubocop/cop/rails/exit.rb +8 -1
  279. data/lib/rubocop/cop/rails/file_path.rb +8 -11
  280. data/lib/rubocop/cop/rails/find_by.rb +2 -1
  281. data/lib/rubocop/cop/rails/find_each.rb +1 -1
  282. data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +8 -1
  283. data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +76 -0
  284. data/lib/rubocop/cop/rails/http_positional_arguments.rb +40 -44
  285. data/lib/rubocop/cop/rails/inverse_of.rb +96 -0
  286. data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +112 -0
  287. data/lib/rubocop/cop/rails/not_null_column.rb +6 -6
  288. data/lib/rubocop/cop/rails/output.rb +11 -2
  289. data/lib/rubocop/cop/rails/output_safety.rb +16 -21
  290. data/lib/rubocop/cop/rails/pluralization_grammar.rb +10 -10
  291. data/lib/rubocop/cop/rails/presence.rb +105 -0
  292. data/lib/rubocop/cop/rails/present.rb +14 -17
  293. data/lib/rubocop/cop/rails/read_write_attribute.rb +13 -13
  294. data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +91 -0
  295. data/lib/rubocop/cop/rails/relative_date_constant.rb +11 -11
  296. data/lib/rubocop/cop/rails/request_referer.rb +3 -3
  297. data/lib/rubocop/cop/rails/reversible_migration.rb +36 -35
  298. data/lib/rubocop/cop/rails/safe_navigation.rb +7 -8
  299. data/lib/rubocop/cop/rails/save_bang.rb +19 -17
  300. data/lib/rubocop/cop/rails/scope_args.rb +2 -2
  301. data/lib/rubocop/cop/rails/skips_model_validations.rb +2 -2
  302. data/lib/rubocop/cop/rails/time_zone.rb +3 -2
  303. data/lib/rubocop/cop/rails/uniq_before_pluck.rb +4 -2
  304. data/lib/rubocop/cop/rails/unknown_env.rb +63 -0
  305. data/lib/rubocop/cop/rails/validation.rb +8 -8
  306. data/lib/rubocop/cop/registry.rb +2 -1
  307. data/lib/rubocop/cop/security/eval.rb +4 -4
  308. data/lib/rubocop/cop/security/json_load.rb +7 -5
  309. data/lib/rubocop/cop/security/marshal_load.rb +8 -6
  310. data/lib/rubocop/cop/security/yaml_load.rb +4 -4
  311. data/lib/rubocop/cop/style/alias.rb +49 -27
  312. data/lib/rubocop/cop/style/and_or.rb +65 -45
  313. data/lib/rubocop/cop/style/array_join.rb +10 -1
  314. data/lib/rubocop/cop/style/ascii_comments.rb +24 -4
  315. data/lib/rubocop/cop/style/attr.rb +15 -5
  316. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +7 -5
  317. data/lib/rubocop/cop/style/bare_percent_literals.rb +31 -10
  318. data/lib/rubocop/cop/style/begin_block.rb +1 -1
  319. data/lib/rubocop/cop/style/block_comments.rb +17 -3
  320. data/lib/rubocop/cop/style/block_delimiters.rb +82 -16
  321. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +68 -32
  322. data/lib/rubocop/cop/style/case_equality.rb +13 -1
  323. data/lib/rubocop/cop/style/character_literal.rb +10 -0
  324. data/lib/rubocop/cop/style/class_and_module_children.rb +8 -4
  325. data/lib/rubocop/cop/style/class_check.rb +29 -10
  326. data/lib/rubocop/cop/style/class_methods.rb +10 -9
  327. data/lib/rubocop/cop/style/class_vars.rb +5 -4
  328. data/lib/rubocop/cop/style/collection_methods.rb +5 -3
  329. data/lib/rubocop/cop/style/colon_method_call.rb +18 -2
  330. data/lib/rubocop/cop/style/colon_method_definition.rb +36 -0
  331. data/lib/rubocop/cop/style/command_literal.rb +90 -30
  332. data/lib/rubocop/cop/style/comment_annotation.rb +39 -11
  333. data/lib/rubocop/cop/style/commented_keyword.rb +84 -0
  334. data/lib/rubocop/cop/style/conditional_assignment.rb +41 -41
  335. data/lib/rubocop/cop/style/copyright.rb +27 -28
  336. data/lib/rubocop/cop/style/date_time.rb +44 -0
  337. data/lib/rubocop/cop/style/def_with_parentheses.rb +31 -5
  338. data/lib/rubocop/cop/style/dir.rb +48 -0
  339. data/lib/rubocop/cop/style/documentation.rb +17 -2
  340. data/lib/rubocop/cop/style/documentation_method.rb +2 -6
  341. data/lib/rubocop/cop/style/double_negation.rb +1 -1
  342. data/lib/rubocop/cop/style/each_for_simple_loop.rb +8 -8
  343. data/lib/rubocop/cop/style/each_with_object.rb +6 -5
  344. data/lib/rubocop/cop/style/empty_block_parameter.rb +47 -0
  345. data/lib/rubocop/cop/style/empty_case_condition.rb +3 -3
  346. data/lib/rubocop/cop/style/empty_else.rb +55 -24
  347. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +43 -0
  348. data/lib/rubocop/cop/style/empty_literal.rb +25 -14
  349. data/lib/rubocop/cop/style/empty_method.rb +29 -25
  350. data/lib/rubocop/cop/style/encoding.rb +8 -51
  351. data/lib/rubocop/cop/style/end_block.rb +1 -1
  352. data/lib/rubocop/cop/style/eval_with_location.rb +146 -0
  353. data/lib/rubocop/cop/style/even_odd.rb +4 -2
  354. data/lib/rubocop/cop/style/extend_self.rb +92 -0
  355. data/lib/rubocop/cop/style/flip_flop.rb +13 -2
  356. data/lib/rubocop/cop/style/for.rb +6 -2
  357. data/lib/rubocop/cop/style/format_string.rb +33 -5
  358. data/lib/rubocop/cop/style/format_string_token.rb +17 -15
  359. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +7 -6
  360. data/lib/rubocop/cop/style/global_vars.rb +12 -2
  361. data/lib/rubocop/cop/style/guard_clause.rb +6 -4
  362. data/lib/rubocop/cop/style/hash_syntax.rb +56 -56
  363. data/lib/rubocop/cop/style/identical_conditional_branches.rb +12 -8
  364. data/lib/rubocop/cop/style/if_inside_else.rb +11 -11
  365. data/lib/rubocop/cop/style/if_unless_modifier.rb +8 -7
  366. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +3 -2
  367. data/lib/rubocop/cop/style/if_with_semicolon.rb +10 -1
  368. data/lib/rubocop/cop/style/implicit_runtime_error.rb +7 -6
  369. data/lib/rubocop/cop/style/infinite_loop.rb +4 -4
  370. data/lib/rubocop/cop/style/inline_comment.rb +1 -1
  371. data/lib/rubocop/cop/style/inverse_methods.rb +24 -14
  372. data/lib/rubocop/cop/style/lambda.rb +45 -43
  373. data/lib/rubocop/cop/style/lambda_call.rb +37 -10
  374. data/lib/rubocop/cop/style/line_end_concatenation.rb +5 -5
  375. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +3 -19
  376. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +6 -4
  377. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +1 -1
  378. data/lib/rubocop/cop/style/method_def_parentheses.rb +20 -25
  379. data/lib/rubocop/cop/style/method_missing.rb +13 -26
  380. data/lib/rubocop/cop/style/min_max.rb +68 -0
  381. data/lib/rubocop/cop/style/missing_else.rb +20 -6
  382. data/lib/rubocop/cop/style/mixin_grouping.rb +31 -21
  383. data/lib/rubocop/cop/style/mixin_usage.rb +71 -0
  384. data/lib/rubocop/cop/style/module_function.rb +27 -11
  385. data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
  386. data/lib/rubocop/cop/style/multiline_if_modifier.rb +8 -4
  387. data/lib/rubocop/cop/style/multiline_if_then.rb +15 -13
  388. data/lib/rubocop/cop/style/multiline_memoization.rb +33 -17
  389. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
  390. data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
  391. data/lib/rubocop/cop/style/mutable_constant.rb +11 -15
  392. data/lib/rubocop/cop/style/negated_if.rb +27 -31
  393. data/lib/rubocop/cop/style/negated_while.rb +1 -5
  394. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  395. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +26 -23
  396. data/lib/rubocop/cop/style/nested_ternary_operator.rb +1 -1
  397. data/lib/rubocop/cop/style/next.rb +41 -12
  398. data/lib/rubocop/cop/style/nil_comparison.rb +8 -8
  399. data/lib/rubocop/cop/style/non_nil_check.rb +41 -38
  400. data/lib/rubocop/cop/style/not.rb +15 -5
  401. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +8 -4
  402. data/lib/rubocop/cop/style/numeric_literals.rb +9 -9
  403. data/lib/rubocop/cop/style/numeric_predicate.rb +21 -21
  404. data/lib/rubocop/cop/style/one_line_conditional.rb +9 -4
  405. data/lib/rubocop/cop/style/option_hash.rb +11 -25
  406. data/lib/rubocop/cop/style/optional_arguments.rb +1 -2
  407. data/lib/rubocop/cop/style/or_assignment.rb +88 -0
  408. data/lib/rubocop/cop/style/parallel_assignment.rb +16 -16
  409. data/lib/rubocop/cop/style/parentheses_around_condition.rb +30 -13
  410. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +25 -4
  411. data/lib/rubocop/cop/style/percent_q_literals.rb +29 -8
  412. data/lib/rubocop/cop/style/perl_backrefs.rb +8 -1
  413. data/lib/rubocop/cop/style/preferred_hash_methods.rb +7 -11
  414. data/lib/rubocop/cop/style/proc.rb +10 -2
  415. data/lib/rubocop/cop/style/raise_args.rb +22 -29
  416. data/lib/rubocop/cop/style/random_with_offset.rb +160 -0
  417. data/lib/rubocop/cop/style/redundant_begin.rb +16 -5
  418. data/lib/rubocop/cop/style/redundant_conditional.rb +96 -0
  419. data/lib/rubocop/cop/style/redundant_exception.rb +4 -4
  420. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  421. data/lib/rubocop/cop/style/redundant_parentheses.rb +14 -12
  422. data/lib/rubocop/cop/style/redundant_return.rb +28 -15
  423. data/lib/rubocop/cop/style/redundant_self.rb +35 -27
  424. data/lib/rubocop/cop/style/regexp_literal.rb +88 -27
  425. data/lib/rubocop/cop/style/rescue_modifier.rb +12 -1
  426. data/lib/rubocop/cop/style/rescue_standard_error.rb +122 -0
  427. data/lib/rubocop/cop/style/return_nil.rb +89 -0
  428. data/lib/rubocop/cop/style/safe_navigation.rb +100 -48
  429. data/lib/rubocop/cop/style/self_assignment.rb +13 -13
  430. data/lib/rubocop/cop/style/semicolon.rb +19 -9
  431. data/lib/rubocop/cop/style/send.rb +10 -1
  432. data/lib/rubocop/cop/style/signal_exception.rb +104 -3
  433. data/lib/rubocop/cop/style/single_line_block_params.rb +16 -15
  434. data/lib/rubocop/cop/style/single_line_methods.rb +26 -18
  435. data/lib/rubocop/cop/style/special_global_vars.rb +19 -14
  436. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +23 -50
  437. data/lib/rubocop/cop/style/stderr_puts.rb +54 -0
  438. data/lib/rubocop/cop/style/string_hash_keys.rb +36 -0
  439. data/lib/rubocop/cop/style/string_literals.rb +26 -3
  440. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +16 -1
  441. data/lib/rubocop/cop/style/string_methods.rb +19 -8
  442. data/lib/rubocop/cop/style/struct_inheritance.rb +3 -3
  443. data/lib/rubocop/cop/style/symbol_array.rb +7 -35
  444. data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
  445. data/lib/rubocop/cop/style/symbol_proc.rb +11 -25
  446. data/lib/rubocop/cop/style/ternary_parentheses.rb +46 -51
  447. data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +101 -0
  448. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +20 -6
  449. data/lib/rubocop/cop/style/trailing_comma_in_literal.rb +22 -7
  450. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +95 -0
  451. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +70 -24
  452. data/lib/rubocop/cop/style/trivial_accessors.rb +72 -65
  453. data/lib/rubocop/cop/style/unless_else.rb +16 -1
  454. data/lib/rubocop/cop/style/unneeded_capital_w.rb +18 -8
  455. data/lib/rubocop/cop/style/unneeded_interpolation.rb +15 -19
  456. data/lib/rubocop/cop/style/unneeded_percent_q.rb +14 -13
  457. data/lib/rubocop/cop/style/variable_interpolation.rb +23 -9
  458. data/lib/rubocop/cop/style/when_then.rb +14 -1
  459. data/lib/rubocop/cop/style/while_until_do.rb +27 -4
  460. data/lib/rubocop/cop/style/while_until_modifier.rb +26 -6
  461. data/lib/rubocop/cop/style/word_array.rb +9 -30
  462. data/lib/rubocop/cop/style/yoda_condition.rb +51 -22
  463. data/lib/rubocop/cop/style/zero_length_predicate.rb +44 -29
  464. data/lib/rubocop/cop/team.rb +16 -8
  465. data/lib/rubocop/cop/util.rb +43 -34
  466. data/lib/rubocop/cop/variable_force.rb +1 -1
  467. data/lib/rubocop/cop/variable_force/assignment.rb +4 -2
  468. data/lib/rubocop/cop/variable_force/scope.rb +1 -5
  469. data/lib/rubocop/cop/variable_force/variable.rb +1 -1
  470. data/lib/rubocop/formatter/disabled_config_formatter.rb +3 -4
  471. data/lib/rubocop/formatter/formatter_set.rb +3 -1
  472. data/lib/rubocop/formatter/html_formatter.rb +1 -1
  473. data/lib/rubocop/formatter/json_formatter.rb +9 -3
  474. data/lib/rubocop/formatter/offense_count_formatter.rb +2 -0
  475. data/lib/rubocop/formatter/quiet_formatter.rb +13 -0
  476. data/lib/rubocop/formatter/simple_text_formatter.rb +3 -3
  477. data/lib/rubocop/formatter/tap_formatter.rb +71 -0
  478. data/lib/rubocop/formatter/worst_offenders_formatter.rb +2 -0
  479. data/lib/rubocop/node_pattern.rb +46 -29
  480. data/lib/rubocop/options.rb +13 -8
  481. data/lib/rubocop/path_util.rb +15 -3
  482. data/lib/rubocop/processed_source.rb +8 -9
  483. data/lib/rubocop/rake_task.rb +16 -23
  484. data/lib/rubocop/remote_config.rb +13 -1
  485. data/lib/rubocop/result_cache.rb +1 -0
  486. data/lib/rubocop/rspec/cop_helper.rb +10 -10
  487. data/lib/rubocop/rspec/expect_offense.rb +6 -8
  488. data/lib/rubocop/rspec/shared_contexts.rb +4 -8
  489. data/lib/rubocop/rspec/shared_examples.rb +8 -8
  490. data/lib/rubocop/rspec/support.rb +5 -5
  491. data/lib/rubocop/runner.rb +1 -1
  492. data/lib/rubocop/string_util.rb +2 -0
  493. data/lib/rubocop/token.rb +74 -0
  494. data/lib/rubocop/version.rb +1 -1
  495. metadata +118 -48
  496. data/lib/rubocop/cop/layout/space_inside_brackets.rb +0 -20
  497. data/lib/rubocop/cop/lint/invalid_character_literal.rb +0 -41
  498. data/lib/rubocop/cop/mixin/access_modifier_node.rb +0 -41
  499. data/lib/rubocop/cop/mixin/on_method_def.rb +0 -44
  500. data/lib/rubocop/cop/mixin/space_inside.rb +0 -76
  501. data/lib/rubocop/cop/style/accessor_method_name.rb +0 -45
  502. data/lib/rubocop/cop/style/class_and_module_camel_case.rb +0 -29
  503. data/lib/rubocop/cop/style/constant_name.rb +0 -29
  504. data/lib/rubocop/cop/style/method_name.rb +0 -34
  505. data/lib/rubocop/cop/style/predicate_name.rb +0 -67
  506. data/lib/rubocop/cop/style/variable_name.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19d303a2e571971385e48eab0517fd03f0273c9c
4
- data.tar.gz: 30129d935542762c11820ad7386ff213d4944cd2
3
+ metadata.gz: dbbe943a5ed0fd35d07ba728c5569d279eaffbb8
4
+ data.tar.gz: 0fd2d58d865e457479f1d6ce0d8f12c7cda1dba3
5
5
  SHA512:
6
- metadata.gz: 8725c2dc3d92496b06acd39cc8efc4fd25e45e5ea7b3e3e3f565cf923de82c46f5efec1e279b75151f3a81341b94b9c70c0c3c66af60c3ab2bd2b844963993b9
7
- data.tar.gz: d51e988da1e14e4b9477a2f5bec04cbd9509bcc09bb8febfc3e8d2df9957e8c98bb5c94e90fa3bacf9b0d848d496427bf6c57206c48a9c7acc3490bfade5d7c6
6
+ metadata.gz: 4253ebe0cf732ca876078c01852f99cbfb9cc44f8bdb053bc368f6d18839c90152b87322738c052e15b8b128fa4a2e7f85902d8445d961b21df232a3b4fbb184
7
+ data.tar.gz: 9deb27503042d598d22d3f748a72fea9900b37a4fb95400180fada165e4ee393631d1b53456230d1a0aa1a69b8d26899c2b2e6253363912f2813de1eb6ac9f7b
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rubocop.svg)](http://badge.fury.io/rb/rubocop)
2
2
  [![Dependency Status](https://gemnasium.com/bbatsov/rubocop.svg)](https://gemnasium.com/bbatsov/rubocop)
3
3
  [![Travis Status](https://travis-ci.org/bbatsov/rubocop.svg?branch=master)](https://travis-ci.org/bbatsov/rubocop)
4
- [![Appveyor Status](https://ci.appveyor.com/api/projects/status/github/bbatsov/rubocop?svg=true)](https://ci.appveyor.com/project/bbatsov/rubocop)
4
+ [![Appveyor status](https://ci.appveyor.com/api/projects/status/e5jdwocv30oqm4sm?svg=true)](https://ci.appveyor.com/project/bbatsov/rubocop)
5
5
  [![Coverage Status](https://img.shields.io/codeclimate/coverage/github/bbatsov/rubocop.svg)](https://codeclimate.com/github/bbatsov/rubocop)
6
6
  [![Code Climate](https://codeclimate.com/github/bbatsov/rubocop/badges/gpa.svg)](https://codeclimate.com/github/bbatsov/rubocop)
7
7
  [![Inline docs](http://inch-ci.org/github/bbatsov/rubocop.svg)](http://inch-ci.org/github/bbatsov/rubocop)
@@ -51,7 +51,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
51
51
  might want to use a conservative version locking in your `Gemfile`:
52
52
 
53
53
  ```rb
54
- gem 'rubocop', '~> 0.49.1', require: false
54
+ gem 'rubocop', '~> 0.52.0', require: false
55
55
  ```
56
56
 
57
57
  ## Quickstart
@@ -71,13 +71,8 @@ You can read a ton more about RuboCop in its [official manual](http://rubocop.re
71
71
 
72
72
  RuboCop supports the following Ruby implementations:
73
73
 
74
- * MRI 2.0
75
- * MRI 2.1
76
- * MRI 2.2
77
- * MRI 2.3
78
- * MRI 2.4
74
+ * MRI 2.1+
79
75
  * JRuby 9.0+
80
- * Rubinius 2.0+
81
76
 
82
77
  ## Team
83
78
 
@@ -86,7 +81,9 @@ Here's a list of RuboCop's core developers:
86
81
  * [Bozhidar Batsov](https://github.com/bbatsov)
87
82
  * [Jonas Arvidsson](https://github.com/jonas054)
88
83
  * [Yuji Nakayama](https://github.com/yujinakayama)
89
- * [Evgeni Dzhelyov](https://github.com/edzhelyov)
84
+ * [Evgeni Dzhelyov](https://github.com/edzhelyov) (retired)
85
+ * [Ted Johansson](https://github.com/drenmi)
86
+ * [Masataka Kuwabara](https://github.com/pocke)
90
87
 
91
88
  ## Logo
92
89
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- $LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
4
+ $LOAD_PATH.unshift("#{__dir__}/../lib")
5
5
 
6
6
  require 'rubocop'
7
7
  require 'benchmark'
@@ -55,13 +55,14 @@ AllCops:
55
55
  - '**/Vagabondfile'
56
56
  - '**/Vagrantfile'
57
57
  Exclude:
58
+ - 'node_modules/**/*'
58
59
  - 'vendor/**/*'
59
60
  # Default formatter will be used if no `-f/--format` option is given.
60
61
  DefaultFormatter: progress
61
- # Cop names are not displayed in offense messages by default. Change behavior
62
- # by overriding DisplayCopNames, or by giving the `-D/--display-cop-names`
62
+ # Cop names are displayed in offense messages by default. Change behavior
63
+ # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
63
64
  # option.
64
- DisplayCopNames: false
65
+ DisplayCopNames: true
65
66
  # Style guide URLs are not displayed in offense messages by default. Change
66
67
  # behavior by overriding `DisplayStyleGuide`, or by giving the
67
68
  # `-S/--display-style-guide` option.
@@ -489,6 +490,10 @@ Layout/SpaceBeforeBlockBraces:
489
490
  SupportedStyles:
490
491
  - space
491
492
  - no_space
493
+ EnforcedStyleForEmptyBraces: no_space
494
+ SupportedStylesForEmptyBraces:
495
+ - space
496
+ - no_space
492
497
 
493
498
  Layout/SpaceBeforeFirstArg:
494
499
  # When `true`, allows most uses of extra spacing if the intent is to align
@@ -496,6 +501,19 @@ Layout/SpaceBeforeFirstArg:
496
501
  # lines.
497
502
  AllowForAlignment: true
498
503
 
504
+ Layout/SpaceInsideArrayLiteralBrackets:
505
+ EnforcedStyle: no_space
506
+ SupportedStyles:
507
+ - space
508
+ - no_space
509
+ # 'compact' normally requires a space inside the brackets, with the exception
510
+ # that successive left brackets or right brackets are collapsed together
511
+ - compact
512
+ EnforcedStyleForEmptyBrackets: no_space
513
+ SupportedStylesForEmptyBrackets:
514
+ - space
515
+ - no_space
516
+
499
517
  Layout/SpaceInsideBlockBraces:
500
518
  EnforcedStyle: space
501
519
  SupportedStyles:
@@ -521,18 +539,165 @@ Layout/SpaceInsideHashLiteralBraces:
521
539
  - space
522
540
  - no_space
523
541
 
542
+ Layout/SpaceInsideReferenceBrackets:
543
+ EnforcedStyle: no_space
544
+ SupportedStyles:
545
+ - space
546
+ - no_space
547
+
524
548
  Layout/SpaceInsideStringInterpolation:
525
549
  EnforcedStyle: no_space
526
550
  SupportedStyles:
527
551
  - space
528
552
  - no_space
529
553
 
554
+ Layout/ClassStructure:
555
+ Description: 'Enforces a configured order of definitions within a class body.'
556
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-classes'
557
+ Enabled: false
558
+ Categories:
559
+ module_inclusion:
560
+ - include
561
+ - prepend
562
+ - extend
563
+ ExpectedOrder:
564
+ - module_inclusion
565
+ - constants
566
+ - public_class_methods
567
+ - initializer
568
+ - public_methods
569
+ - protected_methods
570
+ - private_methods
571
+
572
+ Layout/Tab:
573
+ # By default, the indentation width from Layout/IndentationWidth is used
574
+ # But it can be overridden by setting this parameter
575
+ # It is used during auto-correction to determine how many spaces should
576
+ # replace each tab.
577
+ IndentationWidth: ~
578
+
530
579
  Layout/TrailingBlankLines:
531
580
  EnforcedStyle: final_newline
532
581
  SupportedStyles:
533
582
  - final_newline
534
583
  - final_blank_line
535
584
 
585
+ #################### Naming ##########################
586
+
587
+ Naming/FileName:
588
+ # File names listed in `AllCops:Include` are excluded by default. Add extra
589
+ # excludes here.
590
+ Exclude: []
591
+ # When `true`, requires that each source file should define a class or module
592
+ # with a name which matches the file name (converted to ... case).
593
+ # It further expects it to be nested inside modules which match the names
594
+ # of subdirectories in its path.
595
+ ExpectMatchingDefinition: false
596
+ # If non-`nil`, expect all source file names to match the following regex.
597
+ # Only the file name itself is matched, not the entire file path.
598
+ # Use anchors as necessary if you want to match the entire name rather than
599
+ # just a part of it.
600
+ Regex: ~
601
+ # With `IgnoreExecutableScripts` set to `true`, this cop does not
602
+ # report offending filenames for executable scripts (i.e. source
603
+ # files with a shebang in the first line).
604
+ IgnoreExecutableScripts: true
605
+ AllowedAcronyms:
606
+ - CLI
607
+ - DSL
608
+ - ACL
609
+ - API
610
+ - ASCII
611
+ - CPU
612
+ - CSS
613
+ - DNS
614
+ - EOF
615
+ - GUID
616
+ - HTML
617
+ - HTTP
618
+ - HTTPS
619
+ - ID
620
+ - IP
621
+ - JSON
622
+ - LHS
623
+ - QPS
624
+ - RAM
625
+ - RHS
626
+ - RPC
627
+ - SLA
628
+ - SMTP
629
+ - SQL
630
+ - SSH
631
+ - TCP
632
+ - TLS
633
+ - TTL
634
+ - UDP
635
+ - UI
636
+ - UID
637
+ - UUID
638
+ - URI
639
+ - URL
640
+ - UTF8
641
+ - VM
642
+ - XML
643
+ - XMPP
644
+ - XSRF
645
+ - XSS
646
+
647
+ Naming/HeredocDelimiterNaming:
648
+ Blacklist:
649
+ - END
650
+ - !ruby/regexp '/EO[A-Z]{1}/'
651
+
652
+ Naming/HeredocDelimiterCase:
653
+ EnforcedStyle: uppercase
654
+ SupportedStyles:
655
+ - lowercase
656
+ - uppercase
657
+
658
+ Naming/MethodName:
659
+ EnforcedStyle: snake_case
660
+ SupportedStyles:
661
+ - snake_case
662
+ - camelCase
663
+
664
+ Naming/PredicateName:
665
+ # Predicate name prefixes.
666
+ NamePrefix:
667
+ - is_
668
+ - has_
669
+ - have_
670
+ # Predicate name prefixes that should be removed.
671
+ NamePrefixBlacklist:
672
+ - is_
673
+ - has_
674
+ - have_
675
+ # Predicate names which, despite having a blacklisted prefix, or no `?`,
676
+ # should still be accepted
677
+ NameWhitelist:
678
+ - is_a?
679
+ # Method definition macros for dynamically generated methods.
680
+ MethodDefinitionMacros:
681
+ - define_method
682
+ - define_singleton_method
683
+ # Exclude Rspec specs because there is a strong convention to write spec
684
+ # helpers in the form of `have_something` or `be_something`.
685
+ Exclude:
686
+ - 'spec/**/*'
687
+
688
+ Naming/VariableName:
689
+ EnforcedStyle: snake_case
690
+ SupportedStyles:
691
+ - snake_case
692
+ - camelCase
693
+
694
+ Naming/VariableNumber:
695
+ EnforcedStyle: normalcase
696
+ SupportedStyles:
697
+ - snake_case
698
+ - normalcase
699
+ - non_integer
700
+
536
701
  #################### Style ###########################
537
702
 
538
703
  Style/Alias:
@@ -549,6 +714,9 @@ Style/AndOr:
549
714
  - always
550
715
  - conditionals
551
716
 
717
+ Style/AsciiComments:
718
+ AllowedChars: []
719
+
552
720
  # Checks if usage of `%()` or `%Q()` matches configuration.
553
721
  Style/BarePercentLiterals:
554
722
  EnforcedStyle: bare_percent
@@ -762,76 +930,11 @@ Style/EmptyMethod:
762
930
  - compact
763
931
  - expanded
764
932
 
765
- # Checks whether the source file has a utf-8 encoding comment or not
766
- # AutoCorrectEncodingComment must match the regex
767
- # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
768
- Style/Encoding:
769
- EnforcedStyle: never
933
+ Style/ExtendSelf:
934
+ EnforcedStyle: module_function
770
935
  SupportedStyles:
771
- - when_needed
772
- - always
773
- - never
774
- AutoCorrectEncodingComment: '# encoding: utf-8'
775
-
776
- Style/FileName:
777
- # File names listed in `AllCops:Include` are excluded by default. Add extra
778
- # excludes here.
779
- Exclude: []
780
- # When `true`, requires that each source file should define a class or module
781
- # with a name which matches the file name (converted to ... case).
782
- # It further expects it to be nested inside modules which match the names
783
- # of subdirectories in its path.
784
- ExpectMatchingDefinition: false
785
- # If non-`nil`, expect all source file names to match the following regex.
786
- # Only the file name itself is matched, not the entire file path.
787
- # Use anchors as necessary if you want to match the entire name rather than
788
- # just a part of it.
789
- Regex: ~
790
- # With `IgnoreExecutableScripts` set to `true`, this cop does not
791
- # report offending filenames for executable scripts (i.e. source
792
- # files with a shebang in the first line).
793
- IgnoreExecutableScripts: true
794
- AllowedAcronyms:
795
- - CLI
796
- - DSL
797
- - ACL
798
- - API
799
- - ASCII
800
- - CPU
801
- - CSS
802
- - DNS
803
- - EOF
804
- - GUID
805
- - HTML
806
- - HTTP
807
- - HTTPS
808
- - ID
809
- - IP
810
- - JSON
811
- - LHS
812
- - QPS
813
- - RAM
814
- - RHS
815
- - RPC
816
- - SLA
817
- - SMTP
818
- - SQL
819
- - SSH
820
- - TCP
821
- - TLS
822
- - TTL
823
- - UDP
824
- - UI
825
- - UID
826
- - UUID
827
- - URI
828
- - URL
829
- - UTF8
830
- - VM
831
- - XML
832
- - XMPP
833
- - XSRF
834
- - XSS
936
+ - module_function
937
+ - extend_self
835
938
 
836
939
  # Checks use of for or each in multiline loops.
837
940
  Style/For:
@@ -857,6 +960,7 @@ Style/FormatStringToken:
857
960
  - annotated
858
961
  # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
859
962
  - template
963
+ - unannotated
860
964
 
861
965
  Style/FrozenStringLiteralComment:
862
966
  EnforcedStyle: when_needed
@@ -898,9 +1002,6 @@ Style/HashSyntax:
898
1002
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
899
1003
  PreferHashRocketsForNonAlnumEndingSymbols: false
900
1004
 
901
- Style/IfUnlessModifier:
902
- MaxLineLength: 80
903
-
904
1005
  Style/InverseMethods:
905
1006
  Enabled: true
906
1007
  # `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
@@ -947,12 +1048,6 @@ Style/MethodDefParentheses:
947
1048
  - require_no_parentheses
948
1049
  - require_no_parentheses_except_multiline
949
1050
 
950
- Style/MethodName:
951
- EnforcedStyle: snake_case
952
- SupportedStyles:
953
- - snake_case
954
- - camelCase
955
-
956
1051
  # Checks the grouping of mixins (`include`, `extend`, `prepend`) in `class` and
957
1052
  # `module` bodies.
958
1053
  Style/MixinGrouping:
@@ -985,6 +1080,26 @@ Style/NegatedIf:
985
1080
  - prefix
986
1081
  - postfix
987
1082
 
1083
+ Style/NestedParenthesizedCalls:
1084
+ Whitelist:
1085
+ - be
1086
+ - be_a
1087
+ - be_an
1088
+ - be_between
1089
+ - be_falsey
1090
+ - be_kind_of
1091
+ - be_instance_of
1092
+ - be_truthy
1093
+ - be_within
1094
+ - eq
1095
+ - eql
1096
+ - end_with
1097
+ - include
1098
+ - match
1099
+ - raise_error
1100
+ - respond_to
1101
+ - start_with
1102
+
988
1103
  Style/Next:
989
1104
  # With `always` all conditions at the end of an iteration needs to be
990
1105
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
@@ -1057,26 +1172,6 @@ Style/PercentQLiterals:
1057
1172
  - lower_case_q # Use `%q` when possible, `%Q` when necessary
1058
1173
  - upper_case_q # Always use `%Q`
1059
1174
 
1060
- Style/PredicateName:
1061
- # Predicate name prefixes.
1062
- NamePrefix:
1063
- - is_
1064
- - has_
1065
- - have_
1066
- # Predicate name prefixes that should be removed.
1067
- NamePrefixBlacklist:
1068
- - is_
1069
- - has_
1070
- - have_
1071
- # Predicate names which, despite having a blacklisted prefix, or no `?`,
1072
- # should still be accepted
1073
- NameWhitelist:
1074
- - is_a?
1075
- # Exclude Rspec specs because there is a strong convention to write spec
1076
- # helpers in the form of `have_something` or `be_something`.
1077
- Exclude:
1078
- - 'spec/**/*'
1079
-
1080
1175
  Style/PreferredHashMethods:
1081
1176
  EnforcedStyle: short
1082
1177
  SupportedStyles:
@@ -1107,6 +1202,20 @@ Style/RegexpLiteral:
1107
1202
  # are found in the regexp string.
1108
1203
  AllowInnerSlashes: false
1109
1204
 
1205
+ Style/RescueStandardError:
1206
+ EnforcedStyle: explicit
1207
+ # implicit: Do not include the error class, `rescue`
1208
+ # explicit: Require an error class `rescue StandardError`
1209
+ SupportedStyles:
1210
+ - implicit
1211
+ - explicit
1212
+
1213
+ Style/ReturnNil:
1214
+ EnforcedStyle: return
1215
+ SupportedStyles:
1216
+ - return
1217
+ - return_nil
1218
+
1110
1219
  Style/SafeNavigation:
1111
1220
  # Safe navigation may cause a statement to start returning `nil` in addition
1112
1221
  # to whatever it used to return.
@@ -1258,22 +1367,6 @@ Style/TrivialAccessors:
1258
1367
  - to_s
1259
1368
  - to_sym
1260
1369
 
1261
- Style/VariableName:
1262
- EnforcedStyle: snake_case
1263
- SupportedStyles:
1264
- - snake_case
1265
- - camelCase
1266
-
1267
- Style/VariableNumber:
1268
- EnforcedStyle: normalcase
1269
- SupportedStyles:
1270
- - snake_case
1271
- - normalcase
1272
- - non_integer
1273
-
1274
- Style/WhileUntilModifier:
1275
- MaxLineLength: 80
1276
-
1277
1370
  # `WordArray` enforces how array literals of word-like strings should be expressed.
1278
1371
  Style/WordArray:
1279
1372
  EnforcedStyle: percent
@@ -1289,6 +1382,14 @@ Style/WordArray:
1289
1382
  # The regular expression `WordRegex` decides what is considered a word.
1290
1383
  WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
1291
1384
 
1385
+ Style/YodaCondition:
1386
+ EnforcedStyle: all_comparison_operators
1387
+ SupportedStyles:
1388
+ # check all comparison operators
1389
+ - all_comparison_operators
1390
+ # check only equality operators: `!=` and `==`
1391
+ - equality_operators_only
1392
+
1292
1393
  #################### Metrics ###############################
1293
1394
 
1294
1395
  Metrics/AbcSize:
@@ -1398,6 +1499,16 @@ Lint/InheritException:
1398
1499
  - runtime_error
1399
1500
  - standard_error
1400
1501
 
1502
+ Lint/MissingCopEnableDirective:
1503
+ # Maximum number of consecutive lines the cop can be disabled for.
1504
+ # 0 allows only single-line disables
1505
+ # 1 would mean the maximum allowed is the following:
1506
+ # # rubocop:disable SomeCop
1507
+ # a = 1
1508
+ # # rubocop:enable SomeCop
1509
+ # .inf for any size
1510
+ MaximumRangeSize: .inf
1511
+
1401
1512
  Lint/SafeNavigationChain:
1402
1513
  Whitelist:
1403
1514
  - present?
@@ -1405,6 +1516,10 @@ Lint/SafeNavigationChain:
1405
1516
  - presence
1406
1517
  - try
1407
1518
 
1519
+ # Checks for shadowed arguments
1520
+ Lint/ShadowedArgument:
1521
+ IgnoreImplicitReferences: false
1522
+
1408
1523
  # Checks for unused block arguments
1409
1524
  Lint/UnusedBlockArgument:
1410
1525
  IgnoreEmptyBlocks: true
@@ -1436,6 +1551,10 @@ Rails/ActionFilter:
1436
1551
  Include:
1437
1552
  - app/controllers/**/*.rb
1438
1553
 
1554
+ Rails/CreateTableWithTimestamps:
1555
+ Include:
1556
+ - db/migrate/*.rb
1557
+
1439
1558
  Rails/Date:
1440
1559
  # The value `strict` disallows usage of `Date.today`, `Date.current`,
1441
1560
  # `Date#to_time` etc.
@@ -1447,6 +1566,12 @@ Rails/Date:
1447
1566
  - strict
1448
1567
  - flexible
1449
1568
 
1569
+ Rails/Delegate:
1570
+ # When set to true, using the target object as a prefix of the
1571
+ # method name without using the `delegate` method will be a
1572
+ # violation. When set to false, this case is legal.
1573
+ EnforceForPrefixed: true
1574
+
1450
1575
  Rails/DynamicFindBy:
1451
1576
  Whitelist:
1452
1577
  - find_by_sql
@@ -1475,6 +1600,18 @@ Rails/HasAndBelongsToMany:
1475
1600
  Include:
1476
1601
  - app/models/**/*.rb
1477
1602
 
1603
+ Rails/HasManyOrHasOneDependent:
1604
+ Include:
1605
+ - app/models/**/*.rb
1606
+
1607
+ Rails/InverseOf:
1608
+ Include:
1609
+ - app/models/**/*.rb
1610
+
1611
+ Rails/LexicallyScopedActionFilter:
1612
+ Include:
1613
+ - app/controllers/**/*.rb
1614
+
1478
1615
  Rails/NotNullColumn:
1479
1616
  Include:
1480
1617
  - db/migrate/*.rb
@@ -1502,7 +1639,7 @@ Rails/ReversibleMigration:
1502
1639
 
1503
1640
  Rails/SafeNavigation:
1504
1641
  # This will convert usages of `try` to use safe navigation as well as `try!`.
1505
- # `try` and `try!` work slighly differently. `try!` and safe navigation will
1642
+ # `try` and `try!` work slightly differently. `try!` and safe navigation will
1506
1643
  # both raise a `NoMethodError` if the receiver of the method call does not
1507
1644
  # implement the intended method. `try` will not raise an exception for this.
1508
1645
  ConvertTry: false
@@ -1526,6 +1663,12 @@ Rails/UniqBeforePluck:
1526
1663
  - aggressive
1527
1664
  AutoCorrect: false
1528
1665
 
1666
+ Rails/UnknownEnv:
1667
+ Environments:
1668
+ - development
1669
+ - test
1670
+ - production
1671
+
1529
1672
  Rails/SkipsModelValidations:
1530
1673
  Blacklist:
1531
1674
  - decrement!
@@ -1546,3 +1689,6 @@ Rails/Validation:
1546
1689
 
1547
1690
  Bundler/OrderedGems:
1548
1691
  TreatCommentsAsGroupSeparators: true
1692
+
1693
+ Gemspec/OrderedDependencies:
1694
+ TreatCommentsAsGroupSeparators: true