rubocop 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/assets/output.html.erb +1 -1
- data/bin/console +9 -0
- data/config/default.yml +23 -3
- data/config/disabled.yml +2 -2
- data/config/enabled.yml +29 -13
- data/{bin → exe}/rubocop +0 -0
- data/lib/rubocop.rb +6 -2
- data/lib/rubocop/ast/node.rb +3 -1
- data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +26 -5
- data/lib/rubocop/config_loader.rb +0 -1
- data/lib/rubocop/config_loader_resolver.rb +4 -2
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
- data/lib/rubocop/cop/generator.rb +1 -1
- data/lib/rubocop/cop/layout/class_structure.rb +1 -1
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +130 -0
- data/lib/rubocop/cop/layout/dot_position.rb +2 -6
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +0 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +2 -2
- data/lib/rubocop/cop/layout/indent_heredoc.rb +29 -5
- data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
- data/lib/rubocop/cop/layout/leading_blank_lines.rb +53 -0
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +11 -2
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
- data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +4 -3
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
- data/lib/rubocop/cop/mixin/array_syntax.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +3 -7
- data/lib/rubocop/cop/rails/assert_not.rb +1 -1
- data/lib/rubocop/cop/rails/bulk_change_table.rb +272 -0
- data/lib/rubocop/cop/rails/dynamic_find_by.rb +1 -1
- data/lib/rubocop/cop/rails/file_path.rb +40 -10
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +1 -1
- data/lib/rubocop/cop/rails/time_zone.rb +3 -3
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +111 -0
- data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
- data/lib/rubocop/cop/style/command_literal.rb +1 -5
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +30 -7
- data/lib/rubocop/cop/style/mixin_grouping.rb +8 -3
- data/lib/rubocop/cop/style/next.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +26 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
- data/lib/rubocop/cop/style/unneeded_condition.rb +73 -0
- data/lib/rubocop/cop/style/unneeded_percent_q.rb +13 -0
- data/lib/rubocop/cop/variable_force.rb +16 -17
- data/lib/rubocop/options.rb +15 -5
- data/lib/rubocop/result_cache.rb +3 -3
- data/lib/rubocop/string_util.rb +2 -147
- data/lib/rubocop/token.rb +2 -1
- data/lib/rubocop/version.rb +1 -1
- metadata +28 -9
- data/lib/rubocop/cop/lint/splat_keyword_arguments.rb +0 -36
data/lib/rubocop/token.rb
CHANGED
@@ -45,7 +45,8 @@ module RuboCop
|
|
45
45
|
|
46
46
|
# Checks if there is whitespace before token
|
47
47
|
def space_before?
|
48
|
-
|
48
|
+
position = begin_pos.zero? ? begin_pos : begin_pos - 1
|
49
|
+
pos.source_buffer.source.match(/\G\s/, position)
|
49
50
|
end
|
50
51
|
|
51
52
|
## Type Predicates
|
data/lib/rubocop/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module RuboCop
|
4
4
|
# This module holds the RuboCop version information.
|
5
5
|
module Version
|
6
|
-
STRING = '0.
|
6
|
+
STRING = '0.57.0'.freeze
|
7
7
|
|
8
8
|
MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
|
9
9
|
'%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'.freeze
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.57.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
8
8
|
- Jonas Arvidsson
|
9
9
|
- Yuji Nakayama
|
10
10
|
autorequire:
|
11
|
-
bindir:
|
11
|
+
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: jaro_winkler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.4.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 1.4.0
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: parallel
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,10 +171,11 @@ files:
|
|
157
171
|
- README.md
|
158
172
|
- assets/logo.png
|
159
173
|
- assets/output.html.erb
|
160
|
-
- bin/
|
174
|
+
- bin/console
|
161
175
|
- config/default.yml
|
162
176
|
- config/disabled.yml
|
163
177
|
- config/enabled.yml
|
178
|
+
- exe/rubocop
|
164
179
|
- lib/rubocop.rb
|
165
180
|
- lib/rubocop/ast/builder.rb
|
166
181
|
- lib/rubocop/ast/node.rb
|
@@ -247,6 +262,7 @@ files:
|
|
247
262
|
- lib/rubocop/cop/layout/block_end_newline.rb
|
248
263
|
- lib/rubocop/cop/layout/case_indentation.rb
|
249
264
|
- lib/rubocop/cop/layout/class_structure.rb
|
265
|
+
- lib/rubocop/cop/layout/closing_heredoc_indentation.rb
|
250
266
|
- lib/rubocop/cop/layout/closing_parenthesis_indentation.rb
|
251
267
|
- lib/rubocop/cop/layout/comment_indentation.rb
|
252
268
|
- lib/rubocop/cop/layout/condition_position.rb
|
@@ -281,6 +297,7 @@ files:
|
|
281
297
|
- lib/rubocop/cop/layout/indentation_consistency.rb
|
282
298
|
- lib/rubocop/cop/layout/indentation_width.rb
|
283
299
|
- lib/rubocop/cop/layout/initial_indentation.rb
|
300
|
+
- lib/rubocop/cop/layout/leading_blank_lines.rb
|
284
301
|
- lib/rubocop/cop/layout/leading_comment_space.rb
|
285
302
|
- lib/rubocop/cop/layout/multiline_array_brace_layout.rb
|
286
303
|
- lib/rubocop/cop/layout/multiline_assignment_layout.rb
|
@@ -374,7 +391,6 @@ files:
|
|
374
391
|
- lib/rubocop/cop/lint/shadowed_argument.rb
|
375
392
|
- lib/rubocop/cop/lint/shadowed_exception.rb
|
376
393
|
- lib/rubocop/cop/lint/shadowing_outer_local_variable.rb
|
377
|
-
- lib/rubocop/cop/lint/splat_keyword_arguments.rb
|
378
394
|
- lib/rubocop/cop/lint/string_conversion_in_interpolation.rb
|
379
395
|
- lib/rubocop/cop/lint/syntax.rb
|
380
396
|
- lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb
|
@@ -513,6 +529,7 @@ files:
|
|
513
529
|
- lib/rubocop/cop/rails/application_record.rb
|
514
530
|
- lib/rubocop/cop/rails/assert_not.rb
|
515
531
|
- lib/rubocop/cop/rails/blank.rb
|
532
|
+
- lib/rubocop/cop/rails/bulk_change_table.rb
|
516
533
|
- lib/rubocop/cop/rails/create_table_with_timestamps.rb
|
517
534
|
- lib/rubocop/cop/rails/date.rb
|
518
535
|
- lib/rubocop/cop/rails/delegate.rb
|
@@ -557,6 +574,7 @@ files:
|
|
557
574
|
- lib/rubocop/cop/security/open.rb
|
558
575
|
- lib/rubocop/cop/security/yaml_load.rb
|
559
576
|
- lib/rubocop/cop/severity.rb
|
577
|
+
- lib/rubocop/cop/style/access_modifier_declarations.rb
|
560
578
|
- lib/rubocop/cop/style/alias.rb
|
561
579
|
- lib/rubocop/cop/style/and_or.rb
|
562
580
|
- lib/rubocop/cop/style/array_join.rb
|
@@ -705,6 +723,7 @@ files:
|
|
705
723
|
- lib/rubocop/cop/style/trivial_accessors.rb
|
706
724
|
- lib/rubocop/cop/style/unless_else.rb
|
707
725
|
- lib/rubocop/cop/style/unneeded_capital_w.rb
|
726
|
+
- lib/rubocop/cop/style/unneeded_condition.rb
|
708
727
|
- lib/rubocop/cop/style/unneeded_interpolation.rb
|
709
728
|
- lib/rubocop/cop/style/unneeded_percent_q.rb
|
710
729
|
- lib/rubocop/cop/style/unpack_first.rb
|
@@ -769,15 +788,15 @@ files:
|
|
769
788
|
- lib/rubocop/token.rb
|
770
789
|
- lib/rubocop/version.rb
|
771
790
|
- lib/rubocop/warning.rb
|
772
|
-
homepage: https://github.com/
|
791
|
+
homepage: https://github.com/rubocop-hq/rubocop
|
773
792
|
licenses:
|
774
793
|
- MIT
|
775
794
|
metadata:
|
776
795
|
homepage_uri: https://rubocop.readthedocs.io/
|
777
|
-
changelog_uri: https://github.com/
|
778
|
-
source_code_uri: https://github.com/
|
796
|
+
changelog_uri: https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md
|
797
|
+
source_code_uri: https://github.com/rubocop-hq/rubocop/
|
779
798
|
documentation_uri: https://rubocop.readthedocs.io/
|
780
|
-
bug_tracker_uri: https://github.com/
|
799
|
+
bug_tracker_uri: https://github.com/rubocop-hq/rubocop/issues
|
781
800
|
post_install_message:
|
782
801
|
rdoc_options: []
|
783
802
|
require_paths:
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
module Lint
|
6
|
-
#
|
7
|
-
# This cop emulates the following Ruby warnings in Ruby 2.6.
|
8
|
-
#
|
9
|
-
# % ruby -we "def m(a) end; h = {foo: 1}; m(**h)"
|
10
|
-
# -e:1: warning: passing splat keyword arguments as a single Hash to `m'
|
11
|
-
#
|
12
|
-
# It checks for use of splat keyword arguments as a single Hash.
|
13
|
-
#
|
14
|
-
# @example
|
15
|
-
# # bad
|
16
|
-
# do_something(**arguments)
|
17
|
-
#
|
18
|
-
# # good
|
19
|
-
# do_something(arguments)
|
20
|
-
#
|
21
|
-
class SplatKeywordArguments < Cop
|
22
|
-
MSG = 'Do not use splat keyword arguments as a single Hash.'.freeze
|
23
|
-
|
24
|
-
def on_send(node)
|
25
|
-
node.arguments.each do |argument|
|
26
|
-
next unless argument.hash_type?
|
27
|
-
|
28
|
-
argument.children.each do |element|
|
29
|
-
add_offense(element) if element.kwsplat_type?
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|