rubocop 0.35.1 → 0.36.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +164 -0
- data/LICENSE.txt +1 -1
- data/README.md +72 -21
- data/bin/rubocop +1 -0
- data/config/default.yml +167 -18
- data/config/disabled.yml +19 -6
- data/config/enabled.yml +159 -14
- data/lib/rubocop.rb +67 -26
- data/lib/rubocop/ast_node.rb +488 -14
- data/lib/rubocop/ast_node/builder.rb +24 -0
- data/lib/rubocop/ast_node/sexp.rb +13 -0
- data/lib/rubocop/cached_data.rb +58 -0
- data/lib/rubocop/cli.rb +47 -10
- data/lib/rubocop/comment_config.rb +9 -2
- data/lib/rubocop/config.rb +99 -31
- data/lib/rubocop/config_loader.rb +23 -14
- data/lib/rubocop/config_store.rb +1 -0
- data/lib/rubocop/cop/autocorrect_logic.rb +2 -1
- data/lib/rubocop/cop/commissioner.rb +3 -5
- data/lib/rubocop/cop/cop.rb +23 -17
- data/lib/rubocop/cop/corrector.rb +25 -0
- data/lib/rubocop/cop/force.rb +1 -0
- data/lib/rubocop/cop/ignored_node.rb +3 -2
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +2 -1
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +2 -1
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +4 -3
- data/lib/rubocop/cop/lint/block_alignment.rb +29 -91
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +2 -1
- data/lib/rubocop/cop/lint/condition_position.rb +2 -1
- data/lib/rubocop/cop/lint/debugger.rb +29 -12
- data/lib/rubocop/cop/lint/def_end_alignment.rb +16 -18
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +6 -6
- data/lib/rubocop/cop/lint/duplicate_methods.rb +98 -74
- data/lib/rubocop/cop/lint/duplicated_key.rb +3 -2
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +3 -2
- data/lib/rubocop/cop/lint/else_layout.rb +2 -1
- data/lib/rubocop/cop/lint/empty_ensure.rb +2 -1
- data/lib/rubocop/cop/lint/empty_interpolation.rb +2 -1
- data/lib/rubocop/cop/lint/end_alignment.rb +77 -39
- data/lib/rubocop/cop/lint/end_in_method.rb +2 -1
- data/lib/rubocop/cop/lint/ensure_return.rb +2 -1
- data/lib/rubocop/cop/lint/eval.rb +2 -1
- data/lib/rubocop/cop/lint/float_out_of_range.rb +31 -0
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +14 -30
- data/lib/rubocop/cop/lint/handle_exceptions.rb +2 -1
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +85 -0
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +120 -0
- data/lib/rubocop/cop/lint/invalid_character_literal.rb +3 -1
- data/lib/rubocop/cop/lint/literal_in_condition.rb +6 -9
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +6 -9
- data/lib/rubocop/cop/lint/loop.rb +2 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +19 -3
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +38 -0
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +5 -8
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +8 -6
- data/lib/rubocop/cop/lint/rand_one.rb +36 -0
- data/lib/rubocop/cop/lint/require_parentheses.rb +6 -5
- data/lib/rubocop/cop/lint/rescue_exception.rb +3 -2
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +2 -1
- data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +6 -4
- data/lib/rubocop/cop/lint/syntax.rb +9 -5
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +3 -2
- data/lib/rubocop/cop/lint/unneeded_disable.rb +121 -18
- data/lib/rubocop/cop/lint/unreachable_code.rb +5 -4
- data/lib/rubocop/cop/lint/unused_block_argument.rb +9 -7
- data/lib/rubocop/cop/lint/unused_method_argument.rb +2 -1
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +56 -29
- data/lib/rubocop/cop/lint/useless_assignment.rb +4 -16
- data/lib/rubocop/cop/lint/useless_comparison.rb +3 -2
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +2 -1
- data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -20
- data/lib/rubocop/cop/lint/void.rb +10 -11
- data/lib/rubocop/cop/metrics/abc_size.rb +3 -1
- data/lib/rubocop/cop/metrics/block_nesting.rb +2 -1
- data/lib/rubocop/cop/metrics/class_length.rb +1 -0
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +4 -2
- data/lib/rubocop/cop/metrics/line_length.rb +35 -13
- data/lib/rubocop/cop/metrics/method_length.rb +2 -1
- data/lib/rubocop/cop/metrics/module_length.rb +1 -0
- data/lib/rubocop/cop/metrics/parameter_lists.rb +2 -1
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +4 -2
- data/lib/rubocop/cop/mixin/access_modifier_node.rb +3 -10
- data/lib/rubocop/cop/mixin/annotation_comment.rb +1 -0
- data/lib/rubocop/cop/mixin/array_hash_indentation.rb +80 -0
- data/lib/rubocop/cop/mixin/array_syntax.rb +2 -1
- data/lib/rubocop/cop/mixin/autocorrect_alignment.rb +14 -20
- data/lib/rubocop/cop/mixin/autocorrect_unless_changing_ast.rb +5 -4
- data/lib/rubocop/cop/mixin/check_assignment.rb +20 -15
- data/lib/rubocop/cop/mixin/classish_length.rb +1 -0
- data/lib/rubocop/cop/mixin/code_length.rb +1 -0
- data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +17 -15
- data/lib/rubocop/cop/mixin/configurable_max.rb +1 -0
- data/lib/rubocop/cop/mixin/configurable_naming.rb +4 -0
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +9 -4
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +24 -16
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +3 -2
- data/lib/rubocop/cop/mixin/hash_node.rb +15 -0
- data/lib/rubocop/cop/mixin/if_node.rb +1 -0
- data/lib/rubocop/cop/mixin/method_complexity.rb +1 -0
- data/lib/rubocop/cop/mixin/method_preference.rb +1 -0
- data/lib/rubocop/cop/mixin/min_body_length.rb +1 -0
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +177 -0
- data/lib/rubocop/cop/mixin/negative_conditional.rb +1 -0
- data/lib/rubocop/cop/mixin/on_method_def.rb +6 -5
- data/lib/rubocop/cop/mixin/on_normal_if_unless.rb +1 -0
- data/lib/rubocop/cop/mixin/parentheses.rb +22 -0
- data/lib/rubocop/cop/mixin/parser_diagnostic.rb +1 -0
- data/lib/rubocop/cop/mixin/percent_literal.rb +1 -0
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +79 -0
- data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -0
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +2 -1
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +2 -1
- data/lib/rubocop/cop/mixin/space_inside.rb +2 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +6 -5
- data/lib/rubocop/cop/mixin/string_help.rb +2 -9
- data/lib/rubocop/cop/mixin/string_literals_help.rb +13 -7
- data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -2
- data/lib/rubocop/cop/mixin/trailing_comma.rb +134 -0
- data/lib/rubocop/cop/mixin/unused_argument.rb +1 -0
- data/lib/rubocop/cop/offense.rb +19 -14
- data/lib/rubocop/cop/performance/case_when_splat.rb +8 -8
- data/lib/rubocop/cop/performance/casecmp.rb +54 -0
- data/lib/rubocop/cop/performance/count.rb +10 -9
- data/lib/rubocop/cop/performance/detect.rb +6 -5
- data/lib/rubocop/cop/performance/double_start_end_with.rb +65 -0
- data/lib/rubocop/cop/performance/end_with.rb +55 -0
- data/lib/rubocop/cop/performance/fixed_size.rb +1 -0
- data/lib/rubocop/cop/performance/flat_map.rb +9 -8
- data/lib/rubocop/cop/performance/hash_each.rb +86 -0
- data/lib/rubocop/cop/performance/lstrip_rstrip.rb +44 -0
- data/lib/rubocop/cop/performance/range_include.rb +40 -0
- data/lib/rubocop/cop/performance/redundant_block_call.rb +57 -0
- data/lib/rubocop/cop/performance/redundant_match.rb +51 -0
- data/lib/rubocop/cop/performance/redundant_merge.rb +85 -0
- data/lib/rubocop/cop/performance/redundant_sort_by.rb +45 -0
- data/lib/rubocop/cop/performance/reverse_each.rb +3 -2
- data/lib/rubocop/cop/performance/sample.rb +6 -5
- data/lib/rubocop/cop/performance/size.rb +2 -1
- data/lib/rubocop/cop/performance/start_with.rb +58 -0
- data/lib/rubocop/cop/performance/string_replacement.rb +18 -23
- data/lib/rubocop/cop/performance/times_map.rb +49 -0
- data/lib/rubocop/cop/rails/action_filter.rb +4 -3
- data/lib/rubocop/cop/rails/date.rb +5 -4
- data/lib/rubocop/cop/rails/delegate.rb +3 -2
- data/lib/rubocop/cop/rails/find_by.rb +20 -14
- data/lib/rubocop/cop/rails/find_each.rb +23 -2
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +3 -2
- data/lib/rubocop/cop/rails/output.rb +4 -2
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +3 -2
- data/lib/rubocop/cop/rails/read_write_attribute.rb +5 -7
- data/lib/rubocop/cop/rails/scope_args.rb +3 -2
- data/lib/rubocop/cop/rails/time_zone.rb +14 -10
- data/lib/rubocop/cop/rails/validation.rb +4 -3
- data/lib/rubocop/cop/severity.rb +8 -7
- data/lib/rubocop/cop/style/access_modifier_indentation.rb +5 -4
- data/lib/rubocop/cop/style/accessor_method_name.rb +1 -0
- data/lib/rubocop/cop/style/alias.rb +84 -24
- data/lib/rubocop/cop/style/align_array.rb +2 -1
- data/lib/rubocop/cop/style/align_hash.rb +13 -14
- data/lib/rubocop/cop/style/align_parameters.rb +3 -2
- data/lib/rubocop/cop/style/and_or.rb +9 -7
- data/lib/rubocop/cop/style/array_join.rb +5 -5
- data/lib/rubocop/cop/style/ascii_comments.rb +2 -1
- data/lib/rubocop/cop/style/ascii_identifiers.rb +2 -1
- data/lib/rubocop/cop/style/attr.rb +30 -5
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +3 -3
- data/lib/rubocop/cop/style/bare_percent_literals.rb +2 -1
- data/lib/rubocop/cop/style/begin_block.rb +2 -1
- data/lib/rubocop/cop/style/block_comments.rb +2 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +10 -9
- data/lib/rubocop/cop/style/block_end_newline.rb +3 -2
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +9 -8
- data/lib/rubocop/cop/style/case_equality.rb +2 -1
- data/lib/rubocop/cop/style/case_indentation.rb +2 -1
- data/lib/rubocop/cop/style/character_literal.rb +11 -7
- data/lib/rubocop/cop/style/class_and_module_camel_case.rb +2 -1
- data/lib/rubocop/cop/style/class_and_module_children.rb +3 -2
- data/lib/rubocop/cop/style/class_check.rb +2 -1
- data/lib/rubocop/cop/style/class_methods.rb +2 -1
- data/lib/rubocop/cop/style/class_vars.rb +2 -1
- data/lib/rubocop/cop/style/closing_parenthesis_indentation.rb +3 -2
- data/lib/rubocop/cop/style/collection_methods.rb +2 -1
- data/lib/rubocop/cop/style/colon_method_call.rb +3 -2
- data/lib/rubocop/cop/style/command_literal.rb +8 -7
- data/lib/rubocop/cop/style/comment_annotation.rb +3 -2
- data/lib/rubocop/cop/style/comment_indentation.rb +4 -6
- data/lib/rubocop/cop/style/conditional_assignment.rb +362 -0
- data/lib/rubocop/cop/style/constant_name.rb +2 -1
- data/lib/rubocop/cop/style/copyright.rb +7 -6
- data/lib/rubocop/cop/style/def_with_parentheses.rb +2 -1
- data/lib/rubocop/cop/style/deprecated_hash_methods.rb +3 -2
- data/lib/rubocop/cop/style/documentation.rb +7 -11
- data/lib/rubocop/cop/style/dot_position.rb +3 -2
- data/lib/rubocop/cop/style/double_negation.rb +2 -1
- data/lib/rubocop/cop/style/each_with_object.rb +4 -3
- data/lib/rubocop/cop/style/else_alignment.rb +3 -2
- data/lib/rubocop/cop/style/empty_else.rb +4 -3
- data/lib/rubocop/cop/style/empty_line_between_defs.rb +2 -1
- data/lib/rubocop/cop/style/empty_lines.rb +10 -4
- data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +13 -5
- data/lib/rubocop/cop/style/empty_lines_around_block_body.rb +7 -3
- data/lib/rubocop/cop/style/empty_lines_around_class_body.rb +6 -3
- data/lib/rubocop/cop/style/empty_lines_around_method_body.rb +4 -3
- data/lib/rubocop/cop/style/empty_lines_around_module_body.rb +4 -2
- data/lib/rubocop/cop/style/empty_literal.rb +20 -5
- data/lib/rubocop/cop/style/encoding.rb +8 -11
- data/lib/rubocop/cop/style/end_block.rb +3 -1
- data/lib/rubocop/cop/style/end_of_line.rb +2 -1
- data/lib/rubocop/cop/style/even_odd.rb +4 -3
- data/lib/rubocop/cop/style/extra_spacing.rb +110 -74
- data/lib/rubocop/cop/style/file_name.rb +103 -6
- data/lib/rubocop/cop/style/first_array_element_line_break.rb +3 -2
- data/lib/rubocop/cop/style/first_hash_element_line_break.rb +5 -6
- data/lib/rubocop/cop/style/first_method_argument_line_break.rb +14 -1
- data/lib/rubocop/cop/style/first_method_parameter_line_break.rb +2 -1
- data/lib/rubocop/cop/style/first_parameter_indentation.rb +6 -4
- data/lib/rubocop/cop/style/flip_flop.rb +2 -1
- data/lib/rubocop/cop/style/for.rb +2 -1
- data/lib/rubocop/cop/style/format_string.rb +1 -0
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +89 -0
- data/lib/rubocop/cop/style/global_vars.rb +2 -1
- data/lib/rubocop/cop/style/guard_clause.rb +63 -11
- data/lib/rubocop/cop/style/hash_syntax.rb +10 -10
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +93 -0
- data/lib/rubocop/cop/style/if_inside_else.rb +49 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +6 -5
- data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -1
- data/lib/rubocop/cop/style/indent_array.rb +89 -38
- data/lib/rubocop/cop/style/indent_assignment.rb +43 -0
- data/lib/rubocop/cop/style/indent_hash.rb +16 -77
- data/lib/rubocop/cop/style/indentation_consistency.rb +2 -1
- data/lib/rubocop/cop/style/indentation_width.rb +11 -11
- data/lib/rubocop/cop/style/infinite_loop.rb +5 -9
- data/lib/rubocop/cop/style/initial_indentation.rb +2 -1
- data/lib/rubocop/cop/style/inline_comment.rb +2 -1
- data/lib/rubocop/cop/style/lambda.rb +14 -11
- data/lib/rubocop/cop/style/lambda_call.rb +4 -4
- data/lib/rubocop/cop/style/leading_comment_space.rb +2 -1
- data/lib/rubocop/cop/style/line_end_concatenation.rb +3 -1
- data/lib/rubocop/cop/style/method_call_parentheses.rb +9 -1
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -2
- data/lib/rubocop/cop/style/method_def_parentheses.rb +4 -4
- data/lib/rubocop/cop/style/method_name.rb +1 -0
- data/lib/rubocop/cop/style/missing_else.rb +5 -3
- data/lib/rubocop/cop/style/module_function.rb +2 -1
- data/lib/rubocop/cop/style/multiline_array_brace_layout.rb +95 -0
- data/lib/rubocop/cop/style/multiline_assignment_layout.rb +91 -0
- data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -2
- data/lib/rubocop/cop/style/multiline_block_layout.rb +11 -9
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -0
- data/lib/rubocop/cop/style/multiline_method_call_indentation.rb +137 -0
- data/lib/rubocop/cop/style/multiline_operation_indentation.rb +25 -135
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +2 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +4 -5
- data/lib/rubocop/cop/style/negated_if.rb +3 -3
- data/lib/rubocop/cop/style/negated_while.rb +3 -3
- data/lib/rubocop/cop/style/nested_modifier.rb +6 -5
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +48 -0
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +2 -1
- data/lib/rubocop/cop/style/next.rb +79 -15
- data/lib/rubocop/cop/style/nil_comparison.rb +5 -5
- data/lib/rubocop/cop/style/non_nil_check.rb +5 -5
- data/lib/rubocop/cop/style/not.rb +5 -9
- data/lib/rubocop/cop/style/numeric_literals.rb +5 -4
- data/lib/rubocop/cop/style/one_line_conditional.rb +3 -2
- data/lib/rubocop/cop/style/op_method.rb +7 -4
- data/lib/rubocop/cop/style/option_hash.rb +13 -7
- data/lib/rubocop/cop/style/optional_arguments.rb +3 -2
- data/lib/rubocop/cop/style/parallel_assignment.rb +40 -16
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +3 -16
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +3 -2
- data/lib/rubocop/cop/style/percent_q_literals.rb +3 -6
- data/lib/rubocop/cop/style/perl_backrefs.rb +4 -3
- data/lib/rubocop/cop/style/predicate_name.rb +1 -0
- data/lib/rubocop/cop/style/proc.rb +3 -2
- data/lib/rubocop/cop/style/raise_args.rb +2 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +2 -1
- data/lib/rubocop/cop/style/redundant_exception.rb +5 -5
- data/lib/rubocop/cop/style/redundant_freeze.rb +5 -4
- data/lib/rubocop/cop/style/redundant_parentheses.rb +80 -0
- data/lib/rubocop/cop/style/redundant_return.rb +5 -4
- data/lib/rubocop/cop/style/redundant_self.rb +7 -8
- data/lib/rubocop/cop/style/regexp_literal.rb +9 -8
- data/lib/rubocop/cop/style/rescue_ensure_alignment.rb +3 -2
- data/lib/rubocop/cop/style/rescue_modifier.rb +11 -9
- data/lib/rubocop/cop/style/self_assignment.rb +4 -5
- data/lib/rubocop/cop/style/semicolon.rb +3 -2
- data/lib/rubocop/cop/style/send.rb +3 -1
- data/lib/rubocop/cop/style/signal_exception.rb +5 -3
- data/lib/rubocop/cop/style/single_line_block_params.rb +2 -1
- data/lib/rubocop/cop/style/single_line_methods.rb +7 -7
- data/lib/rubocop/cop/style/space_after_colon.rb +2 -1
- data/lib/rubocop/cop/style/space_after_comma.rb +1 -0
- data/lib/rubocop/cop/style/space_after_control_keyword.rb +5 -5
- data/lib/rubocop/cop/style/space_after_method_name.rb +3 -2
- data/lib/rubocop/cop/style/space_after_not.rb +4 -3
- data/lib/rubocop/cop/style/space_after_semicolon.rb +1 -0
- data/lib/rubocop/cop/style/space_around_block_parameters.rb +8 -7
- data/lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb +1 -0
- data/lib/rubocop/cop/style/space_around_operators.rb +72 -32
- data/lib/rubocop/cop/style/space_before_block_braces.rb +2 -1
- data/lib/rubocop/cop/style/space_before_comma.rb +1 -0
- data/lib/rubocop/cop/style/space_before_comment.rb +2 -1
- data/lib/rubocop/cop/style/{single_space_before_first_arg.rb → space_before_first_arg.rb} +13 -4
- data/lib/rubocop/cop/style/space_before_modifier_keyword.rb +4 -3
- data/lib/rubocop/cop/style/space_before_semicolon.rb +1 -0
- data/lib/rubocop/cop/style/space_inside_block_braces.rb +3 -2
- data/lib/rubocop/cop/style/space_inside_brackets.rb +1 -0
- data/lib/rubocop/cop/style/space_inside_hash_literal_braces.rb +4 -1
- data/lib/rubocop/cop/style/space_inside_parens.rb +1 -0
- data/lib/rubocop/cop/style/space_inside_range_literal.rb +5 -4
- data/lib/rubocop/cop/style/space_inside_string_interpolation.rb +8 -17
- data/lib/rubocop/cop/style/special_global_vars.rb +97 -52
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +16 -9
- data/lib/rubocop/cop/style/string_literals.rb +41 -1
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +2 -1
- data/lib/rubocop/cop/style/string_methods.rb +2 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +3 -2
- data/lib/rubocop/cop/style/symbol_array.rb +74 -7
- data/lib/rubocop/cop/style/symbol_literal.rb +4 -7
- data/lib/rubocop/cop/style/symbol_proc.rb +11 -7
- data/lib/rubocop/cop/style/tab.rb +25 -2
- data/lib/rubocop/cop/style/trailing_blank_lines.rb +1 -2
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +45 -0
- data/lib/rubocop/cop/style/trailing_comma_in_literal.rb +56 -0
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +8 -7
- data/lib/rubocop/cop/style/trailing_whitespace.rb +2 -1
- data/lib/rubocop/cop/style/trivial_accessors.rb +18 -9
- data/lib/rubocop/cop/style/unless_else.rb +2 -1
- data/lib/rubocop/cop/style/unneeded_capital_w.rb +4 -3
- data/lib/rubocop/cop/style/unneeded_interpolation.rb +87 -0
- data/lib/rubocop/cop/style/unneeded_percent_q.rb +23 -7
- data/lib/rubocop/cop/style/variable_interpolation.rb +8 -6
- data/lib/rubocop/cop/style/variable_name.rb +1 -0
- data/lib/rubocop/cop/style/when_then.rb +2 -1
- data/lib/rubocop/cop/style/while_until_do.rb +3 -2
- data/lib/rubocop/cop/style/while_until_modifier.rb +3 -4
- data/lib/rubocop/cop/style/word_array.rb +74 -51
- data/lib/rubocop/cop/team.rb +21 -15
- data/lib/rubocop/cop/util.rb +102 -69
- data/lib/rubocop/cop/variable_force.rb +2 -1
- data/lib/rubocop/cop/variable_force/assignment.rb +2 -1
- data/lib/rubocop/cop/variable_force/locatable.rb +1 -0
- data/lib/rubocop/cop/variable_force/reference.rb +1 -0
- data/lib/rubocop/cop/variable_force/scope.rb +2 -1
- data/lib/rubocop/cop/variable_force/variable.rb +2 -1
- data/lib/rubocop/cop/variable_force/variable_table.rb +2 -1
- data/lib/rubocop/error.rb +12 -0
- data/lib/rubocop/formatter/base_formatter.rb +10 -1
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -0
- data/lib/rubocop/formatter/colorizable.rb +6 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +29 -15
- data/lib/rubocop/formatter/disabled_lines_formatter.rb +3 -1
- data/lib/rubocop/formatter/emacs_style_formatter.rb +7 -3
- data/lib/rubocop/formatter/file_list_formatter.rb +1 -0
- data/lib/rubocop/formatter/formatter_set.rb +10 -19
- data/lib/rubocop/formatter/fuubar_style_formatter.rb +2 -1
- data/lib/rubocop/formatter/html_formatter.rb +15 -14
- data/lib/rubocop/formatter/json_formatter.rb +2 -1
- data/lib/rubocop/formatter/offense_count_formatter.rb +1 -0
- data/lib/rubocop/formatter/progress_formatter.rb +3 -3
- data/lib/rubocop/formatter/simple_text_formatter.rb +50 -17
- data/lib/rubocop/formatter/text_util.rb +8 -10
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +61 -0
- data/lib/rubocop/name_similarity.rb +22 -0
- data/lib/rubocop/node_pattern.rb +126 -35
- data/lib/rubocop/options.rb +28 -19
- data/lib/rubocop/path_util.rb +1 -0
- data/lib/rubocop/processed_source.rb +41 -16
- data/lib/rubocop/rake_task.rb +6 -9
- data/lib/rubocop/remote_config.rb +1 -0
- data/lib/rubocop/result_cache.rb +60 -43
- data/lib/rubocop/runner.rb +48 -45
- data/lib/rubocop/string_util.rb +1 -0
- data/lib/rubocop/target_finder.rb +2 -1
- data/lib/rubocop/token.rb +1 -0
- data/lib/rubocop/version.rb +3 -2
- data/lib/rubocop/warning.rb +1 -0
- data/relnotes/v0.36.0.md +306 -0
- data/rubocop.gemspec +3 -9
- metadata +48 -92
- data/lib/rubocop/cop/lint/space_before_first_arg.rb +0 -44
- data/lib/rubocop/cop/rails/default_scope.rb +0 -33
- data/lib/rubocop/cop/style/trailing_comma.rb +0 -182
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ee7bc690a050b4fd220151fde459956af4e0ff4
|
4
|
+
data.tar.gz: cf8df365f2d78d2fd26508e7881b1128e307722e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e52b89d539e9e478473c0d7c57b472d93aca3378386940551d21be32171bf46cbb68fe26b4d6afbf09a0c38bbab5c1fef28b87ba8f63bc624ce80bd2527ca808
|
7
|
+
data.tar.gz: 70ee4133446158992efb7c971289e53b4d1ce894c845d3dc4c5f569d5726e67191cebe4be2b38e82927dd7849fdd8268e54c53b9db27248fbcd466409a3df4f2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,158 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.36.0 (14/01/2016)
|
6
|
+
|
7
|
+
### New features
|
8
|
+
|
9
|
+
* [#2598](https://github.com/bbatsov/rubocop/pull/2598): New cop `Lint/RandOne` checks for `rand(1)`, `Kernel.rand(1.0)` and similar calls. Such call are most likely a mistake because they always return `0`. ([@DNNX][])
|
10
|
+
* [#2590](https://github.com/bbatsov/rubocop/pull/2590): New cop `Performance/DoubleStartEndWith` checks for two `start_with?` (or `end_with?`) calls joined by `||` with the same receiver, like `str.start_with?('x') || str.start_with?('y')` and suggests using one call instead: `str.start_with?('x', 'y')`. ([@DNNX][])
|
11
|
+
* [#2583](https://github.com/bbatsov/rubocop/pull/2583): New cop `Performance/TimesMap` checks for `x.times.map{}` and suggests replacing them with `Array.new(x){}`. ([@DNNX][])
|
12
|
+
* [#2529](https://github.com/bbatsov/rubocop/pull/2529): Add EnforcedStyle config parameter to IndentArray. ([@jawshooah][])
|
13
|
+
* [#2479](https://github.com/bbatsov/rubocop/pull/2479): Add option `AllowHeredoc` to `Metrics/LineLength`. ([@fphilipe][])
|
14
|
+
* [#2416](https://github.com/bbatsov/rubocop/pull/2416): New cop `Style/ConditionalAssignment` checks for assignment of the same variable in all branches of conditionals and replaces them with a single assignment to the return of the conditional. ([@rrosenblum][])
|
15
|
+
* [#2410](https://github.com/bbatsov/rubocop/pull/2410): New cop `Style/IndentAssignment` checks the indentation of the first line of the right-hand-side of a multi-line assignment. ([@panthomakos][])
|
16
|
+
* [#2431](https://github.com/bbatsov/rubocop/issues/2431): Add `IgnoreExecutableScripts` option to `Style/FileName`. ([@sometimesfood][])
|
17
|
+
* [#2460](https://github.com/bbatsov/rubocop/pull/2460): New cop `Style/UnneededInterpolation` checks for strings that are just an interpolated expression. ([@cgriego][])
|
18
|
+
* [#2361](https://github.com/bbatsov/rubocop/pull/2361): `Style/MultilineAssignmentLayout` cop checks for a newline after the assignment operator in a multi-line assignment. ([@panthomakos][])
|
19
|
+
* [#2462](https://github.com/bbatsov/rubocop/issues/2462): `Lint/UselessAccessModifier` can catch more types of useless access modifiers. ([@alexdowad][])
|
20
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/Casecmp` cop. ([@alexdowad][])
|
21
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/RangeInclude` cop. ([@alexdowad][])
|
22
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/RedundantSortBy` cop. ([@alexdowad][])
|
23
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/LstripRstrip` cop. ([@alexdowad][])
|
24
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/StartWith` cop. ([@alexdowad][])
|
25
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/EndWith` cop. ([@alexdowad][])
|
26
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/RedundantMerge` cop. ([@alexdowad][])
|
27
|
+
* `Lint/Debugger` cop can now auto-correct offenses. ([@alexdowad][])
|
28
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/RedundantMatch` cop. ([@alexdowad][])
|
29
|
+
* [#1677](https://github.com/bbatsov/rubocop/issues/1677): Add new `Performance/RedundantBlockCall` cop. ([@alexdowad][])
|
30
|
+
* [#1954](https://github.com/bbatsov/rubocop/issues/1954): `Lint/UnneededDisable` can now autocorrect. ([@alexdowad][])
|
31
|
+
* [#2501](https://github.com/bbatsov/rubocop/issues/2501): Add new `Lint/ImplicitStringConcatenation` cop. ([@alexdowad][])
|
32
|
+
* Add new `Style/RedundantParentheses` cop. ([@lumeet][])
|
33
|
+
* [#1346](https://github.com/bbatsov/rubocop/issues/1346): `Style/SpecialGlobalVars` can be configured to use either `use_english_names` or `use_perl_names` styles. ([@alexdowad][])
|
34
|
+
* [#2426](https://github.com/bbatsov/rubocop/issues/2426): New `Style/NestedParenthesizedCalls` cop checks for non-parenthesized method calls nested inside a parenthesized call, like `method1(method2 arg)`. ([@alexdowad][])
|
35
|
+
* [#2502](https://github.com/bbatsov/rubocop/issues/2502): The `--stdin` and `--auto-correct` CLI options can be combined, and if you do so, corrected code is printed to stdout. ([@alexdowad][])
|
36
|
+
* `Style/ConditionalAssignment` works on conditionals with a common aref assignment (like `array[index] = val`) or attribute assignment (like `self.attribute = val`). ([@alexdowad][])
|
37
|
+
* [#2476](https://github.com/bbatsov/rubocop/issues/2476): `Style/GuardClause` catches if..else nodes with one branch which terminates the execution of the current scope. ([@alexdowad][])
|
38
|
+
* New `Style/IdenticalConditionalBranches` flags `if..else` and `case..when..else` constructs with an identical line at the end of each branch. ([@alexdowad][])
|
39
|
+
* [#207](https://github.com/bbatsov/rubocop/issues/207): Add new `Lint/FloatOutOfRange` cop which catches floating-point literals which are too large or too small for Ruby to represent. ([@alexdowad][])
|
40
|
+
* `Style/GuardClause` doesn't report offenses in places where correction would make a line too long. ([@alexdowad][])
|
41
|
+
* `Lint/DuplicateMethods` can find duplicate method definitions in many more circumstances, even across multiple files; however, it ignores definitions inside `if` or something which could be a DSL method. ([@alexdowad][])
|
42
|
+
* A warning is printed if an invalid `EnforcedStyle` is configured. ([@alexdowad][])
|
43
|
+
* [#1367](https://github.com/bbatsov/rubocop/issues/1367): New `Lint/IneffectiveAccessModifier` checks for access modifiers which are erroneously applied to a singleton method, where they have no effect. ([@alexdowad][])
|
44
|
+
* [#1614](https://github.com/bbatsov/rubocop/issues/1614): `Lint/BlockAlignment` aligns block end with splat operator when applied to a splatted method call. ([@alexdowad][])
|
45
|
+
* [#2263](https://github.com/bbatsov/rubocop/issues/2263): Warn if `task.options = %w(--format ...)` is used when configuring `RuboCop::RakeTask`; this should be `task.formatters = ...` instead. ([@alexdowad][])
|
46
|
+
* [#2511](https://github.com/bbatsov/rubocop/issues/2511): `--no-offense-counts` CLI option suppresses the inclusion of offense count lines in auto-generated config. ([@alexdowad][])
|
47
|
+
* [#2504](https://github.com/bbatsov/rubocop/issues/2504): New `AllowForAlignment` config parameter for `Style/SingleSpaceBeforeFirstArg` allows the insertion of extra spaces before the first argument if it aligns it with something on the preceding or following line. ([@alexdowad][])
|
48
|
+
* [#2478](https://github.com/bbatsov/rubocop/issues/2478): `Style/ExtraSpacing` has new `ForceEqualSignAlignment` config parameter which forces = signs on consecutive lines to be aligned, and it can auto-correct. ([@alexdowad][])
|
49
|
+
* `Lint/BlockAlignment` aligns block end with unary operators like ~, -, or ! when such operators are applied to the method call taking the block. ([@alexdowad][])
|
50
|
+
* [#1460](https://github.com/bbatsov/rubocop/issues/1460): `Style/Alias` supports both `prefer_alias` and `prefer_alias_method` styles. ([@alexdowad][])
|
51
|
+
* [#1569](https://github.com/bbatsov/rubocop/issues/1569): New `ExpectMatchingDefinition` config parameter for `Style/FileName` makes it check for a class or module definition in each file which corresponds to the file name and path. ([@alexdowad][])
|
52
|
+
* [#2480](https://github.com/bbatsov/rubocop/pull/2480): Add a configuration to `Style/ConditionalAssignment` to check and correct conditionals that contain multiple assignments. ([@rrosenblum][])
|
53
|
+
* [#2480](https://github.com/bbatsov/rubocop/pull/2480): Allow `Style/ConditionalAssignment` to correct assignment in ternary operations. ([@rrosenblum][])
|
54
|
+
* [#2480](https://github.com/bbatsov/rubocop/pull/2480): Allow `Style/ConditionalAssignment` to correct comparable methods. ([@rrosenblum][])
|
55
|
+
* [#1633](https://github.com/bbatsov/rubocop/issues/1633): New cop `Style/MultilineMethodCallIndentation` takes over the responsibility for checking alignment of methods from the `Style/MultilineOperationIndentation` cop. ([@jonas054][])
|
56
|
+
* [#2472](https://github.com/bbatsov/rubocop/pull/2472): New cop `Style/MultilineArrayBraceLayout` checks that the closing brace in an array literal is symmetrical with respect to the opening brace and the array elements. ([@panthomakos][])
|
57
|
+
* [#1543](https://github.com/bbatsov/rubocop/issues/1543): `Style/WordArray` has both `percent` and `brackets` (which enforces the use of bracketed arrays for strings) styles. ([@alexdowad][])
|
58
|
+
* `Style/SpaceAroundOperators` has `AllowForAlignment` config parameter which allows extra spaces on the left if they serve to align the operator with another. ([@alexdowad][])
|
59
|
+
* `Style/SymbolArray` has both `percent` and `brackets` (which enforces the user of bracketed arrays for symbols) styles. ([@alexdowad][])
|
60
|
+
* [#2343](https://github.com/bbatsov/rubocop/issues/2343): Entire cop types (or "departments") can be disabled using in .rubocop.yml using config like `Style: Enabled: false`. ([@alexdowad][])
|
61
|
+
* [#2399](https://github.com/bbatsov/rubocop/issues/2399): New `start_of_line` style for `Lint/EndAlignment` aligns a closing `end` keyword with the start of the line where the opening keyword appears. ([@alexdowad][])
|
62
|
+
* [#1545](https://github.com/bbatsov/rubocop/issues/1545): New `Regex` config parameter for `Style/FileName` allows user to provide their own regex for validating file names. ([@alexdowad][])
|
63
|
+
* [#2253](https://github.com/bbatsov/rubocop/issues/2253): New `DefaultFormatter` config parameter can be used to set formatter from within .rubocop.yml. ([@alexdowad][])
|
64
|
+
* [#2481](https://github.com/bbatsov/rubocop/issues/2481): New `WorstOffendersFormatter` prints a list of files with offenses (and offense counts), showing the files with the most offenses first. ([@alexdowad][])
|
65
|
+
* New `IfInsideElse` cop catches `if..end` nodes which can be converted into an `elsif` instead, reducing the nesting level. ([@alexdowad][])
|
66
|
+
* [#1725](https://github.com/bbatsov/rubocop/issues/1725): --color CLI option forces color output, even when not printing to a TTY. ([@alexdowad][])
|
67
|
+
* [#2549](https://github.com/bbatsov/rubocop/issues/2549): New `ConsistentQuotesInMultiline` config param for `Style/StringLiterals` forces all literals which are concatenated using \ to use the same quote style. ([@alexdowad][])
|
68
|
+
* [#2560](https://github.com/bbatsov/rubocop/issues/2560): `Style/AccessModifierIndentation`, `Style/CaseIndentation`, `Style/FirstParameterIndentation`, `Style/IndentArray`, `Style/IndentAssignment`, `Style/IndentHash`, `Style/MultilineMethodCallIndentation`, and `Style/MultilineOperationIndentation` all have a new `IndentationWidth` parameter which can be used to override the indentation width from `Style/IndentationWidth`. ([@alexdowad][])
|
69
|
+
* Add new `Performance/HashEachMethods` cop. ([@ojab][])
|
70
|
+
* New cop `Style/FrozenStringLiteralComment` will check for and add the comment `# frozen_string_literal: true` to the top of files. This will help with upgrading to Ruby 3.0. ([@rrosenblum][])
|
71
|
+
|
72
|
+
### Bug Fixes
|
73
|
+
|
74
|
+
* [#2594](https://github.com/bbatsov/rubocop/issues/2594): `Style/EmptyLiteral` autocorrector respects `Style/StringLiterals:EnforcedStyle` config. ([@DNNX][])
|
75
|
+
* [#2411](https://github.com/bbatsov/rubocop/issues/2411): Make local inherited configuration override configuration loaded from gems. ([@jonas054][])
|
76
|
+
* [#2413](https://github.com/bbatsov/rubocop/issues/2413): Allow `%Q` for dynamic strings with double quotes inside them. ([@jonas054][])
|
77
|
+
* [#2404](https://github.com/bbatsov/rubocop/issues/2404): `Style/Next` does not remove comments when auto-correcting. ([@lumeet][])
|
78
|
+
* `Style/Next` handles auto-correction of nested offenses. ([@lumeet][])
|
79
|
+
* `Style/VariableInterpolation` now detects non-numeric regex back references. ([@cgriego][])
|
80
|
+
* `ProgressFormatter` fully respects the `--no-color` switch. ([@savef][])
|
81
|
+
* Replace `Time.zone.current` with `Time.current` on `Rails::TimeZone` cop message. ([@volmer][])
|
82
|
+
* [#2451](https://github.com/bbatsov/rubocop/issues/2451): `Style/StabbyLambdaParentheses` does not treat method calls named `lambda` as lambdas. ([@domcleal][])
|
83
|
+
* [#2463](https://github.com/bbatsov/rubocop/issues/2463): Allow comments before an access modifier. ([@codebeige][])
|
84
|
+
* [#2471](https://github.com/bbatsov/rubocop/issues/2471): `Style/MethodName` doesn't choke on methods which are defined inside methods. ([@alexdowad][])
|
85
|
+
* [#2449](https://github.com/bbatsov/rubocop/issues/2449): `Style/StabbyLambdaParentheses` only checks lambdas in the arrow form. ([@lumeet][])
|
86
|
+
* [#2456](https://github.com/bbatsov/rubocop/issues/2456): `Lint/NestedMethodDefinition` doesn't register offenses for method definitions inside an eval block (either `instance_eval`, `class_eval`, or `module_eval`). ([@alexdowad][])
|
87
|
+
* [#2464](https://github.com/bbatsov/rubocop/issues/2464): `Style/ParallelAssignment` understands aref and attribute assignments, and doesn't warn if they can't be correctly rearranged into a series of single assignments. ([@alexdowad][])
|
88
|
+
* [#2482](https://github.com/bbatsov/rubocop/issues/2482): `Style/AndOr` doesn't raise an exception when trying to autocorrect `!variable or ...`. ([@alexdowad][])
|
89
|
+
* [#2446](https://github.com/bbatsov/rubocop/issues/2446): `Style/Tab` doesn't register errors for leading tabs which occur inside a string literal (including heredoc). ([@alexdowad][])
|
90
|
+
* [#2452](https://github.com/bbatsov/rubocop/issues/2452): `Style/TrailingComma` incorrectly categorizes single-line hashes in methods calls. ([@panthomakos][])
|
91
|
+
* [#2441](https://github.com/bbatsov/rubocop/issues/2441): `Style/AlignParameters` doesn't crash if it finds nested offenses. ([@alexdowad][])
|
92
|
+
* [#2436](https://github.com/bbatsov/rubocop/issues/2436): `Style/SpaceInsideHashLiteralBraces` doesn't mangle a hash literal which is not surrounded by curly braces, but has another hash literal which does as its first key. ([@alexdowad][])
|
93
|
+
* [#2483](https://github.com/bbatsov/rubocop/issues/2483): `Style/Attr` differentiate between attr_accessor and attr_reader. ([@weh][])
|
94
|
+
* `Style/ConditionalAssignment` doesn't crash if it finds a `case` with an empty branch. ([@lumeet][])
|
95
|
+
* [#2506](https://github.com/bbatsov/rubocop/issues/2506): `Lint/FormatParameterMismatch` understands %{} and %<> interpolations. ([@alexdowad][])
|
96
|
+
* [#2145](https://github.com/bbatsov/rubocop/issues/2145): `Lint/ParenthesesAsGroupedExpression` ignores calls with multiple arguments, since they are not ambiguous. ([@alexdowad][])
|
97
|
+
* [#2484](https://github.com/bbatsov/rubocop/issues/2484): Remove two vulnerabilities in cache handling. ([@jonas054][])
|
98
|
+
* [#2517](https://github.com/bbatsov/rubocop/issues/2517): `Lint/UselessAccessModifier` doesn't think that an access modifier applied to `attr_writer` is useless. ([@alexdowad][])
|
99
|
+
* [#2518](https://github.com/bbatsov/rubocop/issues/2518): `Style/ConditionalAssignment` doesn't think that branches using `<<` and `[]=` should be combined. ([@alexdowad][])
|
100
|
+
* `CharacterLiteral` auto-corrector now properly corrects `?'`. ([@bfontaine][])
|
101
|
+
* [#2313](https://github.com/bbatsov/rubocop/issues/2313): `Rails/FindEach` doesn't break code which uses `order(...).each`, `limit(...).each`, and so on. ([@alexdowad][])
|
102
|
+
* [#1938](https://github.com/bbatsov/rubocop/issues/1938): `Rails/FindBy` doesn't autocorrect `where(...).first` to `find_by`, since the returned record is often different. ([@alexdowad][])
|
103
|
+
* [#1801](https://github.com/bbatsov/rubocop/issues/1801): `EmacsFormatter` strips newlines out of error messages, if there are any. ([@alexdowad][])
|
104
|
+
* [#2534](https://github.com/bbatsov/rubocop/issues/2534): `Style/RescueEnsureAlignment` works on `rescue` nested inside a `class` or `module` block. ([@alexdowad][])
|
105
|
+
* `Lint/BlockAlignment` does not refer to a block terminator as `end` when it is actually `}`. ([@alexdowad][])
|
106
|
+
* [#2540](https://github.com/bbatsov/rubocop/issues/2540): `Lint/FormatParameterMismatch` understands format specifiers with multiple flags. ([@alexdowad][])
|
107
|
+
* [#2538](https://github.com/bbatsov/rubocop/issues/2538): `Style/SpaceAroundOperators` doesn't eat newlines. ([@alexdowad][])
|
108
|
+
* [#2531](https://github.com/bbatsov/rubocop/issues/2531): `Style/AndOr` autocorrects in cases where parentheses must be added, even inside a nested begin node. ([@alexdowad][])
|
109
|
+
* [#2450](https://github.com/bbatsov/rubocop/issues/2450): `Style/Next` adjusts indentation when auto-correcting, to avoid introducing new offenses. ([@alexdowad][])
|
110
|
+
* [#2066](https://github.com/bbatsov/rubocop/issues/2066): `Style/TrivialAccessors` doesn't flag what appear to be trivial accessor method definitions, if they are nested inside a call to `instance_eval`. ([@alexdowad][])
|
111
|
+
* `Style/SymbolArray` doesn't flag arrays of symbols if a symbol contains a space character. ([@alexdowad][])
|
112
|
+
* `Style/SymbolArray` can auto-correct offenses. ([@alexdowad][])
|
113
|
+
* [#2546](https://github.com/bbatsov/rubocop/issues/2546): Report when two `rubocop:disable` comments (not the single line kind) for a given cop apppear in a file with no `rubocop:enable` in between. ([@jonas054][])
|
114
|
+
* [#2552](https://github.com/bbatsov/rubocop/issues/2552): `Style/Encoding` can auto-correct files with a blank first line. ([@alexdowad][])
|
115
|
+
* [#2556](https://github.com/bbatsov/rubocop/issues/2556): `Style/SpecialGlobalVariables` generates auto-config correctly. ([@alexdowad][])
|
116
|
+
* [#2565](https://github.com/bbatsov/rubocop/issues/2565): Let `Style/SpaceAroundOperators` leave spacing around `=>` to `Style/AlignHash`. ([@jonas054][])
|
117
|
+
* [#2569](https://github.com/bbatsov/rubocop/issues/2569): `Style/MethodCallParentheses` doesn't register warnings for `object.()` syntax, since it is handled by `Style/LambdaCall`. ([@alexdowad][])
|
118
|
+
* [#2570](https://github.com/bbatsov/rubocop/issues/2570): `Performance/RedundantMerge` doesn't break code with a modifier `if` when autocorrecting. ([@alexdowad][])
|
119
|
+
* `Performance/RedundantMerge` doesn't break code with a modifier `while` or `until` when autocorrecting. ([@alexdowad][])
|
120
|
+
* [#2574](https://github.com/bbatsov/rubocop/issues/2574): `variable` style for `Lint/EndAlignment` is working again. ([@alexdowad][])
|
121
|
+
* `Lint/EndAlignment` can autocorrect offenses on the RHS of an assignment to an instance variable, class variable, constant, and so on; previously, it only worked if the LHS was a local variable. ([@alexdowad][])
|
122
|
+
* [#2580](https://github.com/bbatsov/rubocop/issues/2580): `Style/StringReplacement` doesn't break code when autocorrection involves a regex with embedded escapes (like /\n/). ([@alexdowad][])
|
123
|
+
* [#2582](https://github.com/bbatsov/rubocop/issues/2582): `Style/AlignHash` doesn't move a key so far left that it goes onto the previous line (in an attempt to align). ([@alexdowad][])
|
124
|
+
* [#2588](https://github.com/bbatsov/rubocop/issues/2588): `Style/SymbolProc` doesn't break code when autocorrecting a method call with a trailing comma in the argument list. ([@alexdowad][])
|
125
|
+
* [#2448](https://github.com/bbatsov/rubocop/issues/2448): `Style/TrailingCommaInArguments` and `Style/TrailingCommaInLiteral` don't special-case single-item lists in a way which contradicts the documentation. ([@alexdowad][])
|
126
|
+
* Fix for remote config files to only load from on http and https URLs. ([@ptrippett][])
|
127
|
+
* [#2604](https://github.com/bbatsov/rubocop/issues/2604): `Style/FileName` doesn't fail on empty files when `ExpectMatchingDefinition` is true. ([@alexdowad][])
|
128
|
+
* `Style/RedundantFreeze` registers offences for frozen dynamic symbols. ([@segiddins][])
|
129
|
+
* [#2609](https://github.com/bbatsov/rubocop/issues/2609): All cops which rely on the `AutocorrectUnlessChangingAST` module can now autocorrect files which contain `__FILE__`. ([@alexdowad][])
|
130
|
+
* [#2608](https://github.com/bbatsov/rubocop/issues/2608): `Style/ConditionalAssignment` can autocorrect `=~` within a ternary expression. ([@alexdowad][])
|
131
|
+
|
132
|
+
### Changes
|
133
|
+
|
134
|
+
* [#2427](https://github.com/bbatsov/rubocop/pull/2427): Allow non-snake-case file names (e.g. `some-random-script`) for Ruby scripts that have a shebang. ([@sometimesfood][])
|
135
|
+
* [#2430](https://github.com/bbatsov/rubocop/pull/2430): `Lint/UnneededDisable` now adds "unknown cop" to messages if cop names in `rubocop:disable` comments are unrecognized, or "did you mean ..." if they are misspelled names of existing cops. ([@jonas054][])
|
136
|
+
* [#947](https://github.com/bbatsov/rubocop/issues/947): `Style/Documentation` considers classes and modules which only define constants to be "namespaces", and doesn't flag them for lack of a documentation comment. ([@alexdowad][])
|
137
|
+
* [#2467](https://github.com/bbatsov/rubocop/issues/2467): Explicitly inheriting configuration from the rubocop gem in .rubocop.yml is not allowed. ([@alexdowad][])
|
138
|
+
* [#2322](https://github.com/bbatsov/rubocop/issues/2322): Output of --auto-gen-config shows content of default config parameters which are Arrays; this is especially useful for SupportedStyles. ([@alexdowad][])
|
139
|
+
* [#1566](https://github.com/bbatsov/rubocop/issues/1566): When autocorrecting on Windows, line endings are not converted to "\r\n" in untouched portions of the source files; corrected portions may use "\n" rather than "\r\n". ([@alexdowad][])
|
140
|
+
* New `rake repl` task can be used for experimentation when working on RuboCop. ([@alexdowad][])
|
141
|
+
* `Lint/SpaceBeforeFirstArg` cop has been removed, since it just duplicates `Style/SingleSpaceBeforeFirstArg`. ([@alexdowad][])
|
142
|
+
* `Style/SingleSpaceBeforeFirstArg` cop has been renamed to `Style/SpaceBeforeFirstArg`, which more accurately reflects what it now does. ([@alexdowad][])
|
143
|
+
* `Style/UnneededPercentQ` reports `%q()` strings with what only appears to be an escape, but is not really (there are no escapes in `%q()` strings). ([@alexdowad][])
|
144
|
+
* `Performance/StringReplacement`, `Performance\StartWith`, and `Performance\EndWith` more accurately identify code which can be improved. ([@alexdowad][])
|
145
|
+
* The `MultiSpaceAllowedForOperators` config parameter for `Style/SpaceAroundOperators` has been removed, as it is made redundant by `AllowForAlignment`. If someone attempts to use it, config validation will fail with a helpful message. ([@alexdowad][])
|
146
|
+
* The `RunRailsCops` config parameter in .rubocop.yml is now obsolete. If someone attempts to use it, config validation will fail with a helpful message. ([@alexdowad][])
|
147
|
+
* If .rubocop.yml contains configuration for a custom cop, no warning regarding "unknown cop" will be printed. The custom cop must inherit from RuboCop::Cop::Cop, and must be loaded into memory for this to work. ([@alexdowad][])
|
148
|
+
* [#2102](https://github.com/bbatsov/rubocop/issues/2102): If .rubocop.yml exists in the working directory when running --auto-gen-config, any `Exclude` config parameters in .rubocop.yml will be merged into the generated .rubocop_todo.yml. ([@alexdowad][])
|
149
|
+
* [#1895](https://github.com/bbatsov/rubocop/issues/1895): Remove `Rails/DefaultScope` cop. ([@alexdowad][])
|
150
|
+
* [#2550](https://github.com/bbatsov/rubocop/issues/2550): New `TargetRubyVersion` configuration parameter can be used to specify which version of the Ruby interpreter the inspected code is intended to run on. ([@alexdowad][])
|
151
|
+
* [#2557](https://github.com/bbatsov/rubocop/issues/2557): `Style/GuardClause` does not warn about `if` nodes whose condition spans multiple lines. ([@alexdowad][])
|
152
|
+
* `Style/EmptyLinesAroundClassBody`, `Style/EmptyLinesAroundModuleBody`, and `Style/EmptyLinesAroundBlockBody` accept an empty body with no blank line, even if configured to `empty_lines` style. This is because the empty lines only serve to provide a break between the header, body, and footer, and are redundant if there is no body. ([@alexdowad][])
|
153
|
+
* [#2554](https://github.com/bbatsov/rubocop/issues/2554): `Style/FirstMethodArgumentLineBreak` handles implicit hash arguments without braces; `Style/FirstHashElementLineBreak` still handles those with braces. ([@alexdowad][])
|
154
|
+
* `Style/TrailingComma` has been split into `Style/TrailingCommaInArguments` and `Style/TrailingCommaInLiteral`. ([@alexdowad][])
|
155
|
+
* RuboCop returns process exit code 2 if it fails due to bad configuration, bad CLI options, or an internal error. If it runs successfully but finds one or more offenses, it still exits with code 1, as was previously the case. This is helpful when invoking RuboCop programmatically, perhaps from a script. ([@alexdowad][])
|
156
|
+
|
5
157
|
## 0.35.1 (10/11/2015)
|
6
158
|
|
7
159
|
### Bug Fixes
|
@@ -41,6 +193,7 @@
|
|
41
193
|
* `Style/Documentation` recognizes 'Constant = Class.new' as a class definition. ([@alexdowad][])
|
42
194
|
* [#1608](https://github.com/bbatsov/rubocop/issues/1608): Add new 'align_braces' style for `Style/IndentHash`. ([@alexdowad][])
|
43
195
|
* `Style/Next` can autocorrect. ([@alexdowad][])
|
196
|
+
* [#2581](https://github.com/bbatsov/rubocop/pull/2581): New cop `Lint/NextWithoutAccumulator` finds bare `next` in `reduce`/`inject` blocks which assigns `nil` to the accumulator. ([@mvidner][])
|
44
197
|
|
45
198
|
### Bug Fixes
|
46
199
|
|
@@ -1715,3 +1868,14 @@
|
|
1715
1868
|
[@ptrippett]: https://github.com/ptrippett
|
1716
1869
|
[@br3nda]: https://github.com/br3nda
|
1717
1870
|
[@jujugrrr]: https://github.com/jujugrrr
|
1871
|
+
[@sometimesfood]: https://github.com/sometimesfood
|
1872
|
+
[@cgriego]: https://github.com/cgriego
|
1873
|
+
[@savef]: https://github.com/savef
|
1874
|
+
[@volmer]: https://github.com/volmer
|
1875
|
+
[@domcleal]: https://github.com/domcleal
|
1876
|
+
[@codebeige]: https://github.com/codebeige
|
1877
|
+
[@weh]: https://github.com/weh
|
1878
|
+
[@bfontaine]: https://github.com/bfontaine
|
1879
|
+
[@jawshooah]: https://github.com/jawshooah
|
1880
|
+
[@DNNX]: https://github.com/DNNX
|
1881
|
+
[@mvidner]: https://github.com/mvidner
|
data/LICENSE.txt
CHANGED
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
|
[![Build Status](https://travis-ci.org/bbatsov/rubocop.svg?branch=master)](https://travis-ci.org/bbatsov/rubocop)
|
4
|
-
[![Coverage Status](https://img.shields.io/
|
4
|
+
[![Coverage Status](https://img.shields.io/codeclimate/coverage/github/bbatsov/rubocop.svg)](https://codeclimate.com/github/bbatsov/rubocop)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/bbatsov/rubocop/badges/gpa.svg)](https://codeclimate.com/github/bbatsov/rubocop)
|
6
6
|
[![Inline docs](http://inch-ci.org/github/bbatsov/rubocop.svg)](http://inch-ci.org/github/bbatsov/rubocop)
|
7
7
|
|
@@ -48,6 +48,7 @@ specific RuboCop release.**
|
|
48
48
|
- [Defaults](#defaults)
|
49
49
|
- [Including/Excluding files](#includingexcluding-files)
|
50
50
|
- [Generic configuration parameters](#generic-configuration-parameters)
|
51
|
+
- [Setting the target Ruby version](#setting-the-target-ruby-version)
|
51
52
|
- [Automatically Generated Configuration](#automatically-generated-configuration)
|
52
53
|
- [Disabling Cops within Source Code](#disabling-cops-within-source-code)
|
53
54
|
- [Formatters](#formatters)
|
@@ -74,6 +75,7 @@ specific RuboCop release.**
|
|
74
75
|
- [Git pre-commit hook integration](#git-pre-commit-hook-integration)
|
75
76
|
- [Guard integration](#guard-integration)
|
76
77
|
- [Rake integration](#rake-integration)
|
78
|
+
- [Exit codes](#exit-codes)
|
77
79
|
- [Caching](#caching)
|
78
80
|
- [Cache Validity](#cache-validity)
|
79
81
|
- [Enabling and Disabling the Cache](#enabling-and-disabling-the-cache)
|
@@ -182,6 +184,7 @@ Command flag | Description
|
|
182
184
|
`--only` | Run only the specified cop(s) and/or cops in the specified departments.
|
183
185
|
`--except` | Run all cops enabled by configuration except the specified cop(s) and/or departments.
|
184
186
|
`--auto-gen-config` | Generate a configuration file acting as a TODO list.
|
187
|
+
`--no-offense-counts` | Don't show offense counts in config file generated by --auto-gen-config
|
185
188
|
`--exclude-limit` | Limit how many individual files `--auto-gen-config` can list in `Exclude` parameters, default is 15.
|
186
189
|
`--show-cops` | Shows available cops and their configuration.
|
187
190
|
`--fail-level` | Minimum [severity](#severity) for exit with error code. Full severity name or upper case initial can be given. Normally, auto-corrected offenses are ignored. Use `A` or `autocorrect` if you'd like them to trigger failure.
|
@@ -196,7 +199,7 @@ You can also load [custom cops](#custom-cops).
|
|
196
199
|
#### Style
|
197
200
|
|
198
201
|
Most of the cops in RuboCop are so called style cops that check for
|
199
|
-
|
202
|
+
stylistic problems in your code. Almost all of the them are based on
|
200
203
|
the Ruby Style Guide. Many of the style cops have configurations
|
201
204
|
options allowing them to support different popular coding
|
202
205
|
conventions.
|
@@ -225,6 +228,11 @@ configuration parameter called `Max` and when running
|
|
225
228
|
`rubocop --auto-gen-config`, this parameter will be set to the highest value
|
226
229
|
found for the inspected code.
|
227
230
|
|
231
|
+
#### Performance
|
232
|
+
|
233
|
+
Performance cops catch Ruby idioms which are known to be slower than another
|
234
|
+
equivalent (and equally readable) idiom.
|
235
|
+
|
228
236
|
#### Rails
|
229
237
|
|
230
238
|
Rails cops are specific to the Ruby on Rails framework. Unlike style
|
@@ -238,8 +246,8 @@ $ rubocop -R
|
|
238
246
|
or add the following directive to your `.rubocop.yml`:
|
239
247
|
|
240
248
|
```yaml
|
241
|
-
|
242
|
-
|
249
|
+
Rails:
|
250
|
+
Enabled: true
|
243
251
|
```
|
244
252
|
|
245
253
|
## Configuration
|
@@ -296,10 +304,16 @@ inherit_from:
|
|
296
304
|
|
297
305
|
The optional `inherit_from` directive can contain a full url to a remote
|
298
306
|
file. This makes it possible to have common project settings stored on a http
|
299
|
-
server and shared between many projects.
|
300
|
-
local files in the same config.
|
307
|
+
server and shared between many projects.
|
301
308
|
|
302
|
-
The
|
309
|
+
The remote config file is cached locally and is only updated if:
|
310
|
+
|
311
|
+
- The file does not exist.
|
312
|
+
- The file has not been updated in the last 24 hours.
|
313
|
+
- The remote copy has a newer modification time than the local copy.
|
314
|
+
|
315
|
+
You can inherit from both remote and local files in the same config and the
|
316
|
+
same inheritance rules apply to remote URLs and inheriting from local
|
303
317
|
files where the first file in the list has the lowest precedence and the
|
304
318
|
last one has the highest. The format for multiple inheritance using URLs is:
|
305
319
|
|
@@ -329,7 +343,6 @@ key and the relative path within the gem as the value:
|
|
329
343
|
|
330
344
|
```yaml
|
331
345
|
inherit_gem:
|
332
|
-
rubocop: config/default.yml
|
333
346
|
my-shared-gem: .rubocop.yml
|
334
347
|
cucumber: conf/rubocop.yml
|
335
348
|
```
|
@@ -406,7 +419,7 @@ paths match `app/models/*.rb`). All cops support the
|
|
406
419
|
`Include` param.
|
407
420
|
|
408
421
|
```yaml
|
409
|
-
Rails/
|
422
|
+
Rails/HasAndBelongsToMany:
|
410
423
|
Include:
|
411
424
|
- app/models/*.rb
|
412
425
|
```
|
@@ -416,7 +429,7 @@ instance you might want to run some cop only on a specific file). All cops suppo
|
|
416
429
|
`Exclude` param.
|
417
430
|
|
418
431
|
```yaml
|
419
|
-
Rails/
|
432
|
+
Rails/HasAndBelongsToMany:
|
420
433
|
Exclude:
|
421
434
|
- app/models/problematic.rb
|
422
435
|
```
|
@@ -461,7 +474,7 @@ Metrics/CyclomaticComplexity:
|
|
461
474
|
Severity: warning
|
462
475
|
```
|
463
476
|
|
464
|
-
|
477
|
+
#### Details
|
465
478
|
|
466
479
|
Individual cops can be embellished with extra details in offense messages:
|
467
480
|
|
@@ -485,6 +498,20 @@ Style/PerlBackrefs:
|
|
485
498
|
AutoCorrect: false
|
486
499
|
```
|
487
500
|
|
501
|
+
### Setting the target Ruby version
|
502
|
+
|
503
|
+
Some checks are dependent on the version of the Ruby interpreter which the
|
504
|
+
inspected code must run on. For example, using Ruby 2.0+ keyword arguments
|
505
|
+
rather than an options hash can help make your code shorter and more
|
506
|
+
expressive... _unless_ it must run on Ruby 1.9.
|
507
|
+
|
508
|
+
Let RuboCop know the oldest version of Ruby which your project supports with:
|
509
|
+
|
510
|
+
```yaml
|
511
|
+
AllCops:
|
512
|
+
TargetRubyVersion: 1.9
|
513
|
+
```
|
514
|
+
|
488
515
|
### Automatically Generated Configuration
|
489
516
|
|
490
517
|
If you have a code base with an overwhelming amount of offenses, it can
|
@@ -758,6 +785,19 @@ $ rubocop --format offenses
|
|
758
785
|
134 Total
|
759
786
|
```
|
760
787
|
|
788
|
+
### Worst Offenders Formatter
|
789
|
+
|
790
|
+
Similar to the Offense Count formatter, but lists the files which need the most attention:
|
791
|
+
|
792
|
+
```sh
|
793
|
+
$ rubocop --format worst
|
794
|
+
|
795
|
+
89 this/file/is/really/bad.rb
|
796
|
+
2 much/better.rb
|
797
|
+
--
|
798
|
+
91 Total
|
799
|
+
```
|
800
|
+
|
761
801
|
### HTML Formatter
|
762
802
|
|
763
803
|
Useful for CI environments. It will create an HTML report like [this](http://f.cl.ly/items/0M3029412x3O091a1X1R/expected.html).
|
@@ -774,6 +814,7 @@ RuboCop supports the following Ruby implementations:
|
|
774
814
|
* MRI 2.0
|
775
815
|
* MRI 2.1
|
776
816
|
* MRI 2.2
|
817
|
+
* MRI 2.3
|
777
818
|
* JRuby in 1.9 mode
|
778
819
|
* Rubinius 2.0+
|
779
820
|
|
@@ -816,11 +857,8 @@ Installation instructions can be found [here](https://github.com/mrdougal/textma
|
|
816
857
|
|
817
858
|
### Atom
|
818
859
|
|
819
|
-
The [
|
820
|
-
runs RuboCop and highlights the offenses in Atom.
|
821
|
-
|
822
|
-
You can also use the [linter-rubocop](https://github.com/AtomLinter/linter-rubocop)
|
823
|
-
plugin for Atom's [linter](https://github.com/atom-community/linter).
|
860
|
+
The [linter-rubocop](https://github.com/AtomLinter/linter-rubocop) plugin for Atom's
|
861
|
+
[linter](https://github.com/AtomLinter/Linter) runs RuboCop and highlights the offenses in Atom.
|
824
862
|
|
825
863
|
### LightTable
|
826
864
|
|
@@ -857,7 +895,6 @@ like
|
|
857
895
|
allows you to automatically check Ruby code style with RuboCop when
|
858
896
|
files are modified.
|
859
897
|
|
860
|
-
|
861
898
|
## Rake integration
|
862
899
|
|
863
900
|
To use RuboCop in your `Rakefile` add the following:
|
@@ -890,6 +927,18 @@ RuboCop::RakeTask.new(:rubocop) do |task|
|
|
890
927
|
end
|
891
928
|
```
|
892
929
|
|
930
|
+
## Exit codes
|
931
|
+
|
932
|
+
RuboCop exits with the following status codes:
|
933
|
+
|
934
|
+
- 0 if no offenses are found, or if the severity of all offenses are less than
|
935
|
+
`--fail-level`. (By default, if you use `--auto-correct`, offenses which are
|
936
|
+
auto-corrected do not cause RuboCop to fail.)
|
937
|
+
- 1 if one or more offenses equal or greater to `--fail-level` are found. (By
|
938
|
+
default, this is any offense which is not auto-corrected.)
|
939
|
+
- 2 if RuboCop terminates abnormally due to invalid configuration, invalid CLI
|
940
|
+
options, or an internal error.
|
941
|
+
|
893
942
|
## Caching
|
894
943
|
|
895
944
|
Large projects containing hundreds or even thousands of files can take
|
@@ -937,7 +986,7 @@ Each time a file has changed, its offenses will be stored under a new
|
|
937
986
|
key in the cache. This means that the cache will continue to grow
|
938
987
|
until we do something to stop it. The configuration parameter
|
939
988
|
`AllCops: MaxFilesInCache` sets a limit, and when the number of files
|
940
|
-
in the cache exceeds that limit, the oldest files will be
|
989
|
+
in the cache exceeds that limit, the oldest files will be automatically
|
941
990
|
removed from the cache.
|
942
991
|
|
943
992
|
## Extensions
|
@@ -969,12 +1018,14 @@ other cop.
|
|
969
1018
|
|
970
1019
|
* [rubocop-rspec](https://github.com/nevir/rubocop-rspec) -
|
971
1020
|
RSpec-specific analysis
|
1021
|
+
* [rubocop-cask](https://github.com/caskroom/rubocop-cask) - Analysis
|
1022
|
+
for Homebrew-Cask files.
|
972
1023
|
|
973
1024
|
### Custom Formatters
|
974
1025
|
|
975
1026
|
You can customize RuboCop's output format with custom formatters.
|
976
1027
|
|
977
|
-
#### Creating Custom Formatter
|
1028
|
+
#### Creating a Custom Formatter
|
978
1029
|
|
979
1030
|
To implement a custom formatter, you need to subclass
|
980
1031
|
`RuboCop::Formatter::BaseFormatter` and override some methods,
|
@@ -986,7 +1037,7 @@ Please see the documents below for more formatter API details.
|
|
986
1037
|
* [RuboCop::Cop::Offense](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Offense)
|
987
1038
|
* [Parser::Source::Range](http://www.rubydoc.info/github/whitequark/parser/Parser/Source/Range)
|
988
1039
|
|
989
|
-
#### Using Custom Formatter
|
1040
|
+
#### Using a Custom Formatter from the Command Line
|
990
1041
|
|
991
1042
|
You can tell RuboCop to use your custom formatter with a combination of
|
992
1043
|
`--format` and `--require` option.
|
@@ -1053,5 +1104,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
|
|
1053
1104
|
|
1054
1105
|
## Copyright
|
1055
1106
|
|
1056
|
-
Copyright (c) 2012-
|
1107
|
+
Copyright (c) 2012-2016 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
|
1057
1108
|
further details.
|
data/bin/rubocop
CHANGED
data/config/default.yml
CHANGED
@@ -27,9 +27,8 @@ AllCops:
|
|
27
27
|
- '**/Vagabondfile'
|
28
28
|
Exclude:
|
29
29
|
- 'vendor/**/*'
|
30
|
-
#
|
31
|
-
|
32
|
-
RunRailsCops: false
|
30
|
+
# Default formatter will be used if no -f/--format option is given.
|
31
|
+
DefaultFormatter: progress
|
33
32
|
# Cop names are not displayed in offense messages by default. Change behavior
|
34
33
|
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
35
34
|
# option.
|
@@ -39,7 +38,7 @@ AllCops:
|
|
39
38
|
# -S/--display-style-guide option.
|
40
39
|
DisplayStyleGuide: false
|
41
40
|
# Extra details are not displayed in offense messages by default. Change
|
42
|
-
#
|
41
|
+
# behavior by overriding ExtraDetails, or by giving the
|
43
42
|
# -E/--extra-details option.
|
44
43
|
ExtraDetails: false
|
45
44
|
# Additional cops that do not reference a style guide rule may be enabled by
|
@@ -64,6 +63,9 @@ AllCops:
|
|
64
63
|
# which is "/tmp" on Unix-like systems, but could be something else on other
|
65
64
|
# systems.
|
66
65
|
CacheRootDirectory: /tmp
|
66
|
+
# What version of the Ruby interpreter is the inspected code intended to
|
67
|
+
# run on? (If there is more than one, set this to the lowest version.)
|
68
|
+
TargetRubyVersion: 2.0
|
67
69
|
|
68
70
|
# Indent private/protected/public as deep as method definitions
|
69
71
|
Style/AccessModifierIndentation:
|
@@ -71,6 +73,15 @@ Style/AccessModifierIndentation:
|
|
71
73
|
SupportedStyles:
|
72
74
|
- outdent
|
73
75
|
- indent
|
76
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
77
|
+
# But it can be overridden by setting this parameter
|
78
|
+
IndentationWidth: ~
|
79
|
+
|
80
|
+
Style/Alias:
|
81
|
+
EnforcedStyle: prefer_alias
|
82
|
+
SupportedStyles:
|
83
|
+
- prefer_alias
|
84
|
+
- prefer_alias_method
|
74
85
|
|
75
86
|
# Align the elements of a hash literal if they span more than one line.
|
76
87
|
Style/AlignHash:
|
@@ -263,6 +274,10 @@ Style/CaseIndentation:
|
|
263
274
|
- case
|
264
275
|
- end
|
265
276
|
IndentOneStep: false
|
277
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
278
|
+
# But it can be overridden by setting this parameter
|
279
|
+
# This only matters if IndentOneStep is true
|
280
|
+
IndentationWidth: ~
|
266
281
|
|
267
282
|
Style/ClassAndModuleChildren:
|
268
283
|
# Checks the style of children definitions at classes and modules.
|
@@ -408,11 +423,27 @@ Style/ExtraSpacing:
|
|
408
423
|
# things with the previous or next line, not counting empty lines or comment
|
409
424
|
# lines.
|
410
425
|
AllowForAlignment: true
|
426
|
+
# When true, forces the alignment of = in assignments on consecutive lines.
|
427
|
+
ForceEqualSignAlignment: false
|
411
428
|
|
412
429
|
Style/FileName:
|
413
430
|
# File names listed in AllCops:Include are excluded by default. Add extra
|
414
431
|
# excludes here.
|
415
432
|
Exclude: []
|
433
|
+
# When true, requires that each source file should define a class or module
|
434
|
+
# with a name which matches the file name (converted to ... case).
|
435
|
+
# It further expects it to be nested inside modules which match the names
|
436
|
+
# of subdirectories in its path.
|
437
|
+
ExpectMatchingDefinition: false
|
438
|
+
# If non-nil, expect all source file names to match the following regex.
|
439
|
+
# Only the file name itself is matched, not the entire file path.
|
440
|
+
# Use anchors as necessary if you want to match the entire name rather than
|
441
|
+
# just a part of it.
|
442
|
+
Regex: ~
|
443
|
+
# With `IgnoreExecutableScripts` set to `true`, this cop does not
|
444
|
+
# report offending filenames for executable scripts (i.e. source
|
445
|
+
# files with a shebang in the first line).
|
446
|
+
IgnoreExecutableScripts: true
|
416
447
|
|
417
448
|
Style/FirstParameterIndentation:
|
418
449
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
@@ -428,6 +459,9 @@ Style/FirstParameterIndentation:
|
|
428
459
|
# Same as special_for_inner_method_call except that the special rule only
|
429
460
|
# applies if the outer method call encloses its arguments in parentheses.
|
430
461
|
- special_for_inner_method_call_in_parentheses
|
462
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
463
|
+
# But it can be overridden by setting this parameter
|
464
|
+
IndentationWidth: ~
|
431
465
|
|
432
466
|
# Checks use of for or each in multiline loops.
|
433
467
|
Style/For:
|
@@ -444,6 +478,19 @@ Style/FormatString:
|
|
444
478
|
- sprintf
|
445
479
|
- percent
|
446
480
|
|
481
|
+
Style/FrozenStringLiteralComment:
|
482
|
+
EnforcedStyle: when_needed
|
483
|
+
SupportedStyles:
|
484
|
+
# `when_needed` will add the frozen string literal comment to files that call
|
485
|
+
# `freeze` or `<<` on a string literal. It will only add the comment to files
|
486
|
+
# when running Ruby 2.3.0+.
|
487
|
+
- when_needed
|
488
|
+
# `always` will always add the frozen string literal comment to a file
|
489
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
490
|
+
# string literal. If you run code against multiple versions of Ruby, it is
|
491
|
+
# possible that this will create errors in Ruby 2.3.0+.
|
492
|
+
- always
|
493
|
+
|
447
494
|
# Built-in global variables are allowed by default.
|
448
495
|
Style/GlobalVars:
|
449
496
|
AllowedVariables: []
|
@@ -481,20 +528,55 @@ Style/IndentationWidth:
|
|
481
528
|
# Number of spaces for each indentation level.
|
482
529
|
Width: 2
|
483
530
|
|
531
|
+
# Checks the indentation of the first element in an array literal.
|
532
|
+
Style/IndentArray:
|
533
|
+
# The value `special_inside_parentheses` means that array literals with
|
534
|
+
# brackets that have their opening bracket on the same line as a surrounding
|
535
|
+
# opening round parenthesis, shall have their first element indented relative
|
536
|
+
# to the first position inside the parenthesis.
|
537
|
+
#
|
538
|
+
# The value `consistent` means that the indentation of the first element shall
|
539
|
+
# always be relative to the first position of the line where the opening
|
540
|
+
# bracket is.
|
541
|
+
#
|
542
|
+
# The value `align_brackets` means that the indentation of the first element
|
543
|
+
# shall always be relative to the position of the opening bracket.
|
544
|
+
EnforcedStyle: special_inside_parentheses
|
545
|
+
SupportedStyles:
|
546
|
+
- special_inside_parentheses
|
547
|
+
- consistent
|
548
|
+
- align_brackets
|
549
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
550
|
+
# But it can be overridden by setting this parameter
|
551
|
+
IndentationWidth: ~
|
552
|
+
|
553
|
+
# Checks the indentation of assignment RHS, when on a different line from LHS
|
554
|
+
Style/IndentAssignment:
|
555
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
556
|
+
# But it can be overridden by setting this parameter
|
557
|
+
IndentationWidth: ~
|
558
|
+
|
484
559
|
# Checks the indentation of the first key in a hash literal.
|
485
560
|
Style/IndentHash:
|
486
561
|
# The value `special_inside_parentheses` means that hash literals with braces
|
487
562
|
# that have their opening brace on the same line as a surrounding opening
|
488
563
|
# round parenthesis, shall have their first key indented relative to the
|
489
564
|
# first position inside the parenthesis.
|
565
|
+
#
|
490
566
|
# The value `consistent` means that the indentation of the first key shall
|
491
567
|
# always be relative to the first position of the line where the opening
|
492
568
|
# brace is.
|
569
|
+
#
|
570
|
+
# The value `align_braces` means that the indentation of the first key shall
|
571
|
+
# always be relative to the position of the opening brace.
|
493
572
|
EnforcedStyle: special_inside_parentheses
|
494
573
|
SupportedStyles:
|
495
574
|
- special_inside_parentheses
|
496
575
|
- consistent
|
497
576
|
- align_braces
|
577
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
578
|
+
# But it can be overridden by setting this parameter
|
579
|
+
IndentationWidth: ~
|
498
580
|
|
499
581
|
Style/LambdaCall:
|
500
582
|
EnforcedStyle: call
|
@@ -536,11 +618,41 @@ Style/MethodName:
|
|
536
618
|
- snake_case
|
537
619
|
- camelCase
|
538
620
|
|
621
|
+
Style/MultilineAssignmentLayout:
|
622
|
+
# The types of assignments which are subject to this rule.
|
623
|
+
SupportedTypes:
|
624
|
+
- block
|
625
|
+
- case
|
626
|
+
- class
|
627
|
+
- if
|
628
|
+
- kwbegin
|
629
|
+
- module
|
630
|
+
EnforcedStyle: new_line
|
631
|
+
SupportedStyles:
|
632
|
+
# Ensures that the assignment operator and the rhs are on the same line for
|
633
|
+
# the set of supported types.
|
634
|
+
- same_line
|
635
|
+
# Ensures that the assignment operator and the rhs are on separate lines
|
636
|
+
# for the set of supported types.
|
637
|
+
- new_line
|
638
|
+
|
639
|
+
Style/MultilineMethodCallIndentation:
|
640
|
+
EnforcedStyle: aligned
|
641
|
+
SupportedStyles:
|
642
|
+
- aligned
|
643
|
+
- indented
|
644
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
645
|
+
# But it can be overridden by setting this parameter
|
646
|
+
IndentationWidth: ~
|
647
|
+
|
539
648
|
Style/MultilineOperationIndentation:
|
540
649
|
EnforcedStyle: aligned
|
541
650
|
SupportedStyles:
|
542
651
|
- aligned
|
543
652
|
- indented
|
653
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
654
|
+
# But it can be overridden by setting this parameter
|
655
|
+
IndentationWidth: ~
|
544
656
|
|
545
657
|
Style/NumericLiterals:
|
546
658
|
MinDigits: 5
|
@@ -639,6 +751,18 @@ Style/SingleLineBlockParams:
|
|
639
751
|
Style/SingleLineMethods:
|
640
752
|
AllowIfMethodIsEmpty: true
|
641
753
|
|
754
|
+
Style/SpaceBeforeFirstArg:
|
755
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
756
|
+
# things with the previous or next line, not counting empty lines or comment
|
757
|
+
# lines.
|
758
|
+
AllowForAlignment: true
|
759
|
+
|
760
|
+
Style/SpecialGlobalVars:
|
761
|
+
EnforcedStyle: use_english_names
|
762
|
+
SupportedStyles:
|
763
|
+
- use_perl_names
|
764
|
+
- use_english_names
|
765
|
+
|
642
766
|
Style/StabbyLambdaParentheses:
|
643
767
|
EnforcedStyle: require_parentheses
|
644
768
|
SupportedStyles:
|
@@ -650,6 +774,9 @@ Style/StringLiterals:
|
|
650
774
|
SupportedStyles:
|
651
775
|
- single_quotes
|
652
776
|
- double_quotes
|
777
|
+
# If true, strings which span multiple lines using \ for continuation must
|
778
|
+
# use the same type of quotes on each line.
|
779
|
+
ConsistentQuotesInMultiline: false
|
653
780
|
|
654
781
|
Style/StringLiteralsInInterpolation:
|
655
782
|
EnforcedStyle: single_quotes
|
@@ -680,9 +807,10 @@ Style/SpaceAroundEqualsInParameterDefault:
|
|
680
807
|
- no_space
|
681
808
|
|
682
809
|
Style/SpaceAroundOperators:
|
683
|
-
|
684
|
-
|
685
|
-
|
810
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
811
|
+
# with an operator on the previous or next line, not counting empty lines
|
812
|
+
# or comment lines.
|
813
|
+
AllowForAlignment: true
|
686
814
|
|
687
815
|
Style/SpaceBeforeBlockBraces:
|
688
816
|
EnforcedStyle: space
|
@@ -713,6 +841,12 @@ Style/SpaceInsideStringInterpolation:
|
|
713
841
|
- space
|
714
842
|
- no_space
|
715
843
|
|
844
|
+
Style/SymbolArray:
|
845
|
+
EnforcedStyle: percent
|
846
|
+
SupportedStyles:
|
847
|
+
- percent
|
848
|
+
- brackets
|
849
|
+
|
716
850
|
Style/SymbolProc:
|
717
851
|
# A list of method names to be ignored by the check.
|
718
852
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
@@ -725,11 +859,22 @@ Style/TrailingBlankLines:
|
|
725
859
|
- final_newline
|
726
860
|
- final_blank_line
|
727
861
|
|
728
|
-
Style/
|
729
|
-
# If
|
730
|
-
#
|
731
|
-
# If
|
732
|
-
#
|
862
|
+
Style/TrailingCommaInArguments:
|
863
|
+
# If `comma`, the cop requires a comma after the last argument, but only for
|
864
|
+
# parenthesized method calls where each argument is on its own line.
|
865
|
+
# If `consistent_comma`, the cop requires a comma after the last argument,
|
866
|
+
# for all parenthesized method calls with arguments.
|
867
|
+
EnforcedStyleForMultiline: no_comma
|
868
|
+
SupportedStyles:
|
869
|
+
- comma
|
870
|
+
- consistent_comma
|
871
|
+
- no_comma
|
872
|
+
|
873
|
+
Style/TrailingCommaInLiteral:
|
874
|
+
# If `comma`, the cop requires a comma after the last item in an array or
|
875
|
+
# hash, but only when each item is on its own line.
|
876
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
877
|
+
# non-empty array and hash literals.
|
733
878
|
EnforcedStyleForMultiline: no_comma
|
734
879
|
SupportedStyles:
|
735
880
|
- comma
|
@@ -788,9 +933,13 @@ Style/WhileUntilModifier:
|
|
788
933
|
MaxLineLength: 80
|
789
934
|
|
790
935
|
Style/WordArray:
|
936
|
+
EnforcedStyle: percent
|
937
|
+
SupportedStyles:
|
938
|
+
- percent
|
939
|
+
- brackets
|
791
940
|
MinSize: 0
|
792
941
|
# The regular expression WordRegex decides what is considered a word.
|
793
|
-
WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
|
942
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
794
943
|
|
795
944
|
##################### Metrics ##################################
|
796
945
|
|
@@ -818,6 +967,7 @@ Metrics/LineLength:
|
|
818
967
|
Max: 80
|
819
968
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
820
969
|
# contaning a URI to be longer than Max.
|
970
|
+
AllowHeredoc: true
|
821
971
|
AllowURI: true
|
822
972
|
URISchemes:
|
823
973
|
- http
|
@@ -847,10 +997,13 @@ Lint/EndAlignment:
|
|
847
997
|
# The value `variable` means that in assignments, `end` should be aligned
|
848
998
|
# with the start of the variable on the left hand side of `=`. In all other
|
849
999
|
# situations, `end` should still be aligned with the keyword.
|
1000
|
+
# The value `start_of_line` means that `end` should be aligned with the start
|
1001
|
+
# of the line which the matching keyword appears on.
|
850
1002
|
AlignWith: keyword
|
851
1003
|
SupportedStyles:
|
852
1004
|
- keyword
|
853
1005
|
- variable
|
1006
|
+
- start_of_line
|
854
1007
|
AutoCorrect: false
|
855
1008
|
|
856
1009
|
Lint/DefEndAlignment:
|
@@ -868,7 +1021,7 @@ Lint/DefEndAlignment:
|
|
868
1021
|
Lint/UnusedBlockArgument:
|
869
1022
|
IgnoreEmptyBlocks: true
|
870
1023
|
|
871
|
-
# Checks for unused method arguments.
|
1024
|
+
# Checks for unused method arguments.
|
872
1025
|
Lint/UnusedMethodArgument:
|
873
1026
|
AllowUnusedKeywordArguments: false
|
874
1027
|
IgnoreEmptyMethods: true
|
@@ -894,10 +1047,6 @@ Rails/Date:
|
|
894
1047
|
- strict
|
895
1048
|
- flexible
|
896
1049
|
|
897
|
-
Rails/DefaultScope:
|
898
|
-
Include:
|
899
|
-
- app/models/**/*.rb
|
900
|
-
|
901
1050
|
Rails/FindBy:
|
902
1051
|
Include:
|
903
1052
|
- app/models/**/*.rb
|