rubocop 0.44.1 → 0.45.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/README.md +1 -1
- data/config/default.yml +12 -5
- data/config/enabled.yml +21 -1
- data/lib/rubocop.rb +5 -0
- data/lib/rubocop/cli.rb +1 -0
- data/lib/rubocop/config.rb +2 -2
- data/lib/rubocop/config_store.rb +4 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -0
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +49 -0
- data/lib/rubocop/cop/lint/empty_expression.rb +32 -0
- data/lib/rubocop/cop/lint/empty_interpolation.rb +6 -0
- data/lib/rubocop/cop/lint/empty_when.rb +40 -0
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +1 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +3 -4
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +3 -4
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/negative_conditional.rb +3 -0
- data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -0
- data/lib/rubocop/cop/mixin/too_many_lines.rb +15 -1
- data/lib/rubocop/cop/performance/case_when_splat.rb +3 -3
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +7 -4
- data/lib/rubocop/cop/rails/output_safety.rb +20 -6
- data/lib/rubocop/cop/rails/safe_navigation.rb +1 -1
- data/lib/rubocop/cop/rails/time_zone.rb +12 -1
- data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +6 -1
- data/lib/rubocop/cop/style/copyright.rb +8 -4
- data/lib/rubocop/cop/style/empty_else.rb +10 -6
- data/lib/rubocop/cop/style/extra_spacing.rb +2 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
- data/lib/rubocop/cop/style/indentation_width.rb +10 -5
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +73 -0
- data/lib/rubocop/cop/style/non_nil_check.rb +3 -1
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +2 -0
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +3 -2
- data/lib/rubocop/cop/style/redundant_self.rb +6 -1
- data/lib/rubocop/cop/style/safe_navigation.rb +2 -1
- data/lib/rubocop/cop/style/space_in_lambda_literal.rb +87 -0
- data/lib/rubocop/cop/style/space_inside_array_percent_literal.rb +5 -4
- data/lib/rubocop/cop/style/space_inside_percent_literal_delimiters.rb +7 -6
- data/lib/rubocop/options.rb +61 -57
- data/lib/rubocop/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe4f5525d5939f0396d7851e61030c00fd001da
|
4
|
+
data.tar.gz: 6c8a76124e3ac07618a2bbd69b7ca95619cb570b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b16cbb9b023e3d7757b0c7250951d83082924737fc3148ddc962efa3cfd1bcd1a1bb09881fbee457475e9325d0052a393e8d61abeeef1df6fb083761ad73a42e
|
7
|
+
data.tar.gz: c35d29e51547461c170a5b9e68a8a0448f8608e238d922642c61b82dfc94d75ae22f2a771a47d9ed038ad9c530bf1e331907922bdc284bb82a634fb0461a56e4
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
51
51
|
might want to use a conservative version locking in your `Gemfile`:
|
52
52
|
|
53
53
|
```rb
|
54
|
-
gem 'rubocop', '~> 0.
|
54
|
+
gem 'rubocop', '~> 0.45.0', require: false
|
55
55
|
```
|
56
56
|
|
57
57
|
## Quickstart
|
data/config/default.yml
CHANGED
@@ -80,7 +80,7 @@ AllCops:
|
|
80
80
|
# run on? (If there is more than one, set this to the lowest version.)
|
81
81
|
# If a value is specified for TargetRubyVersion then it is used.
|
82
82
|
# Else if .ruby-version exists and it contains an MRI version it is used.
|
83
|
-
# Otherwise we fallback to the oldest officially supported Ruby version (2.
|
83
|
+
# Otherwise we fallback to the oldest officially supported Ruby version (2.1).
|
84
84
|
TargetRubyVersion: ~
|
85
85
|
|
86
86
|
# Indent private/protected/public as deep as method definitions
|
@@ -629,6 +629,12 @@ Style/Lambda:
|
|
629
629
|
- lambda
|
630
630
|
- literal
|
631
631
|
|
632
|
+
Style/SpaceInLambdaLiteral:
|
633
|
+
EnforcedStyle: require_no_space
|
634
|
+
SupportedStyles:
|
635
|
+
- require_no_space
|
636
|
+
- require_space
|
637
|
+
|
632
638
|
Style/LambdaCall:
|
633
639
|
EnforcedStyle: call
|
634
640
|
SupportedStyles:
|
@@ -788,6 +794,7 @@ Style/PercentLiteralDelimiters:
|
|
788
794
|
PreferredDelimiters:
|
789
795
|
'%': ()
|
790
796
|
'%i': ()
|
797
|
+
'%I': ()
|
791
798
|
'%q': ()
|
792
799
|
'%Q': ()
|
793
800
|
'%r': '{}'
|
@@ -871,11 +878,11 @@ Style/SignalException:
|
|
871
878
|
Style/SingleLineBlockParams:
|
872
879
|
Methods:
|
873
880
|
- reduce:
|
874
|
-
-
|
875
|
-
-
|
881
|
+
- acc
|
882
|
+
- elem
|
876
883
|
- inject:
|
877
|
-
-
|
878
|
-
-
|
884
|
+
- acc
|
885
|
+
- elem
|
879
886
|
|
880
887
|
Style/SingleLineMethods:
|
881
888
|
AllowIfMethodIsEmpty: true
|
data/config/enabled.yml
CHANGED
@@ -379,6 +379,10 @@ Style/Lambda:
|
|
379
379
|
StyleGuide: '#lambda-multi-line'
|
380
380
|
Enabled: true
|
381
381
|
|
382
|
+
Style/SpaceInLambdaLiteral:
|
383
|
+
Description: 'Checks for spaces in lambda literals.'
|
384
|
+
Enabled: true
|
385
|
+
|
382
386
|
Style/LambdaCall:
|
383
387
|
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
384
388
|
StyleGuide: '#proc-call'
|
@@ -450,6 +454,11 @@ Style/MultilineIfThen:
|
|
450
454
|
StyleGuide: '#no-then'
|
451
455
|
Enabled: true
|
452
456
|
|
457
|
+
Style/MultilineIfModifier:
|
458
|
+
Description: 'Only use if/unless modifiers on single line statements.'
|
459
|
+
StyleGuide: '#no-multiline-if-modifiers'
|
460
|
+
Enabled: true
|
461
|
+
|
453
462
|
Style/MultilineMemoization:
|
454
463
|
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
|
455
464
|
Enabled: true
|
@@ -698,7 +707,6 @@ Style/SignalException:
|
|
698
707
|
|
699
708
|
Style/SingleLineBlockParams:
|
700
709
|
Description: 'Enforces the names of some block params.'
|
701
|
-
StyleGuide: '#reduce-blocks'
|
702
710
|
Enabled: true
|
703
711
|
|
704
712
|
Style/SingleLineMethods:
|
@@ -1058,6 +1066,10 @@ Lint/DeprecatedClassMethods:
|
|
1058
1066
|
Description: 'Check for deprecated class method calls.'
|
1059
1067
|
Enabled: true
|
1060
1068
|
|
1069
|
+
Lint/DuplicateCaseCondition:
|
1070
|
+
Description: 'Do not repeat values in case conditionals.'
|
1071
|
+
Enabled: true
|
1072
|
+
|
1061
1073
|
Lint/DuplicateMethods:
|
1062
1074
|
Description: 'Check for duplicate method definitions.'
|
1063
1075
|
Enabled: true
|
@@ -1078,10 +1090,18 @@ Lint/EmptyEnsure:
|
|
1078
1090
|
Description: 'Checks for empty ensure block.'
|
1079
1091
|
Enabled: true
|
1080
1092
|
|
1093
|
+
Lint/EmptyExpression:
|
1094
|
+
Description: 'Checks for empty expressions.'
|
1095
|
+
Enabled: true
|
1096
|
+
|
1081
1097
|
Lint/EmptyInterpolation:
|
1082
1098
|
Description: 'Checks for empty string interpolation.'
|
1083
1099
|
Enabled: true
|
1084
1100
|
|
1101
|
+
Lint/EmptyWhen:
|
1102
|
+
Description: 'Checks for `when` branches with empty bodies.'
|
1103
|
+
Enabled: true
|
1104
|
+
|
1085
1105
|
Lint/EndAlignment:
|
1086
1106
|
Description: 'Align ends correctly.'
|
1087
1107
|
Enabled: true
|
data/lib/rubocop.rb
CHANGED
@@ -100,12 +100,15 @@ require 'rubocop/cop/lint/condition_position'
|
|
100
100
|
require 'rubocop/cop/lint/debugger'
|
101
101
|
require 'rubocop/cop/lint/def_end_alignment'
|
102
102
|
require 'rubocop/cop/lint/deprecated_class_methods'
|
103
|
+
require 'rubocop/cop/lint/duplicate_case_condition'
|
103
104
|
require 'rubocop/cop/lint/duplicate_methods'
|
104
105
|
require 'rubocop/cop/lint/duplicated_key'
|
105
106
|
require 'rubocop/cop/lint/each_with_object_argument'
|
106
107
|
require 'rubocop/cop/lint/else_layout'
|
107
108
|
require 'rubocop/cop/lint/empty_ensure'
|
109
|
+
require 'rubocop/cop/lint/empty_expression'
|
108
110
|
require 'rubocop/cop/lint/empty_interpolation'
|
111
|
+
require 'rubocop/cop/lint/empty_when'
|
109
112
|
require 'rubocop/cop/lint/end_alignment'
|
110
113
|
require 'rubocop/cop/lint/end_in_method'
|
111
114
|
require 'rubocop/cop/lint/ensure_return'
|
@@ -284,6 +287,7 @@ require 'rubocop/cop/style/multiline_block_chain'
|
|
284
287
|
require 'rubocop/cop/style/multiline_block_layout'
|
285
288
|
require 'rubocop/cop/style/multiline_hash_brace_layout'
|
286
289
|
require 'rubocop/cop/style/multiline_if_then'
|
290
|
+
require 'rubocop/cop/style/multiline_if_modifier'
|
287
291
|
require 'rubocop/cop/style/multiline_memoization'
|
288
292
|
require 'rubocop/cop/style/multiline_method_call_brace_layout'
|
289
293
|
require 'rubocop/cop/style/multiline_method_call_indentation'
|
@@ -345,6 +349,7 @@ require 'rubocop/cop/style/space_before_comma'
|
|
345
349
|
require 'rubocop/cop/style/space_before_comment'
|
346
350
|
require 'rubocop/cop/style/space_before_first_arg'
|
347
351
|
require 'rubocop/cop/style/space_before_semicolon'
|
352
|
+
require 'rubocop/cop/style/space_in_lambda_literal'
|
348
353
|
require 'rubocop/cop/style/space_inside_array_percent_literal'
|
349
354
|
require 'rubocop/cop/style/space_inside_block_braces'
|
350
355
|
require 'rubocop/cop/style/space_inside_brackets'
|
data/lib/rubocop/cli.rb
CHANGED
@@ -54,6 +54,7 @@ module RuboCop
|
|
54
54
|
ConfigLoader.auto_gen_config = @options[:auto_gen_config]
|
55
55
|
|
56
56
|
@config_store.options_config = @options[:config] if @options[:config]
|
57
|
+
@config_store.force_default_config! if @options[:force_default_config]
|
57
58
|
|
58
59
|
if @options[:color]
|
59
60
|
# color output explicitly forced on
|
data/lib/rubocop/config.rb
CHANGED
@@ -15,8 +15,8 @@ module RuboCop
|
|
15
15
|
|
16
16
|
COMMON_PARAMS = %w(Exclude Include Severity
|
17
17
|
AutoCorrect StyleGuide Details).freeze
|
18
|
-
# 2.
|
19
|
-
DEFAULT_RUBY_VERSION = 2.
|
18
|
+
# 2.1 is the oldest officially supported Ruby version.
|
19
|
+
DEFAULT_RUBY_VERSION = 2.1
|
20
20
|
KNOWN_RUBIES = [1.9, 2.0, 2.1, 2.2, 2.3, 2.4].freeze
|
21
21
|
OBSOLETE_COPS = {
|
22
22
|
'Style/TrailingComma' =>
|
data/lib/rubocop/config_store.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
# This cop checks that there are no repeated conditions
|
7
|
+
# used in case 'when' expressions.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
#
|
11
|
+
# # bad
|
12
|
+
# case x
|
13
|
+
# when 'first'
|
14
|
+
# do_something
|
15
|
+
# when 'first'
|
16
|
+
# do_something_else
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
class DuplicateCaseCondition < Cop
|
20
|
+
MSG = 'Duplicate `when` condition detected.'.freeze
|
21
|
+
|
22
|
+
def on_case(case_node)
|
23
|
+
_condition, *whens, _else = *case_node
|
24
|
+
conditions_seen = []
|
25
|
+
|
26
|
+
whens.each do |when_node|
|
27
|
+
conditions = when_conditions(when_node)
|
28
|
+
conditions.each do |cond|
|
29
|
+
if repeated_condition?(conditions_seen, cond)
|
30
|
+
add_offense(case_node, cond.loc.expression, MSG)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
conditions_seen.push(conditions)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def when_conditions(when_node)
|
40
|
+
when_node.to_a[0...-1]
|
41
|
+
end
|
42
|
+
|
43
|
+
def repeated_condition?(conditions_seen, condition)
|
44
|
+
conditions_seen.any? { |x| x.include?(condition) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
# This cop checks for the presence of empty expressions.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
#
|
10
|
+
# @bad
|
11
|
+
# foo = ()
|
12
|
+
# if ()
|
13
|
+
# bar
|
14
|
+
# end
|
15
|
+
class EmptyExpression < Cop
|
16
|
+
MSG = 'Avoid empty expressions.'.freeze
|
17
|
+
|
18
|
+
def on_begin(node)
|
19
|
+
return unless empty_expression?(node)
|
20
|
+
|
21
|
+
add_offense(node, node.source_range, MSG)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def empty_expression?(begin_node)
|
27
|
+
begin_node.children.empty?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
# This cop checks for the presence of `when` branches without a body.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
#
|
10
|
+
# @bad
|
11
|
+
# case foo
|
12
|
+
# when bar then 1
|
13
|
+
# when baz then # nothing
|
14
|
+
# end
|
15
|
+
class EmptyWhen < Cop
|
16
|
+
MSG = 'Avoid `when` branches without a body.'.freeze
|
17
|
+
|
18
|
+
def on_case(node)
|
19
|
+
_cond_node, *when_nodes, _else_node = *node
|
20
|
+
|
21
|
+
when_nodes.each do |when_node|
|
22
|
+
check_when(when_node)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def check_when(when_node)
|
29
|
+
return unless empty_when_body?(when_node)
|
30
|
+
|
31
|
+
add_offense(when_node, when_node.source_range, MSG)
|
32
|
+
end
|
33
|
+
|
34
|
+
def empty_when_body?(when_node)
|
35
|
+
!when_node.to_a.last
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -7,8 +7,7 @@ module RuboCop
|
|
7
7
|
# less specific exception being rescued before a more specific
|
8
8
|
# exception is rescued.
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# @example
|
12
11
|
# # bad
|
13
12
|
# begin
|
14
13
|
# something
|
@@ -85,8 +84,8 @@ module RuboCop
|
|
85
84
|
rescued_exceptions = rescued_exceptions(rescue_group)
|
86
85
|
rescued_exceptions.each_with_object([]) do |exception, converted|
|
87
86
|
begin
|
88
|
-
converted <<
|
89
|
-
rescue
|
87
|
+
converted << Kernel.const_get(exception)
|
88
|
+
rescue NameError
|
90
89
|
converted << nil
|
91
90
|
end
|
92
91
|
end
|
@@ -7,10 +7,9 @@ module RuboCop
|
|
7
7
|
module ConfigurableNumbering
|
8
8
|
include ConfigurableEnforcedStyle
|
9
9
|
|
10
|
-
SNAKE_CASE =
|
11
|
-
NORMAL_CASE =
|
12
|
-
|
13
|
-
NON_INTEGER = /^@{0,2}[-_a-z]+[_\D]*[!?=]?$/
|
10
|
+
SNAKE_CASE = /(^_|[a-z]|_\d+)$/
|
11
|
+
NORMAL_CASE = /(^_|[A-Za-z]\d*)$/
|
12
|
+
NON_INTEGER = /(^_|[A-Za-z])$/
|
14
13
|
|
15
14
|
def check_name(node, name, name_range)
|
16
15
|
return if operator?(name)
|
@@ -125,7 +125,7 @@ module RuboCop
|
|
125
125
|
def part_of_assignment_rhs(node, candidate)
|
126
126
|
node.each_ancestor.find do |a|
|
127
127
|
case a.type
|
128
|
-
when :if, :while, :until, :for, :return, :array
|
128
|
+
when :if, :while, :until, :for, :return, :array, :kwbegin
|
129
129
|
break # other kinds of alignment
|
130
130
|
when :block
|
131
131
|
break if part_of_block_body?(candidate, a)
|
@@ -9,10 +9,13 @@ module RuboCop
|
|
9
9
|
include IfNode
|
10
10
|
|
11
11
|
def_node_matcher :single_negative?, '(send !(send _ :!) :!)'
|
12
|
+
def_node_matcher :empty_condition?, '(begin)'
|
12
13
|
|
13
14
|
def check_negative_conditional(node)
|
14
15
|
condition, _body, _rest = *node
|
15
16
|
|
17
|
+
return if empty_condition?(condition)
|
18
|
+
|
16
19
|
# Look at last expression of contents if there are parentheses
|
17
20
|
# around condition.
|
18
21
|
condition = condition.children.last while condition.begin_type?
|
@@ -16,10 +16,24 @@ module RuboCop
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def code_length(node)
|
19
|
-
|
19
|
+
body = extract_body(node)
|
20
|
+
lines = body && body.source.lines || []
|
20
21
|
|
21
22
|
lines.count { |line| !irrelevant_line(line) }
|
22
23
|
end
|
24
|
+
|
25
|
+
def extract_body(node)
|
26
|
+
case node.type
|
27
|
+
when :block, :def
|
28
|
+
_receiver_or_method, _args, body = *node
|
29
|
+
when :defs
|
30
|
+
_self, _method, _args, body = *node
|
31
|
+
else
|
32
|
+
body = node
|
33
|
+
end
|
34
|
+
|
35
|
+
body
|
36
|
+
end
|
23
37
|
end
|
24
38
|
end
|
25
39
|
end
|
@@ -65,9 +65,9 @@ module RuboCop
|
|
65
65
|
_case_branch, *when_branches, _else_branch = *node
|
66
66
|
when_conditions =
|
67
67
|
when_branches.each_with_object([]) do |branch, conditions|
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
*condition, _ = *branch
|
69
|
+
condition.each { |c| conditions << c }
|
70
|
+
end
|
71
71
|
|
72
72
|
splat_offenses(when_conditions).reverse_each do |condition|
|
73
73
|
range = condition.parent.loc.keyword.join(condition.source_range)
|
@@ -16,7 +16,10 @@ module RuboCop
|
|
16
16
|
class HttpPositionalArguments < Cop
|
17
17
|
MSG = 'Use keyword arguments instead of ' \
|
18
18
|
'positional arguments for http call: `%s`.'.freeze
|
19
|
-
KEYWORD_ARGS = [
|
19
|
+
KEYWORD_ARGS = [
|
20
|
+
:headers, :env, :params, :body, :flash, :as,
|
21
|
+
:xhr, :session, :method
|
22
|
+
].freeze
|
20
23
|
HTTP_METHODS = [:get, :post, :put, :patch, :delete, :head].freeze
|
21
24
|
|
22
25
|
def on_send(node)
|
@@ -51,12 +54,12 @@ module RuboCop
|
|
51
54
|
def convert_hash_data(data, type)
|
52
55
|
# empty hash or no hash return empty string
|
53
56
|
return '' if data.nil? || data.children.count < 1
|
54
|
-
hash_data = if data.
|
57
|
+
hash_data = if data.hash_type?
|
58
|
+
format('{ %s }', data.children.map(&:source).join(', '))
|
59
|
+
else
|
55
60
|
# user supplies an object,
|
56
61
|
# no need to surround with braces
|
57
62
|
data.source
|
58
|
-
else
|
59
|
-
format('{ %s }', data.children.map(&:source).join(', '))
|
60
63
|
end
|
61
64
|
format(', %s: %s', type, hash_data)
|
62
65
|
end
|
@@ -30,13 +30,27 @@ module RuboCop
|
|
30
30
|
'prefer `safe_join` or other Rails tag helpers instead.'.freeze
|
31
31
|
|
32
32
|
def on_send(node)
|
33
|
-
|
33
|
+
_receiver, method_name, *_args = *node
|
34
|
+
ignore_node(node) if method_name == :safe_join
|
35
|
+
return unless !part_of_ignored_node?(node) &&
|
36
|
+
(looks_like_rails_html_safe?(node) ||
|
37
|
+
looks_like_rails_raw?(node))
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
add_offense(node, :selector)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def looks_like_rails_html_safe?(node)
|
45
|
+
receiver, method_name, *args = *node
|
46
|
+
|
47
|
+
receiver && method_name == :html_safe && args.empty?
|
48
|
+
end
|
49
|
+
|
50
|
+
def looks_like_rails_raw?(node)
|
51
|
+
receiver, method_name, *args = *node
|
52
|
+
|
53
|
+
receiver.nil? && method_name == :raw && args.one?
|
40
54
|
end
|
41
55
|
end
|
42
56
|
end
|
@@ -94,7 +94,7 @@ module RuboCop
|
|
94
94
|
def extract_method_chain(node)
|
95
95
|
chain = []
|
96
96
|
while !node.nil? && node.send_type?
|
97
|
-
chain << extract_method(node)
|
97
|
+
chain << extract_method(node) if method_from_time_class?(node)
|
98
98
|
node = node.parent
|
99
99
|
end
|
100
100
|
chain
|
@@ -105,6 +105,17 @@ module RuboCop
|
|
105
105
|
method_name
|
106
106
|
end
|
107
107
|
|
108
|
+
# Only add the method to the chain if the method being
|
109
|
+
# called is part of the time class.
|
110
|
+
def method_from_time_class?(node)
|
111
|
+
receiver, method_name, *_args = *node
|
112
|
+
if (receiver.is_a? RuboCop::Node) && !receiver.cbase_type?
|
113
|
+
method_from_time_class?(receiver)
|
114
|
+
else
|
115
|
+
TIMECLASS.include? method_name
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
108
119
|
# checks that parent node of send_type
|
109
120
|
# and receiver is the given node
|
110
121
|
def method_send?(node)
|
@@ -248,7 +248,12 @@ module RuboCop
|
|
248
248
|
return unless style == :assign_to_condition
|
249
249
|
return if elsif?(node)
|
250
250
|
|
251
|
-
|
251
|
+
if ternary?(node) || node.loc.keyword.is?('if')
|
252
|
+
_condition, if_branch, else_branch = *node
|
253
|
+
else
|
254
|
+
_condition, else_branch, if_branch = *node
|
255
|
+
end
|
256
|
+
|
252
257
|
elsif_branches, else_branch = expand_elses(else_branch)
|
253
258
|
return unless else_branch # empty else
|
254
259
|
|
@@ -16,6 +16,9 @@ module RuboCop
|
|
16
16
|
# an offense is reported.
|
17
17
|
#
|
18
18
|
class Copyright < Cop
|
19
|
+
AUTOCORRECT_EMPTY_WARNING = 'An AutocorrectNotice must be defined in' \
|
20
|
+
'your RuboCop config'.freeze
|
21
|
+
|
19
22
|
def message
|
20
23
|
"Include a copyright notice matching /#{notice}/" \
|
21
24
|
'before any code.'
|
@@ -68,11 +71,12 @@ module RuboCop
|
|
68
71
|
end
|
69
72
|
|
70
73
|
def autocorrect(token)
|
71
|
-
raise Warning,
|
72
|
-
'your RuboCop config' if autocorrect_notice.empty?
|
74
|
+
raise Warning, AUTOCORRECT_EMPTY_WARNING if autocorrect_notice.empty?
|
73
75
|
regex = Regexp.new(notice)
|
74
|
-
|
75
|
-
"
|
76
|
+
unless autocorrect_notice =~ regex
|
77
|
+
raise Warning, "AutocorrectNotice '#{autocorrect_notice}' must " \
|
78
|
+
"match Notice /#{notice}/"
|
79
|
+
end
|
76
80
|
|
77
81
|
lambda do |corrector|
|
78
82
|
range = token.nil? ? range_between(0, 0) : token.pos
|
@@ -10,6 +10,7 @@ module RuboCop
|
|
10
10
|
#
|
11
11
|
# @example
|
12
12
|
# # good for all styles
|
13
|
+
#
|
13
14
|
# if condition
|
14
15
|
# statement
|
15
16
|
# else
|
@@ -21,8 +22,9 @@ module RuboCop
|
|
21
22
|
# statement
|
22
23
|
# end
|
23
24
|
#
|
24
|
-
#
|
25
|
-
#
|
25
|
+
# @example
|
26
|
+
# # empty - warn only on empty else
|
27
|
+
#
|
26
28
|
# # bad
|
27
29
|
# if condition
|
28
30
|
# statement
|
@@ -36,8 +38,9 @@ module RuboCop
|
|
36
38
|
# nil
|
37
39
|
# end
|
38
40
|
#
|
39
|
-
#
|
40
|
-
#
|
41
|
+
# @example
|
42
|
+
# # nil - warn on else with nil in it
|
43
|
+
#
|
41
44
|
# # bad
|
42
45
|
# if condition
|
43
46
|
# statement
|
@@ -51,8 +54,9 @@ module RuboCop
|
|
51
54
|
# else
|
52
55
|
# end
|
53
56
|
#
|
54
|
-
#
|
55
|
-
#
|
57
|
+
# @example
|
58
|
+
# # both - warn on empty else and else with nil in it
|
59
|
+
#
|
56
60
|
# # bad
|
57
61
|
# if condition
|
58
62
|
# statement
|
@@ -114,12 +114,13 @@ module RuboCop
|
|
114
114
|
|
115
115
|
def extra_space_range(t1, t2)
|
116
116
|
return if t1.pos.line != t2.pos.line
|
117
|
-
return if allow_for_alignment? && aligned_tok?(t2)
|
118
117
|
|
119
118
|
start_pos = t1.pos.end_pos
|
120
119
|
end_pos = t2.pos.begin_pos - 1
|
121
120
|
return if end_pos <= start_pos
|
122
121
|
|
122
|
+
return if allow_for_alignment? && aligned_tok?(t2)
|
123
|
+
|
123
124
|
yield range_between(start_pos, end_pos)
|
124
125
|
end
|
125
126
|
|
@@ -16,7 +16,7 @@ module RuboCop
|
|
16
16
|
# all symbols for keys
|
17
17
|
# * hash_rockets - forces use of hash rockets for all hashes
|
18
18
|
# * no_mixed_keys - simply checks for hashes with mixed syntaxes
|
19
|
-
# *
|
19
|
+
# * ruby19_no_mixed_keys - forces use of ruby 1.9 syntax and forbids mixed
|
20
20
|
# syntax hashes
|
21
21
|
#
|
22
22
|
# @example
|
@@ -49,21 +49,26 @@ module RuboCop
|
|
49
49
|
# assignments, etc, would be more difficult. The end/} must be at the
|
50
50
|
# beginning of its line.
|
51
51
|
loc = node.loc
|
52
|
-
|
52
|
+
return unless begins_its_line?(loc.end)
|
53
|
+
|
54
|
+
check_indentation(loc.end, body)
|
55
|
+
return unless indentation_consistency_style == 'rails'
|
56
|
+
|
57
|
+
check_members(loc.end, [body])
|
53
58
|
end
|
54
59
|
|
55
60
|
def on_module(node)
|
56
61
|
_module_name, *members = *node
|
57
|
-
check_members(node, members)
|
62
|
+
check_members(node.loc.keyword, members)
|
58
63
|
end
|
59
64
|
|
60
65
|
def on_class(node)
|
61
66
|
_class_name, _base_class, *members = *node
|
62
|
-
check_members(node, members)
|
67
|
+
check_members(node.loc.keyword, members)
|
63
68
|
end
|
64
69
|
|
65
|
-
def check_members(
|
66
|
-
check_indentation(
|
70
|
+
def check_members(base, members)
|
71
|
+
check_indentation(base, members.first)
|
67
72
|
|
68
73
|
return unless members.any? && members.first.begin_type?
|
69
74
|
return unless indentation_consistency_style == 'rails'
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Style
|
6
|
+
# Checks for uses of if/unless modifiers with multiple-lines bodies.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
#
|
10
|
+
# # bad
|
11
|
+
# {
|
12
|
+
# result: 'this should not happen'
|
13
|
+
# } unless cond
|
14
|
+
#
|
15
|
+
# # good
|
16
|
+
# { result: 'ok' } if cond
|
17
|
+
class MultilineIfModifier < Cop
|
18
|
+
include IfNode
|
19
|
+
include StatementModifier
|
20
|
+
include AutocorrectAlignment
|
21
|
+
|
22
|
+
MSG = 'Favor a normal %s-statement over a modifier' \
|
23
|
+
' clause in a multiline statement.'.freeze
|
24
|
+
|
25
|
+
def on_if(node)
|
26
|
+
return unless modifier_if?(node)
|
27
|
+
|
28
|
+
_cond, body = if_node_parts(node)
|
29
|
+
return if body.single_line?
|
30
|
+
|
31
|
+
add_offense(node, :expression)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def message(node)
|
37
|
+
format(MSG, node.loc.keyword.source)
|
38
|
+
end
|
39
|
+
|
40
|
+
def autocorrect(node)
|
41
|
+
lambda do |corrector|
|
42
|
+
corrector.replace(node.source_range, to_normal_if(node))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_normal_if(node)
|
47
|
+
cond, body = if_node_parts(node)
|
48
|
+
indented_body = indented_body(body, node)
|
49
|
+
|
50
|
+
condition = "#{node.loc.keyword.source} #{cond.source}"
|
51
|
+
indented_end = "#{offset(node)}end"
|
52
|
+
|
53
|
+
"#{condition}\n#{indented_body}\n#{indented_end}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def configured_indentation_width
|
57
|
+
super || 2
|
58
|
+
end
|
59
|
+
|
60
|
+
def indented_body(body, node)
|
61
|
+
body_source = "#{offset(node)}#{body.source}"
|
62
|
+
body_source.each_line.map do |line|
|
63
|
+
if line == "\n"
|
64
|
+
line
|
65
|
+
else
|
66
|
+
line.sub(/^\s{#{offset(node).length}}/, indentation(node))
|
67
|
+
end
|
68
|
+
end.join
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -25,6 +25,7 @@ module RuboCop
|
|
25
25
|
# end
|
26
26
|
class NonNilCheck < Cop
|
27
27
|
include OnMethodDef
|
28
|
+
include IfNode
|
28
29
|
|
29
30
|
NIL_NODE = s(:nil)
|
30
31
|
|
@@ -55,7 +56,8 @@ module RuboCop
|
|
55
56
|
return unless method == :nil?
|
56
57
|
|
57
58
|
parent = send_node.parent
|
58
|
-
parent && parent.if_type? &&
|
59
|
+
parent && parent.if_type? && !ternary?(parent) &&
|
60
|
+
parent.loc.keyword.is?('unless')
|
59
61
|
end
|
60
62
|
|
61
63
|
def message(node)
|
@@ -29,6 +29,8 @@ module RuboCop
|
|
29
29
|
cond, _body = *node
|
30
30
|
|
31
31
|
return unless cond.begin_type?
|
32
|
+
# handle `if () ...`
|
33
|
+
return if empty_condition?(cond)
|
32
34
|
# handle `if (something rescue something_else) ...`
|
33
35
|
return if modifier_op?(cond.children.first)
|
34
36
|
# check if there's any whitespace between the keyword and the cond
|
@@ -98,15 +98,16 @@ module RuboCop
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def check_when_node(node)
|
101
|
+
return unless node
|
101
102
|
_cond, body = *node
|
102
|
-
check_branch(body)
|
103
|
+
check_branch(body) if body
|
103
104
|
end
|
104
105
|
|
105
106
|
def check_if_node(node)
|
106
107
|
return if modifier_if?(node) || ternary?(node)
|
107
108
|
|
108
109
|
_cond, if_node, else_node = if_node_parts(node)
|
109
|
-
check_branch(if_node)
|
110
|
+
check_branch(if_node) if if_node
|
110
111
|
check_branch(else_node) if else_node
|
111
112
|
end
|
112
113
|
|
@@ -123,7 +123,8 @@ module RuboCop
|
|
123
123
|
!(operator?(method_name) ||
|
124
124
|
keyword?(method_name) ||
|
125
125
|
constant_name?(method_name) ||
|
126
|
-
node.asgn_method_call?
|
126
|
+
node.asgn_method_call? ||
|
127
|
+
braces_style_call?(node))
|
127
128
|
end
|
128
129
|
|
129
130
|
def on_argument(node)
|
@@ -143,6 +144,10 @@ module RuboCop
|
|
143
144
|
method_name.match(/^[A-Z]/)
|
144
145
|
end
|
145
146
|
|
147
|
+
def braces_style_call?(node)
|
148
|
+
node.loc.selector.nil?
|
149
|
+
end
|
150
|
+
|
146
151
|
def allow_self(node)
|
147
152
|
return unless node.send_type?
|
148
153
|
|
@@ -85,7 +85,8 @@ module RuboCop
|
|
85
85
|
|
86
86
|
def check_node(node)
|
87
87
|
return if target_ruby_version < 2.3
|
88
|
-
return if
|
88
|
+
return if if_else?(node)
|
89
|
+
return if elsif?(node)
|
89
90
|
checked_variable, receiver, method = extract_parts(node)
|
90
91
|
return unless receiver == checked_variable
|
91
92
|
return if NIL_METHODS.include?(method)
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Style
|
6
|
+
# This cop checks for spaces between -> and opening parameter
|
7
|
+
# brace in lambda literals.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
#
|
11
|
+
# EnforcedStyle: require_no_space (default)
|
12
|
+
#
|
13
|
+
# @bad
|
14
|
+
# a = -> (x, y) { x + y }
|
15
|
+
#
|
16
|
+
# @good
|
17
|
+
# a = ->(x, y) { x + y }
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
#
|
21
|
+
# EnforcedStyle: require_space
|
22
|
+
#
|
23
|
+
# @bad
|
24
|
+
# a = ->(x, y) { x + y }
|
25
|
+
#
|
26
|
+
# @good
|
27
|
+
# a = -> (x, y) { x + y }
|
28
|
+
class SpaceInLambdaLiteral < Cop
|
29
|
+
include ConfigurableEnforcedStyle
|
30
|
+
|
31
|
+
ARROW = '->'.freeze
|
32
|
+
MSG_REQUIRE_SPACE = 'Use a space between `->` and opening brace ' \
|
33
|
+
'in lambda literals'.freeze
|
34
|
+
MSG_REQUIRE_NO_SPACE = 'Do not use spaces between `->` and opening ' \
|
35
|
+
'brace in lambda literals'.freeze
|
36
|
+
|
37
|
+
def on_send(node)
|
38
|
+
return unless arrow_lambda_with_args?(node)
|
39
|
+
if style == :require_space && !space_after_arrow?(node)
|
40
|
+
add_offense(node, node.parent.loc.expression, MSG_REQUIRE_SPACE)
|
41
|
+
elsif style == :require_no_space && space_after_arrow?(node)
|
42
|
+
add_offense(node, node.parent.loc.expression, MSG_REQUIRE_NO_SPACE)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def autocorrect(lambda_node)
|
47
|
+
children = lambda_node.parent.children
|
48
|
+
lambda do |corrector|
|
49
|
+
if style == :require_space
|
50
|
+
corrector.insert_before(children[1].source_range, ' ')
|
51
|
+
else
|
52
|
+
space_range = range_between(children[0].source_range.end_pos,
|
53
|
+
children[1].source_range.begin_pos)
|
54
|
+
corrector.remove(space_range)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def arrow_lambda_with_args?(node)
|
62
|
+
lambda_node?(node) && arrow_form?(node) && args?(node)
|
63
|
+
end
|
64
|
+
|
65
|
+
def lambda_node?(node)
|
66
|
+
receiver, call = *node
|
67
|
+
receiver.nil? && call == :lambda
|
68
|
+
end
|
69
|
+
|
70
|
+
def arrow_form?(lambda_node)
|
71
|
+
lambda_node.loc.selector.source == ARROW
|
72
|
+
end
|
73
|
+
|
74
|
+
def args?(lambda_node)
|
75
|
+
_call, args, _body = *lambda_node.parent
|
76
|
+
!args.children.empty?
|
77
|
+
end
|
78
|
+
|
79
|
+
def space_after_arrow?(lambda_node)
|
80
|
+
arrow = lambda_node.parent.children[0]
|
81
|
+
parentheses = lambda_node.parent.children[1]
|
82
|
+
parentheses.source_range.begin_pos - arrow.source_range.end_pos > 0
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -6,11 +6,12 @@ module RuboCop
|
|
6
6
|
# Checks for unnecessary additional spaces inside array percent literals
|
7
7
|
# (i.e. %i/%w).
|
8
8
|
#
|
9
|
-
# @
|
10
|
-
#
|
9
|
+
# @example
|
10
|
+
# @good
|
11
|
+
# %i(foo bar baz)
|
11
12
|
#
|
12
|
-
#
|
13
|
-
#
|
13
|
+
# @bad
|
14
|
+
# %w(foo bar baz)
|
14
15
|
class SpaceInsideArrayPercentLiteral < Cop
|
15
16
|
include MatchRange
|
16
17
|
include PercentLiteral
|
@@ -6,14 +6,15 @@ module RuboCop
|
|
6
6
|
# Checks for unnecessary additional spaces inside the delimiters of
|
7
7
|
# %i/%w/%x literals.
|
8
8
|
#
|
9
|
-
# @
|
10
|
-
#
|
9
|
+
# @example
|
10
|
+
# @good
|
11
|
+
# %i(foo bar baz)
|
11
12
|
#
|
12
|
-
#
|
13
|
-
#
|
13
|
+
# @bad
|
14
|
+
# %w( foo bar baz )
|
14
15
|
#
|
15
|
-
#
|
16
|
-
#
|
16
|
+
# @bad
|
17
|
+
# %x( ls -l )
|
17
18
|
class SpaceInsidePercentLiteralDelimiters < Cop
|
18
19
|
include MatchRange
|
19
20
|
include PercentLiteral
|
data/lib/rubocop/options.rb
CHANGED
@@ -91,6 +91,8 @@ module RuboCop
|
|
91
91
|
|
92
92
|
option(opts, '--force-exclusion')
|
93
93
|
|
94
|
+
option(opts, '--force-default-config')
|
95
|
+
|
94
96
|
option(opts, '--no-offense-counts') do
|
95
97
|
@options[:no_offense_counts] = true
|
96
98
|
end
|
@@ -252,63 +254,65 @@ module RuboCop
|
|
252
254
|
module OptionsHelp
|
253
255
|
MAX_EXCL = RuboCop::Options::DEFAULT_MAXIMUM_EXCLUSION_ITEMS.to_s
|
254
256
|
TEXT = {
|
255
|
-
only:
|
256
|
-
only_guide_cops:
|
257
|
-
|
258
|
-
except:
|
259
|
-
require:
|
260
|
-
config:
|
261
|
-
auto_gen_config:
|
262
|
-
|
263
|
-
no_offense_counts:
|
264
|
-
|
265
|
-
exclude_limit:
|
266
|
-
|
267
|
-
|
268
|
-
force_exclusion:
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
257
|
+
only: 'Run only the given cop(s).',
|
258
|
+
only_guide_cops: ['Run only cops for rules that link to a',
|
259
|
+
'style guide.'],
|
260
|
+
except: 'Disable the given cop(s).',
|
261
|
+
require: 'Require Ruby file.',
|
262
|
+
config: 'Specify configuration file.',
|
263
|
+
auto_gen_config: ['Generate a configuration file acting as a',
|
264
|
+
'TODO list.'],
|
265
|
+
no_offense_counts: ['Do not include offense counts in configuration',
|
266
|
+
'file generated by --auto-gen-config.'],
|
267
|
+
exclude_limit: ['Used together with --auto-gen-config to',
|
268
|
+
'set the limit for how many Exclude',
|
269
|
+
"properties to generate. Default is #{MAX_EXCL}."],
|
270
|
+
force_exclusion: ['Force excluding files specified in the',
|
271
|
+
'configuration `Exclude` even if they are',
|
272
|
+
'explicitly passed as arguments.'],
|
273
|
+
force_default_config: ['Use default configuration even if configuration',
|
274
|
+
'files are present in the directory tree.'],
|
275
|
+
format: ['Choose an output formatter. This option',
|
276
|
+
'can be specified multiple times to enable',
|
277
|
+
'multiple formatters at the same time.',
|
278
|
+
' [p]rogress (default)',
|
279
|
+
' [s]imple',
|
280
|
+
' [c]lang',
|
281
|
+
' [d]isabled cops via inline comments',
|
282
|
+
' [fu]ubar',
|
283
|
+
' [e]macs',
|
284
|
+
' [j]son',
|
285
|
+
' [h]tml',
|
286
|
+
' [fi]les',
|
287
|
+
' [o]ffenses',
|
288
|
+
' [w]orst',
|
289
|
+
' custom formatter class name'],
|
290
|
+
out: ['Write output to a file instead of STDOUT.',
|
291
|
+
'This option applies to the previously',
|
292
|
+
'specified --format, or the default format',
|
293
|
+
'if no format is specified.'],
|
294
|
+
fail_level: ['Minimum severity (A/R/C/W/E/F) for exit',
|
295
|
+
'with error code.'],
|
296
|
+
show_cops: ['Shows the given cops, or all cops by',
|
297
|
+
'default, and their configurations for the',
|
298
|
+
'current directory.'],
|
299
|
+
fail_fast: ['Inspect files in order of modification',
|
300
|
+
'time and stop after the first file',
|
301
|
+
'containing offenses.'],
|
302
|
+
cache: ["Use result caching (FLAG=true) or don't",
|
303
|
+
'(FLAG=false), default determined by',
|
304
|
+
'configuration parameter AllCops: UseCache.'],
|
305
|
+
debug: 'Display debug info.',
|
306
|
+
display_cop_names: 'Display cop names in offense messages.',
|
307
|
+
display_style_guide: 'Display style guide URLs in offense messages.',
|
308
|
+
extra_details: 'Display extra details in offense messages.',
|
309
|
+
rails: 'Run extra Rails cops.',
|
310
|
+
lint: 'Run only lint cops.',
|
311
|
+
list_target_files: 'List all files RuboCop will inspect.',
|
312
|
+
auto_correct: 'Auto-correct offenses.',
|
313
|
+
no_color: 'Force color output on or off.',
|
314
|
+
version: 'Display version.',
|
315
|
+
verbose_version: 'Display verbose version.',
|
312
316
|
stdin: ['Pipe source from STDIN.',
|
313
317
|
'This is useful for editor integration.']
|
314
318
|
}.freeze
|
data/lib/rubocop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.45.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-10-
|
13
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rainbow
|
@@ -160,12 +160,15 @@ files:
|
|
160
160
|
- lib/rubocop/cop/lint/debugger.rb
|
161
161
|
- lib/rubocop/cop/lint/def_end_alignment.rb
|
162
162
|
- lib/rubocop/cop/lint/deprecated_class_methods.rb
|
163
|
+
- lib/rubocop/cop/lint/duplicate_case_condition.rb
|
163
164
|
- lib/rubocop/cop/lint/duplicate_methods.rb
|
164
165
|
- lib/rubocop/cop/lint/duplicated_key.rb
|
165
166
|
- lib/rubocop/cop/lint/each_with_object_argument.rb
|
166
167
|
- lib/rubocop/cop/lint/else_layout.rb
|
167
168
|
- lib/rubocop/cop/lint/empty_ensure.rb
|
169
|
+
- lib/rubocop/cop/lint/empty_expression.rb
|
168
170
|
- lib/rubocop/cop/lint/empty_interpolation.rb
|
171
|
+
- lib/rubocop/cop/lint/empty_when.rb
|
169
172
|
- lib/rubocop/cop/lint/end_alignment.rb
|
170
173
|
- lib/rubocop/cop/lint/end_in_method.rb
|
171
174
|
- lib/rubocop/cop/lint/ensure_return.rb
|
@@ -410,6 +413,7 @@ files:
|
|
410
413
|
- lib/rubocop/cop/style/multiline_block_chain.rb
|
411
414
|
- lib/rubocop/cop/style/multiline_block_layout.rb
|
412
415
|
- lib/rubocop/cop/style/multiline_hash_brace_layout.rb
|
416
|
+
- lib/rubocop/cop/style/multiline_if_modifier.rb
|
413
417
|
- lib/rubocop/cop/style/multiline_if_then.rb
|
414
418
|
- lib/rubocop/cop/style/multiline_memoization.rb
|
415
419
|
- lib/rubocop/cop/style/multiline_method_call_brace_layout.rb
|
@@ -473,6 +477,7 @@ files:
|
|
473
477
|
- lib/rubocop/cop/style/space_before_comment.rb
|
474
478
|
- lib/rubocop/cop/style/space_before_first_arg.rb
|
475
479
|
- lib/rubocop/cop/style/space_before_semicolon.rb
|
480
|
+
- lib/rubocop/cop/style/space_in_lambda_literal.rb
|
476
481
|
- lib/rubocop/cop/style/space_inside_array_percent_literal.rb
|
477
482
|
- lib/rubocop/cop/style/space_inside_block_braces.rb
|
478
483
|
- lib/rubocop/cop/style/space_inside_brackets.rb
|