rubocop 0.26.1 → 0.27.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/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +10 -6
- data/.travis.yml +2 -0
- data/CHANGELOG.md +30 -0
- data/README.md +9 -2
- data/assets/logo.png +0 -0
- data/assets/output.html.erb +68 -65
- data/config/default.yml +42 -7
- data/config/disabled.yml +5 -0
- data/config/enabled.yml +32 -7
- data/lib/rubocop.rb +10 -2
- data/lib/rubocop/comment_config.rb +11 -17
- data/lib/rubocop/config.rb +20 -16
- data/lib/rubocop/config_loader.rb +8 -12
- data/lib/rubocop/cop/cop.rb +13 -12
- data/lib/rubocop/cop/lint/block_alignment.rb +4 -6
- data/lib/rubocop/cop/lint/def_end_alignment.rb +2 -2
- data/lib/rubocop/cop/lint/require_parentheses.rb +1 -1
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -3
- data/lib/rubocop/cop/lint/useless_setter_call.rb +2 -2
- data/lib/rubocop/cop/metrics/abc_size.rb +27 -0
- data/lib/rubocop/cop/metrics/block_nesting.rb +2 -4
- data/lib/rubocop/cop/metrics/class_length.rb +1 -1
- data/lib/rubocop/cop/metrics/line_length.rb +2 -5
- data/lib/rubocop/cop/metrics/method_length.rb +2 -2
- data/lib/rubocop/cop/mixin/autocorrect_alignment.rb +24 -15
- data/lib/rubocop/cop/mixin/autocorrect_unless_changing_ast.rb +15 -2
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +63 -0
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/if_node.rb +3 -1
- data/lib/rubocop/cop/mixin/method_complexity.rb +3 -3
- data/lib/rubocop/cop/mixin/{on_method.rb → on_method_def.rb} +3 -3
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +2 -2
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +2 -2
- data/lib/rubocop/cop/mixin/string_literals_help.rb +28 -0
- data/lib/rubocop/cop/rails/delegate.rb +2 -2
- data/lib/rubocop/cop/style/access_modifier_indentation.rb +2 -2
- data/lib/rubocop/cop/style/accessor_method_name.rb +2 -2
- data/lib/rubocop/cop/style/align_hash.rb +16 -12
- data/lib/rubocop/cop/style/align_parameters.rb +1 -1
- data/lib/rubocop/cop/style/and_or.rb +14 -6
- data/lib/rubocop/cop/style/array_join.rb +1 -1
- data/lib/rubocop/cop/style/block_comments.rb +16 -8
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +6 -30
- data/lib/rubocop/cop/style/case_indentation.rb +20 -12
- data/lib/rubocop/cop/style/collection_methods.rb +4 -4
- data/lib/rubocop/cop/style/colon_method_call.rb +9 -0
- data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
- data/lib/rubocop/cop/style/comment_indentation.rb +22 -22
- data/lib/rubocop/cop/style/def_with_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/deprecated_hash_methods.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +6 -1
- data/lib/rubocop/cop/style/else_alignment.rb +93 -0
- data/lib/rubocop/cop/style/empty_line_between_defs.rb +1 -1
- data/lib/rubocop/cop/style/empty_lines.rb +1 -1
- data/lib/rubocop/cop/style/empty_lines_around_class_body.rb +34 -0
- data/lib/rubocop/cop/style/empty_lines_around_method_body.rb +37 -0
- data/lib/rubocop/cop/style/empty_lines_around_module_body.rb +30 -0
- data/lib/rubocop/cop/style/encoding.rb +1 -1
- data/lib/rubocop/cop/style/format_string.rb +4 -4
- data/lib/rubocop/cop/style/indent_array.rb +2 -2
- data/lib/rubocop/cop/style/indent_hash.rb +17 -12
- data/lib/rubocop/cop/style/indentation_width.rb +27 -19
- data/lib/rubocop/cop/style/method_call_parentheses.rb +3 -3
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +1 -1
- data/lib/rubocop/cop/style/method_def_parentheses.rb +17 -11
- data/lib/rubocop/cop/style/method_name.rb +1 -1
- data/lib/rubocop/cop/style/multiline_operation_indentation.rb +174 -0
- data/lib/rubocop/cop/style/non_nil_check.rb +12 -15
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +12 -17
- data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
- data/lib/rubocop/cop/style/predicate_name.rb +2 -2
- data/lib/rubocop/cop/style/redundant_begin.rb +2 -2
- data/lib/rubocop/cop/style/redundant_return.rb +3 -3
- data/lib/rubocop/cop/style/redundant_self.rb +3 -3
- data/lib/rubocop/cop/style/regexp_literal.rb +17 -13
- data/lib/rubocop/cop/style/rescue_modifier.rb +2 -2
- data/lib/rubocop/cop/style/single_line_methods.rb +7 -4
- data/lib/rubocop/cop/style/space_after_method_name.rb +2 -2
- data/lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb +17 -11
- data/lib/rubocop/cop/style/space_before_block_braces.rb +1 -1
- data/lib/rubocop/cop/style/space_inside_block_braces.rb +17 -14
- data/lib/rubocop/cop/style/space_inside_hash_literal_braces.rb +10 -6
- data/lib/rubocop/cop/style/string_literals.rb +13 -16
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +41 -0
- data/lib/rubocop/cop/style/trailing_comma.rb +1 -3
- data/lib/rubocop/cop/style/trivial_accessors.rb +3 -3
- data/lib/rubocop/cop/style/unneeded_capital_w.rb +1 -1
- data/lib/rubocop/cop/style/unneeded_percent_q.rb +2 -2
- data/lib/rubocop/cop/style/word_array.rb +23 -19
- data/lib/rubocop/cop/team.rb +13 -26
- data/lib/rubocop/cop/util.rb +5 -0
- data/lib/rubocop/cop/variable_force/locatable.rb +7 -13
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +9 -1
- data/lib/rubocop/formatter/html_formatter.rb +83 -55
- data/lib/rubocop/formatter/simple_text_formatter.rb +2 -2
- data/lib/rubocop/formatter/text_util.rb +25 -0
- data/lib/rubocop/options.rb +14 -7
- data/lib/rubocop/path_util.rb +11 -7
- data/lib/rubocop/runner.rb +7 -2
- data/lib/rubocop/version.rb +1 -1
- data/relnotes/v0.27.0.md +77 -0
- data/rubocop.gemspec +1 -1
- data/spec/fixtures/html_formatter/expected.html +495 -0
- data/spec/fixtures/html_formatter/project/app/controllers/application_controller.rb +5 -0
- data/spec/fixtures/html_formatter/project/app/controllers/books_controller.rb +74 -0
- data/spec/fixtures/html_formatter/project/app/models/book.rb +5 -0
- data/spec/rubocop/cli_spec.rb +56 -13
- data/spec/rubocop/cop/lint/invalid_character_literal_spec.rb +1 -1
- data/spec/rubocop/cop/metrics/abc_size_spec.rb +99 -0
- data/spec/rubocop/cop/rails/action_filter_spec.rb +1 -0
- data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +23 -1
- data/spec/rubocop/cop/style/align_hash_spec.rb +13 -0
- data/spec/rubocop/cop/style/align_parameters_spec.rb +44 -33
- data/spec/rubocop/cop/style/blocks_spec.rb +8 -0
- data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +9 -9
- data/spec/rubocop/cop/style/case_indentation_spec.rb +3 -2
- data/spec/rubocop/cop/style/colon_method_call_spec.rb +5 -0
- data/spec/rubocop/cop/style/comment_indentation_spec.rb +6 -1
- data/spec/rubocop/cop/style/else_alignment_spec.rb +437 -0
- data/spec/rubocop/cop/style/empty_lines_around_class_body_spec.rb +75 -0
- data/spec/rubocop/cop/style/{empty_lines_around_body_spec.rb → empty_lines_around_method_body_spec.rb} +9 -50
- data/spec/rubocop/cop/style/empty_lines_around_module_body_spec.rb +79 -0
- data/spec/rubocop/cop/style/file_name_spec.rb +1 -1
- data/spec/rubocop/cop/style/format_string_spec.rb +12 -0
- data/spec/rubocop/cop/style/indent_array_spec.rb +6 -1
- data/spec/rubocop/cop/style/indent_hash_spec.rb +2 -1
- data/spec/rubocop/cop/style/indentation_width_spec.rb +765 -722
- data/spec/rubocop/cop/style/multiline_operation_indentation_spec.rb +414 -0
- data/spec/rubocop/cop/style/non_nil_check_spec.rb +86 -55
- data/spec/rubocop/cop/style/single_line_methods_spec.rb +5 -1
- data/spec/rubocop/cop/style/space_before_block_braces_spec.rb +2 -1
- data/spec/rubocop/cop/style/space_inside_block_braces_spec.rb +2 -1
- data/spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb +63 -0
- data/spec/rubocop/cop/style/string_literals_spec.rb +2 -2
- data/spec/rubocop/cop/style/word_array_spec.rb +15 -1
- data/spec/rubocop/formatter/base_formatter_spec.rb +1 -1
- data/spec/rubocop/formatter/disabled_lines_formatter_spec.rb +0 -1
- data/spec/rubocop/formatter/formatter_set_spec.rb +9 -0
- data/spec/rubocop/formatter/html_formatter_spec.rb +25 -122
- data/spec/rubocop/formatter/offense_count_formatter_spec.rb +0 -1
- data/spec/rubocop/runner_spec.rb +1 -1
- data/spec/spec_helper.rb +12 -130
- data/spec/support/cop_helper.rb +72 -0
- data/spec/support/coverage.rb +15 -0
- data/spec/support/{offenses_matcher.rb → custom_matchers.rb} +28 -0
- data/spec/support/jruby_workaround.rb +15 -0
- data/spec/support/{isolated_environment.rb → shared_contexts.rb} +19 -0
- metadata +49 -14
- data/lib/rubocop/cop/style/empty_lines_around_body.rb +0 -75
- data/spec/support/shared_context.rb +0 -20
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# `cop_config` must be declared with #let.
|
4
|
-
shared_context 'config', :config do
|
5
|
-
let(:config) do
|
6
|
-
# Module#<
|
7
|
-
unless described_class < RuboCop::Cop::Cop
|
8
|
-
fail '`config` must be used in `describe SomeCopClass do .. end`'
|
9
|
-
end
|
10
|
-
|
11
|
-
fail '`cop_config` must be declared with #let' unless cop_config.is_a?(Hash)
|
12
|
-
|
13
|
-
cop_name = described_class.cop_name
|
14
|
-
hash = {
|
15
|
-
cop_name =>
|
16
|
-
RuboCop::ConfigLoader.default_configuration[cop_name].merge(cop_config)
|
17
|
-
}
|
18
|
-
RuboCop::Config.new(hash, "#{Dir.pwd}/.rubocop.yml")
|
19
|
-
end
|
20
|
-
end
|