rbhint 0.85.1.rc1 → 0.85.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/assets/output.html.erb +1 -1
- data/config/default.yml +13 -1
- data/lib/rbhint.rb +8 -0
- data/lib/rbhint/version.rb +1 -1
- data/lib/rubocop.rb +2 -0
- data/lib/rubocop/config.rb +1 -1
- data/lib/rubocop/config_loader_resolver.rb +1 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
- data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
- data/lib/rubocop/cop/layout/assignment_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/block_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/block_end_newline.rb +1 -1
- data/lib/rubocop/cop/layout/case_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/comment_indentation.rb +4 -4
- data/lib/rubocop/cop/layout/condition_position.rb +1 -1
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/dot_position.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_comment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +2 -0
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +1 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/end_of_line.rb +2 -2
- data/lib/rubocop/cop/layout/extra_spacing.rb +6 -6
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +2 -2
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/line_length.rb +6 -6
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/parameter_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +6 -6
- data/lib/rubocop/cop/layout/space_around_operators.rb +2 -2
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +14 -0
- data/lib/rubocop/cop/layout/space_before_comment.rb +1 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
- data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +6 -1
- data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
- data/lib/rubocop/cop/lint/raise_exception.rb +4 -4
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +4 -2
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +35 -3
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
- data/lib/rubocop/cop/mixin/configurable_naming.rb +1 -1
- data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -2
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +1 -1
- data/lib/rubocop/cop/mixin/regexp_literal_help.rb +27 -0
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +2 -2
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/file_name.rb +1 -3
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
- data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +2 -4
- data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
- data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
- data/lib/rubocop/cop/style/copyright.rb +3 -3
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
- data/lib/rubocop/cop/style/documentation.rb +2 -2
- data/lib/rubocop/cop/style/empty_case_condition.rb +8 -6
- data/lib/rubocop/cop/style/encoding.rb +1 -1
- data/lib/rubocop/cop/style/exponential_notation.rb +2 -2
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
- data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +17 -6
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +27 -0
- data/lib/rubocop/cop/style/next.rb +2 -2
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +2 -2
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/redundant_percent_q.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +14 -23
- data/lib/rubocop/cop/style/redundant_self.rb +6 -9
- data/lib/rubocop/cop/style/sample.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +1 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +21 -0
- data/lib/rubocop/cop/style/symbol_array.rb +5 -5
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/word_array.rb +1 -1
- data/lib/rubocop/cop/util.rb +2 -2
- data/lib/rubocop/cop/utils/format_string.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +1 -1
- data/lib/rubocop/name_similarity.rb +6 -0
- data/lib/rubocop/path_util.rb +2 -2
- data/lib/rubocop/platform.rb +1 -1
- data/lib/rubocop/rspec/expect_offense.rb +12 -2
- data/lib/rubocop/target_finder.rb +1 -1
- data/lib/rubocop/target_ruby.rb +1 -1
- metadata +10 -2
@@ -82,7 +82,7 @@ module RuboCop
|
|
82
82
|
|
83
83
|
def builtin_formatter_class(specified_key)
|
84
84
|
matching_keys = BUILTIN_FORMATTERS_FOR_KEYS.keys.select do |key|
|
85
|
-
|
85
|
+
/^\[#{specified_key}\]/.match?(key) || specified_key == key.delete('[]')
|
86
86
|
end
|
87
87
|
|
88
88
|
raise %(No formatter for "#{specified_key}") if matching_keys.empty?
|
@@ -12,6 +12,12 @@ module RuboCop
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def find_similar_names(target_name, names)
|
15
|
+
# DidYouMean::SpellChecker is not available in all versions of Ruby, and
|
16
|
+
# even on versions where it *is* available (>= 2.3), it is not always
|
17
|
+
# required correctly. So we do a feature check first.
|
18
|
+
# See: https://github.com/rubocop-hq/rubocop/issues/7979
|
19
|
+
return [] unless defined?(DidYouMean::SpellChecker)
|
20
|
+
|
15
21
|
names = names.dup
|
16
22
|
names.delete(target_name)
|
17
23
|
|
data/lib/rubocop/path_util.rb
CHANGED
@@ -40,7 +40,7 @@ module RuboCop
|
|
40
40
|
hidden_file_in_not_hidden_dir?(pattern, path)
|
41
41
|
when Regexp
|
42
42
|
begin
|
43
|
-
path
|
43
|
+
pattern.match?(path)
|
44
44
|
rescue ArgumentError => e
|
45
45
|
return false if e.message.start_with?('invalid byte sequence')
|
46
46
|
|
@@ -51,7 +51,7 @@ module RuboCop
|
|
51
51
|
|
52
52
|
# Returns true for an absolute Unix or Windows path.
|
53
53
|
def absolute?(path)
|
54
|
-
|
54
|
+
%r{\A([A-Z]:)?/}i.match?(path)
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.pwd
|
data/lib/rubocop/platform.rb
CHANGED
@@ -72,19 +72,29 @@ module RuboCop
|
|
72
72
|
#
|
73
73
|
# expect_no_corrections
|
74
74
|
#
|
75
|
-
# If your code has variables of different lengths, you can use `%{foo}
|
76
|
-
# and
|
75
|
+
# If your code has variables of different lengths, you can use `%{foo}`,
|
76
|
+
# `^{foo}`, and `_{foo}` to format your template:
|
77
77
|
#
|
78
78
|
# %w[raise fail].each do |keyword|
|
79
79
|
# expect_offense(<<~RUBY, keyword: keyword)
|
80
80
|
# %{keyword}(RuntimeError, msg)
|
81
81
|
# ^{keyword}^^^^^^^^^^^^^^^^^^^ Redundant `RuntimeError` argument can be removed.
|
82
82
|
# RUBY
|
83
|
+
#
|
84
|
+
# %w[has_one has_many].each do |type|
|
85
|
+
# expect_offense(<<~RUBY, type: type)
|
86
|
+
# class Book
|
87
|
+
# %{type} :chapter, foreign_key: 'book_id'
|
88
|
+
# _{type} ^^^^^^^^^^^^^^^^^^^^^^ Specifying the default value is redundant.
|
89
|
+
# end
|
90
|
+
# RUBY
|
91
|
+
# end
|
83
92
|
module ExpectOffense
|
84
93
|
def format_offense(source, **replacements)
|
85
94
|
replacements.each do |keyword, value|
|
86
95
|
source = source.gsub("%{#{keyword}}", value)
|
87
96
|
.gsub("^{#{keyword}}", '^' * value.size)
|
97
|
+
.gsub("_{#{keyword}}", ' ' * value.size)
|
88
98
|
end
|
89
99
|
source
|
90
100
|
end
|
@@ -139,7 +139,7 @@ module RuboCop
|
|
139
139
|
return false unless File.extname(file).empty? && File.exist?(file)
|
140
140
|
|
141
141
|
first_line = File.open(file, &:readline)
|
142
|
-
|
142
|
+
/#!.*(#{ruby_interpreters(file).join('|')})/.match?(first_line)
|
143
143
|
rescue EOFError, ArgumentError => e
|
144
144
|
warn("Unprocessable file #{file}: #{e.class}, #{e.message}") if debug?
|
145
145
|
|
data/lib/rubocop/target_ruby.rb
CHANGED
@@ -7,7 +7,7 @@ module RuboCop
|
|
7
7
|
DEFAULT_VERSION = KNOWN_RUBIES.first
|
8
8
|
|
9
9
|
OBSOLETE_RUBIES = {
|
10
|
-
1.9 => '0.
|
10
|
+
1.9 => '0.41', 2.0 => '0.50', 2.1 => '0.57', 2.2 => '0.68', 2.3 => '0.81'
|
11
11
|
}.freeze
|
12
12
|
private_constant :KNOWN_RUBIES, :OBSOLETE_RUBIES
|
13
13
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbhint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.85.1.
|
4
|
+
version: 0.85.1.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zee Spencer
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-06-
|
14
|
+
date: 2020-06-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: parallel
|
@@ -96,6 +96,9 @@ dependencies:
|
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: 0.0.3
|
99
|
+
- - "<"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.0'
|
99
102
|
type: :runtime
|
100
103
|
prerelease: false
|
101
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -103,6 +106,9 @@ dependencies:
|
|
103
106
|
- - ">="
|
104
107
|
- !ruby/object:Gem::Version
|
105
108
|
version: 0.0.3
|
109
|
+
- - "<"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.0'
|
106
112
|
- !ruby/object:Gem::Dependency
|
107
113
|
name: ruby-progressbar
|
108
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -335,6 +341,7 @@ files:
|
|
335
341
|
- lib/rubocop/cop/lint/big_decimal_new.rb
|
336
342
|
- lib/rubocop/cop/lint/boolean_symbol.rb
|
337
343
|
- lib/rubocop/cop/lint/circular_argument_reference.rb
|
344
|
+
- lib/rubocop/cop/lint/constant_resolution.rb
|
338
345
|
- lib/rubocop/cop/lint/debugger.rb
|
339
346
|
- lib/rubocop/cop/lint/deprecated_class_methods.rb
|
340
347
|
- lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb
|
@@ -424,6 +431,7 @@ files:
|
|
424
431
|
- lib/rubocop/cop/metrics/parameter_lists.rb
|
425
432
|
- lib/rubocop/cop/metrics/perceived_complexity.rb
|
426
433
|
- lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
|
434
|
+
- lib/rubocop/cop/metrics/utils/iterating_block.rb
|
427
435
|
- lib/rubocop/cop/migration/department_name.rb
|
428
436
|
- lib/rubocop/cop/mixin/alignment.rb
|
429
437
|
- lib/rubocop/cop/mixin/annotation_comment.rb
|