rubocop 1.60.2 → 1.63.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 +1 -1
- data/assets/output.css.erb +159 -0
- data/assets/output.html.erb +1 -160
- data/config/default.yml +64 -15
- data/lib/rubocop/cli/command/auto_generate_config.rb +12 -3
- data/lib/rubocop/cli/command/lsp.rb +2 -2
- data/lib/rubocop/cli.rb +6 -1
- data/lib/rubocop/config.rb +37 -10
- data/lib/rubocop/config_finder.rb +12 -2
- data/lib/rubocop/config_obsoletion.rb +1 -1
- data/lib/rubocop/config_validator.rb +14 -5
- data/lib/rubocop/cop/autocorrect_logic.rb +6 -1
- data/lib/rubocop/cop/base.rb +52 -6
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +5 -13
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -1
- data/lib/rubocop/cop/internal_affairs/example_description.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +122 -28
- data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
- data/lib/rubocop/cop/layout/end_alignment.rb +3 -1
- data/lib/rubocop/cop/layout/redundant_line_break.rb +11 -3
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +19 -10
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +1 -1
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -4
- data/lib/rubocop/cop/lint/debugger.rb +27 -2
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +14 -9
- data/lib/rubocop/cop/lint/redundant_with_index.rb +4 -0
- data/lib/rubocop/cop/lint/rescue_type.rb +1 -3
- data/lib/rubocop/cop/lint/script_permission.rb +3 -3
- data/lib/rubocop/cop/lint/syntax.rb +1 -1
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +7 -2
- data/lib/rubocop/cop/lint/useless_times.rb +1 -1
- data/lib/rubocop/cop/lint/void.rb +6 -1
- data/lib/rubocop/cop/mixin/code_length.rb +12 -1
- data/lib/rubocop/cop/mixin/method_complexity.rb +15 -6
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
- data/lib/rubocop/cop/naming/block_forwarding.rb +31 -12
- data/lib/rubocop/cop/naming/file_name.rb +2 -2
- data/lib/rubocop/cop/naming/inclusive_language.rb +1 -2
- data/lib/rubocop/cop/naming/predicate_name.rb +2 -2
- data/lib/rubocop/cop/registry.rb +1 -1
- data/lib/rubocop/cop/style/alias.rb +1 -0
- data/lib/rubocop/cop/style/arguments_forwarding.rb +29 -8
- data/lib/rubocop/cop/style/case_like_if.rb +1 -1
- data/lib/rubocop/cop/style/class_vars.rb +3 -3
- data/lib/rubocop/cop/style/collection_compact.rb +3 -3
- data/lib/rubocop/cop/style/commented_keyword.rb +5 -2
- data/lib/rubocop/cop/style/conditional_assignment.rb +4 -5
- data/lib/rubocop/cop/style/copyright.rb +16 -11
- data/lib/rubocop/cop/style/eval_with_location.rb +2 -0
- data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -1
- data/lib/rubocop/cop/style/for.rb +2 -0
- data/lib/rubocop/cop/style/format_string.rb +9 -9
- data/lib/rubocop/cop/style/hash_each_methods.rb +1 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +6 -2
- data/lib/rubocop/cop/style/inverse_methods.rb +8 -8
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +10 -5
- data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +5 -8
- data/lib/rubocop/cop/style/map_into_array.rb +175 -0
- data/lib/rubocop/cop/style/map_to_hash.rb +1 -1
- data/lib/rubocop/cop/style/map_to_set.rb +1 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +10 -1
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +4 -0
- data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
- data/lib/rubocop/cop/style/object_then.rb +5 -3
- data/lib/rubocop/cop/style/parallel_assignment.rb +1 -3
- data/lib/rubocop/cop/style/raise_args.rb +4 -1
- data/lib/rubocop/cop/style/redundant_argument.rb +25 -2
- data/lib/rubocop/cop/style/redundant_assignment.rb +10 -2
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +5 -4
- data/lib/rubocop/cop/style/redundant_each.rb +1 -1
- data/lib/rubocop/cop/style/redundant_filter_chain.rb +1 -1
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +5 -0
- data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +6 -0
- data/lib/rubocop/cop/style/sample.rb +1 -3
- data/lib/rubocop/cop/team.rb +3 -0
- data/lib/rubocop/cop/utils/regexp_ranges.rb +1 -1
- data/lib/rubocop/cops_documentation_generator.rb +4 -2
- data/lib/rubocop/directive_comment.rb +10 -8
- data/lib/rubocop/formatter/clang_style_formatter.rb +3 -7
- data/lib/rubocop/formatter/html_formatter.rb +30 -10
- data/lib/rubocop/formatter/offense_count_formatter.rb +12 -2
- data/lib/rubocop/formatter/tap_formatter.rb +3 -7
- data/lib/rubocop/lockfile.rb +34 -4
- data/lib/rubocop/lsp/logger.rb +1 -1
- data/lib/rubocop/lsp/routes.rb +1 -1
- data/lib/rubocop/lsp/runtime.rb +1 -1
- data/lib/rubocop/lsp/server.rb +5 -2
- data/lib/rubocop/lsp/severity.rb +1 -1
- data/lib/rubocop/lsp.rb +29 -0
- data/lib/rubocop/magic_comment.rb +1 -1
- data/lib/rubocop/options.rb +11 -0
- data/lib/rubocop/path_util.rb +6 -2
- data/lib/rubocop/rspec/cop_helper.rb +8 -2
- data/lib/rubocop/rspec/expect_offense.rb +16 -8
- data/lib/rubocop/rspec/shared_contexts.rb +49 -18
- data/lib/rubocop/rspec/support.rb +2 -1
- data/lib/rubocop/runner.rb +12 -2
- data/lib/rubocop/target_finder.rb +84 -78
- data/lib/rubocop/target_ruby.rb +82 -80
- data/lib/rubocop/version.rb +19 -4
- data/lib/rubocop.rb +1 -0
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eadae0a09b33bf6a4ae3621ad1b86ba4eff0e7601d3ceb89dcf115759e9c022
|
4
|
+
data.tar.gz: ae113bb4d3eab63b4a551e36541f14d4e3bf3aae3354b853fb45960e80b90bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6343643a7515b53e3e880a6cb92e256f37a3c1ee42c757af0506bf6457d900d36ea95b48bef2c6e008b5a96ba957f28b448a8e62da10ef1c27e6fe88dfbc1935
|
7
|
+
data.tar.gz: c67f434f594eb5b3f609d1e36140c04a6c79ce784b2d614c0e57ed4d22f7bea437a4edf89de0b976c425c7a2fcaf54b46ce66391eb9e1b61f60fa03bd46fdebc
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
|
|
53
53
|
in your `Gemfile`:
|
54
54
|
|
55
55
|
```rb
|
56
|
-
gem 'rubocop', '~> 1.
|
56
|
+
gem 'rubocop', '~> 1.63', require: false
|
57
57
|
```
|
58
58
|
|
59
59
|
See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
|
@@ -0,0 +1,159 @@
|
|
1
|
+
* {
|
2
|
+
-webkit-box-sizing: border-box;
|
3
|
+
-moz-box-sizing: border-box;
|
4
|
+
box-sizing: border-box;
|
5
|
+
}
|
6
|
+
|
7
|
+
body, html {
|
8
|
+
font-size: 62.5%;
|
9
|
+
}
|
10
|
+
body {
|
11
|
+
background-color: #ecedf0;
|
12
|
+
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
13
|
+
margin: 0;
|
14
|
+
}
|
15
|
+
code {
|
16
|
+
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
17
|
+
font-size: 85%;
|
18
|
+
}
|
19
|
+
#header {
|
20
|
+
background: #f9f9f9;
|
21
|
+
color: #333;
|
22
|
+
border-bottom: 3px solid #ccc;
|
23
|
+
height: 50px;
|
24
|
+
padding: 0;
|
25
|
+
}
|
26
|
+
#header .logo {
|
27
|
+
float: left;
|
28
|
+
margin: 5px 12px 7px 20px;
|
29
|
+
width: 38px;
|
30
|
+
height: 38px;
|
31
|
+
}
|
32
|
+
#header .title {
|
33
|
+
display: inline-block;
|
34
|
+
float: left;
|
35
|
+
height: 50px;
|
36
|
+
font-size: 2.4rem;
|
37
|
+
letter-spacing: normal;
|
38
|
+
line-height: 50px;
|
39
|
+
margin: 0;
|
40
|
+
}
|
41
|
+
|
42
|
+
.information, #offenses {
|
43
|
+
width: 100%;
|
44
|
+
padding: 20px;
|
45
|
+
color: #333;
|
46
|
+
}
|
47
|
+
#offenses {
|
48
|
+
padding: 0 20px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.information .infobox {
|
52
|
+
border-left: 3px solid;
|
53
|
+
border-radius: 4px;
|
54
|
+
background-color: #fff;
|
55
|
+
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
56
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
57
|
+
padding: 15px;
|
58
|
+
border-color: #0088cc;
|
59
|
+
font-size: 1.4rem;
|
60
|
+
}
|
61
|
+
.information .infobox .info-title {
|
62
|
+
font-size: 1.8rem;
|
63
|
+
line-height: 2.2rem;
|
64
|
+
margin: 0 0 0.5em;
|
65
|
+
}
|
66
|
+
.information .offenses-list li {
|
67
|
+
line-height: 1.8rem
|
68
|
+
}
|
69
|
+
.information .offenses-list {
|
70
|
+
padding-left: 20px;
|
71
|
+
margin-bottom: 0;
|
72
|
+
}
|
73
|
+
|
74
|
+
#offenses .offense-box {
|
75
|
+
border-radius: 4px;
|
76
|
+
margin-bottom: 20px;
|
77
|
+
background-color: #fff;
|
78
|
+
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
79
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
80
|
+
}
|
81
|
+
.fixed .box-title {
|
82
|
+
position: fixed;
|
83
|
+
top: 0;
|
84
|
+
z-index: 10;
|
85
|
+
width: 100%;
|
86
|
+
}
|
87
|
+
.box-title-placeholder {
|
88
|
+
display: none;
|
89
|
+
}
|
90
|
+
.fixed .box-title-placeholder {
|
91
|
+
display: block;
|
92
|
+
}
|
93
|
+
#offenses .offense-box .box-title h3, #offenses .offense-box .box-title-placeholder h3 {
|
94
|
+
color: #33353f;
|
95
|
+
background-color: #f6f6f6;
|
96
|
+
font-size: 2rem;
|
97
|
+
line-height: 2rem;
|
98
|
+
display: block;
|
99
|
+
padding: 15px;
|
100
|
+
border-radius: 5px;
|
101
|
+
margin: 0;
|
102
|
+
}
|
103
|
+
#offenses .offense-box .offense-reports {
|
104
|
+
padding: 0 15px;
|
105
|
+
}
|
106
|
+
#offenses .offense-box .offense-reports .report {
|
107
|
+
border-bottom: 1px dotted #ddd;
|
108
|
+
padding: 15px 0px;
|
109
|
+
position: relative;
|
110
|
+
font-size: 1.3rem;
|
111
|
+
}
|
112
|
+
#offenses .offense-box .offense-reports .report:last-child {
|
113
|
+
border-bottom: none;
|
114
|
+
}
|
115
|
+
#offenses .offense-box .offense-reports .report pre code {
|
116
|
+
display: block;
|
117
|
+
background: #000;
|
118
|
+
color: #fff;
|
119
|
+
padding: 10px 15px;
|
120
|
+
border-radius: 5px;
|
121
|
+
line-height: 1.6rem;
|
122
|
+
}
|
123
|
+
#offenses .offense-box .offense-reports .report .location {
|
124
|
+
font-weight: bold;
|
125
|
+
}
|
126
|
+
#offenses .offense-box .offense-reports .report .message code {
|
127
|
+
padding: 0.3em;
|
128
|
+
background-color: rgba(0,0,0,0.07);
|
129
|
+
border-radius: 3px;
|
130
|
+
}
|
131
|
+
.severity {
|
132
|
+
text-transform: capitalize;
|
133
|
+
font-weight: bold;
|
134
|
+
}
|
135
|
+
.highlight {
|
136
|
+
padding: 2px;
|
137
|
+
border-radius: 2px;
|
138
|
+
font-weight: bold;
|
139
|
+
}
|
140
|
+
<%- SEVERITY_COLORS.each do |severity, color| %>
|
141
|
+
.severity.<%= severity %> {
|
142
|
+
color: <%= color %>;
|
143
|
+
}
|
144
|
+
.highlight.<%= severity %> {
|
145
|
+
background-color: <%= color.fade_out(0.4) %>;
|
146
|
+
border: 1px solid <%= color.fade_out(0.6) %>;
|
147
|
+
}
|
148
|
+
<%- end %>
|
149
|
+
footer {
|
150
|
+
margin-bottom: 20px;
|
151
|
+
margin-right: 20px;
|
152
|
+
font-size: 1.3rem;
|
153
|
+
color: #777;
|
154
|
+
text-align: right;
|
155
|
+
}
|
156
|
+
.extra-code {
|
157
|
+
color: #ED9C28
|
158
|
+
}
|
159
|
+
|
data/assets/output.html.erb
CHANGED
@@ -3,168 +3,9 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset='UTF-8' />
|
5
5
|
<title>RuboCop Inspection Report</title>
|
6
|
-
<%# TODO: Clean up the messy markup and style definitions. %>
|
7
6
|
<style>
|
8
|
-
|
9
|
-
-webkit-box-sizing: border-box;
|
10
|
-
-moz-box-sizing: border-box;
|
11
|
-
box-sizing: border-box;
|
12
|
-
}
|
13
|
-
|
14
|
-
body, html {
|
15
|
-
font-size: 62.5%;
|
16
|
-
}
|
17
|
-
body {
|
18
|
-
background-color: #ecedf0;
|
19
|
-
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
20
|
-
margin: 0;
|
21
|
-
}
|
22
|
-
code {
|
23
|
-
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
24
|
-
font-size: 85%;
|
25
|
-
}
|
26
|
-
#header {
|
27
|
-
background: #f9f9f9;
|
28
|
-
color: #333;
|
29
|
-
border-bottom: 3px solid #ccc;
|
30
|
-
height: 50px;
|
31
|
-
padding: 0;
|
32
|
-
}
|
33
|
-
#header .logo {
|
34
|
-
float: left;
|
35
|
-
margin: 5px 12px 7px 20px;
|
36
|
-
width: 38px;
|
37
|
-
height: 38px;
|
38
|
-
}
|
39
|
-
#header .title {
|
40
|
-
display: inline-block;
|
41
|
-
float: left;
|
42
|
-
height: 50px;
|
43
|
-
font-size: 2.4rem;
|
44
|
-
letter-spacing: normal;
|
45
|
-
line-height: 50px;
|
46
|
-
margin: 0;
|
47
|
-
}
|
48
|
-
|
49
|
-
.information, #offenses {
|
50
|
-
width: 100%;
|
51
|
-
padding: 20px;
|
52
|
-
color: #333;
|
53
|
-
}
|
54
|
-
#offenses {
|
55
|
-
padding: 0 20px;
|
56
|
-
}
|
57
|
-
|
58
|
-
.information .infobox {
|
59
|
-
border-left: 3px solid;
|
60
|
-
border-radius: 4px;
|
61
|
-
background-color: #fff;
|
62
|
-
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
63
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
64
|
-
padding: 15px;
|
65
|
-
border-color: #0088cc;
|
66
|
-
font-size: 1.4rem;
|
67
|
-
}
|
68
|
-
.information .infobox .info-title {
|
69
|
-
font-size: 1.8rem;
|
70
|
-
line-height: 2.2rem;
|
71
|
-
margin: 0 0 0.5em;
|
72
|
-
}
|
73
|
-
.information .offenses-list li {
|
74
|
-
line-height: 1.8rem
|
75
|
-
}
|
76
|
-
.information .offenses-list {
|
77
|
-
padding-left: 20px;
|
78
|
-
margin-bottom: 0;
|
79
|
-
}
|
80
|
-
|
81
|
-
#offenses .offense-box {
|
82
|
-
border-radius: 4px;
|
83
|
-
margin-bottom: 20px;
|
84
|
-
background-color: #fff;
|
85
|
-
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
86
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
|
87
|
-
}
|
88
|
-
.fixed .box-title {
|
89
|
-
position: fixed;
|
90
|
-
top: 0;
|
91
|
-
z-index: 10;
|
92
|
-
width: 100%;
|
93
|
-
}
|
94
|
-
.box-title-placeholder {
|
95
|
-
display: none;
|
96
|
-
}
|
97
|
-
.fixed .box-title-placeholder {
|
98
|
-
display: block;
|
99
|
-
}
|
100
|
-
#offenses .offense-box .box-title h3, #offenses .offense-box .box-title-placeholder h3 {
|
101
|
-
color: #33353f;
|
102
|
-
background-color: #f6f6f6;
|
103
|
-
font-size: 2rem;
|
104
|
-
line-height: 2rem;
|
105
|
-
display: block;
|
106
|
-
padding: 15px;
|
107
|
-
border-radius: 5px;
|
108
|
-
margin: 0;
|
109
|
-
}
|
110
|
-
#offenses .offense-box .offense-reports {
|
111
|
-
padding: 0 15px;
|
112
|
-
}
|
113
|
-
#offenses .offense-box .offense-reports .report {
|
114
|
-
border-bottom: 1px dotted #ddd;
|
115
|
-
padding: 15px 0px;
|
116
|
-
position: relative;
|
117
|
-
font-size: 1.3rem;
|
118
|
-
}
|
119
|
-
#offenses .offense-box .offense-reports .report:last-child {
|
120
|
-
border-bottom: none;
|
121
|
-
}
|
122
|
-
#offenses .offense-box .offense-reports .report pre code {
|
123
|
-
display: block;
|
124
|
-
background: #000;
|
125
|
-
color: #fff;
|
126
|
-
padding: 10px 15px;
|
127
|
-
border-radius: 5px;
|
128
|
-
line-height: 1.6rem;
|
129
|
-
}
|
130
|
-
#offenses .offense-box .offense-reports .report .location {
|
131
|
-
font-weight: bold;
|
132
|
-
}
|
133
|
-
#offenses .offense-box .offense-reports .report .message code {
|
134
|
-
padding: 0.3em;
|
135
|
-
background-color: rgba(0,0,0,0.07);
|
136
|
-
border-radius: 3px;
|
137
|
-
}
|
138
|
-
.severity {
|
139
|
-
text-transform: capitalize;
|
140
|
-
font-weight: bold;
|
141
|
-
}
|
142
|
-
.highlight {
|
143
|
-
padding: 2px;
|
144
|
-
border-radius: 2px;
|
145
|
-
font-weight: bold;
|
146
|
-
}
|
147
|
-
<%- SEVERITY_COLORS.each do |severity, color| %>
|
148
|
-
.severity.<%= severity %> {
|
149
|
-
color: <%= color %>;
|
150
|
-
}
|
151
|
-
.highlight.<%= severity %> {
|
152
|
-
background-color: <%= color.fade_out(0.4) %>;
|
153
|
-
border: 1px solid <%= color.fade_out(0.6) %>;
|
154
|
-
}
|
155
|
-
<%- end %>
|
156
|
-
footer {
|
157
|
-
margin-bottom: 20px;
|
158
|
-
margin-right: 20px;
|
159
|
-
font-size: 1.3rem;
|
160
|
-
color: #777;
|
161
|
-
text-align: right;
|
162
|
-
}
|
163
|
-
.extra-code {
|
164
|
-
color: #ED9C28
|
165
|
-
}
|
7
|
+
<%= render_css %>
|
166
8
|
</style>
|
167
|
-
|
168
9
|
<script>
|
169
10
|
(function() {
|
170
11
|
// floating headers. requires classList support.
|
data/config/default.yml
CHANGED
@@ -144,19 +144,26 @@ AllCops:
|
|
144
144
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
145
145
|
# supported Ruby version (currently Ruby 2.7).
|
146
146
|
TargetRubyVersion: ~
|
147
|
+
# You can specify the parser engine. There are two options available:
|
148
|
+
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
149
|
+
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
150
|
+
# By default, `parser` is used. For the `TargetRubyVersion` value, `parser` can be specified for versions `2.0` and above.
|
151
|
+
# `parser_prism` can be specified for versions `3.3` and above. `parser_prism` is faster but still considered experimental.
|
152
|
+
ParserEngine: parser_whitequark
|
147
153
|
# Determines if a notification for extension libraries should be shown when
|
148
154
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
149
155
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
150
156
|
# included.
|
151
157
|
SuggestExtensions:
|
152
158
|
rubocop-rails: [rails]
|
153
|
-
rubocop-rspec: [rspec
|
159
|
+
rubocop-rspec: [rspec]
|
154
160
|
rubocop-minitest: [minitest]
|
155
161
|
rubocop-sequel: [sequel]
|
156
162
|
rubocop-rake: [rake]
|
157
163
|
rubocop-graphql: [graphql]
|
158
164
|
rubocop-capybara: [capybara]
|
159
165
|
rubocop-factory_bot: [factory_bot, factory_bot_rails]
|
166
|
+
rubocop-rspec_rails: [rspec-rails]
|
160
167
|
# Enable/Disable checking the methods extended by Active Support.
|
161
168
|
ActiveSupportExtensionsEnabled: false
|
162
169
|
|
@@ -556,7 +563,9 @@ Layout/ElseAlignment:
|
|
556
563
|
Layout/EmptyComment:
|
557
564
|
Description: 'Checks empty comment.'
|
558
565
|
Enabled: true
|
566
|
+
AutoCorrect: contextual
|
559
567
|
VersionAdded: '0.53'
|
568
|
+
VersionChanged: '1.61'
|
560
569
|
AllowBorderComment: true
|
561
570
|
AllowMarginComment: true
|
562
571
|
|
@@ -1649,7 +1658,7 @@ Lint/Debugger:
|
|
1649
1658
|
Description: 'Check for debugger calls.'
|
1650
1659
|
Enabled: true
|
1651
1660
|
VersionAdded: '0.14'
|
1652
|
-
VersionChanged: '1.
|
1661
|
+
VersionChanged: '1.63'
|
1653
1662
|
DebuggerMethods:
|
1654
1663
|
# Groups are available so that a specific group can be disabled in
|
1655
1664
|
# a user's configuration, but are otherwise not significant.
|
@@ -1662,8 +1671,14 @@ Lint/Debugger:
|
|
1662
1671
|
- Kernel.byebug
|
1663
1672
|
- Kernel.remote_byebug
|
1664
1673
|
Capybara:
|
1674
|
+
- page.save_and_open_page
|
1675
|
+
- page.save_and_open_screenshot
|
1676
|
+
- page.save_page
|
1677
|
+
- page.save_screenshot
|
1665
1678
|
- save_and_open_page
|
1666
1679
|
- save_and_open_screenshot
|
1680
|
+
- save_page
|
1681
|
+
- save_screenshot
|
1667
1682
|
debug.rb:
|
1668
1683
|
- binding.b
|
1669
1684
|
- binding.break
|
@@ -1685,6 +1700,11 @@ Lint/Debugger:
|
|
1685
1700
|
- jard
|
1686
1701
|
WebConsole:
|
1687
1702
|
- binding.console
|
1703
|
+
DebuggerRequires:
|
1704
|
+
debug.rb:
|
1705
|
+
- debug/open
|
1706
|
+
- debug/open_nonstop
|
1707
|
+
- debug/start
|
1688
1708
|
|
1689
1709
|
Lint/DeprecatedClassMethods:
|
1690
1710
|
Description: 'Check for deprecated class method calls.'
|
@@ -1825,16 +1845,18 @@ Lint/EmptyClass:
|
|
1825
1845
|
Lint/EmptyConditionalBody:
|
1826
1846
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1827
1847
|
Enabled: true
|
1848
|
+
AutoCorrect: contextual
|
1828
1849
|
SafeAutoCorrect: false
|
1829
1850
|
AllowComments: true
|
1830
1851
|
VersionAdded: '0.89'
|
1831
|
-
VersionChanged: '1.
|
1852
|
+
VersionChanged: '1.61'
|
1832
1853
|
|
1833
1854
|
Lint/EmptyEnsure:
|
1834
1855
|
Description: 'Checks for empty ensure block.'
|
1835
1856
|
Enabled: true
|
1857
|
+
AutoCorrect: contextual
|
1836
1858
|
VersionAdded: '0.10'
|
1837
|
-
VersionChanged: '
|
1859
|
+
VersionChanged: '1.61'
|
1838
1860
|
|
1839
1861
|
Lint/EmptyExpression:
|
1840
1862
|
Description: 'Checks for empty expressions.'
|
@@ -1856,8 +1878,9 @@ Lint/EmptyInPattern:
|
|
1856
1878
|
Lint/EmptyInterpolation:
|
1857
1879
|
Description: 'Checks for empty string interpolation.'
|
1858
1880
|
Enabled: true
|
1881
|
+
AutoCorrect: contextual
|
1859
1882
|
VersionAdded: '0.20'
|
1860
|
-
VersionChanged: '
|
1883
|
+
VersionChanged: '1.61'
|
1861
1884
|
|
1862
1885
|
Lint/EmptyWhen:
|
1863
1886
|
Description: 'Checks for `when` branches with empty bodies.'
|
@@ -2395,7 +2418,9 @@ Lint/TopLevelReturnWithArgument:
|
|
2395
2418
|
Lint/TrailingCommaInAttributeDeclaration:
|
2396
2419
|
Description: 'Checks for trailing commas in attribute declarations.'
|
2397
2420
|
Enabled: true
|
2421
|
+
AutoCorrect: contextual
|
2398
2422
|
VersionAdded: '0.90'
|
2423
|
+
VersionChanged: '1.61'
|
2399
2424
|
|
2400
2425
|
Lint/TripleQuotes:
|
2401
2426
|
Description: 'Checks for useless triple quote constructs.'
|
@@ -2455,8 +2480,9 @@ Lint/UnusedBlockArgument:
|
|
2455
2480
|
Description: 'Checks for unused block arguments.'
|
2456
2481
|
StyleGuide: '#underscore-unused-vars'
|
2457
2482
|
Enabled: true
|
2483
|
+
AutoCorrect: contextual
|
2458
2484
|
VersionAdded: '0.21'
|
2459
|
-
VersionChanged: '
|
2485
|
+
VersionChanged: '1.61'
|
2460
2486
|
IgnoreEmptyBlocks: true
|
2461
2487
|
AllowUnusedKeywordArguments: false
|
2462
2488
|
|
@@ -2464,8 +2490,9 @@ Lint/UnusedMethodArgument:
|
|
2464
2490
|
Description: 'Checks for unused method arguments.'
|
2465
2491
|
StyleGuide: '#underscore-unused-vars'
|
2466
2492
|
Enabled: true
|
2493
|
+
AutoCorrect: contextual
|
2467
2494
|
VersionAdded: '0.21'
|
2468
|
-
VersionChanged: '
|
2495
|
+
VersionChanged: '1.61'
|
2469
2496
|
AllowUnusedKeywordArguments: false
|
2470
2497
|
IgnoreEmptyMethods: true
|
2471
2498
|
IgnoreNotImplementedMethods: true
|
@@ -2489,8 +2516,9 @@ Lint/UriRegexp:
|
|
2489
2516
|
Lint/UselessAccessModifier:
|
2490
2517
|
Description: 'Checks for useless access modifiers.'
|
2491
2518
|
Enabled: true
|
2519
|
+
AutoCorrect: contextual
|
2492
2520
|
VersionAdded: '0.20'
|
2493
|
-
VersionChanged: '
|
2521
|
+
VersionChanged: '1.61'
|
2494
2522
|
ContextCreatingMethods: []
|
2495
2523
|
MethodCreatingMethods: []
|
2496
2524
|
|
@@ -2498,8 +2526,9 @@ Lint/UselessAssignment:
|
|
2498
2526
|
Description: 'Checks for useless assignment to a local variable.'
|
2499
2527
|
StyleGuide: '#underscore-unused-vars'
|
2500
2528
|
Enabled: true
|
2529
|
+
AutoCorrect: contextual
|
2501
2530
|
VersionAdded: '0.11'
|
2502
|
-
VersionChanged: '1.
|
2531
|
+
VersionChanged: '1.61'
|
2503
2532
|
SafeAutoCorrect: false
|
2504
2533
|
|
2505
2534
|
Lint/UselessElseWithoutRescue:
|
@@ -2511,8 +2540,9 @@ Lint/UselessElseWithoutRescue:
|
|
2511
2540
|
Lint/UselessMethodDefinition:
|
2512
2541
|
Description: 'Checks for useless method definitions.'
|
2513
2542
|
Enabled: true
|
2543
|
+
AutoCorrect: contextual
|
2514
2544
|
VersionAdded: '0.90'
|
2515
|
-
VersionChanged: '
|
2545
|
+
VersionChanged: '1.61'
|
2516
2546
|
Safe: false
|
2517
2547
|
|
2518
2548
|
Lint/UselessRescue:
|
@@ -2535,13 +2565,17 @@ Lint/UselessSetterCall:
|
|
2535
2565
|
Lint/UselessTimes:
|
2536
2566
|
Description: 'Checks for useless `Integer#times` calls.'
|
2537
2567
|
Enabled: true
|
2538
|
-
VersionAdded: '0.91'
|
2539
2568
|
Safe: false
|
2569
|
+
AutoCorrect: contextual
|
2570
|
+
VersionAdded: '0.91'
|
2571
|
+
VersionChanged: '1.61'
|
2540
2572
|
|
2541
2573
|
Lint/Void:
|
2542
2574
|
Description: 'Possible use of operator/literal/variable in void context.'
|
2543
2575
|
Enabled: true
|
2576
|
+
AutoCorrect: contextual
|
2544
2577
|
VersionAdded: '0.9'
|
2578
|
+
VersionChanged: '1.61'
|
2545
2579
|
CheckForMethodsWithNoSideEffects: false
|
2546
2580
|
|
2547
2581
|
#################### Metrics ###############################
|
@@ -2740,7 +2774,8 @@ Naming/FileName:
|
|
2740
2774
|
VersionChanged: '1.23'
|
2741
2775
|
# Camel case file names listed in `AllCops:Include` and all file names listed
|
2742
2776
|
# in `AllCops:Exclude` are excluded by default. Add extra excludes here.
|
2743
|
-
Exclude:
|
2777
|
+
Exclude:
|
2778
|
+
- Rakefile.rb
|
2744
2779
|
# When `true`, requires that each source file should define a class or module
|
2745
2780
|
# with a name which matches the file name (converted to ... case).
|
2746
2781
|
# It further expects it to be nested inside modules which match the names
|
@@ -3701,8 +3736,9 @@ Style/EmptyCaseCondition:
|
|
3701
3736
|
Style/EmptyElse:
|
3702
3737
|
Description: 'Avoid empty else-clauses.'
|
3703
3738
|
Enabled: true
|
3739
|
+
AutoCorrect: contextual
|
3704
3740
|
VersionAdded: '0.28'
|
3705
|
-
VersionChanged: '
|
3741
|
+
VersionChanged: '1.61'
|
3706
3742
|
EnforcedStyle: both
|
3707
3743
|
# empty - warn only on empty `else`
|
3708
3744
|
# nil - warn on `else` with nil in it
|
@@ -3716,7 +3752,9 @@ Style/EmptyElse:
|
|
3716
3752
|
Style/EmptyHeredoc:
|
3717
3753
|
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3718
3754
|
Enabled: pending
|
3755
|
+
AutoCorrect: contextual
|
3719
3756
|
VersionAdded: '1.32'
|
3757
|
+
VersionChanged: '1.61'
|
3720
3758
|
|
3721
3759
|
Style/EmptyLambdaParameter:
|
3722
3760
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3734,7 +3772,9 @@ Style/EmptyMethod:
|
|
3734
3772
|
Description: 'Checks the formatting of empty method definitions.'
|
3735
3773
|
StyleGuide: '#no-single-line-methods'
|
3736
3774
|
Enabled: true
|
3775
|
+
AutoCorrect: contextual
|
3737
3776
|
VersionAdded: '0.46'
|
3777
|
+
VersionChanged: '1.61'
|
3738
3778
|
EnforcedStyle: compact
|
3739
3779
|
SupportedStyles:
|
3740
3780
|
- compact
|
@@ -4249,6 +4289,13 @@ Style/MapCompactWithConditionalBlock:
|
|
4249
4289
|
Enabled: pending
|
4250
4290
|
VersionAdded: '1.30'
|
4251
4291
|
|
4292
|
+
Style/MapIntoArray:
|
4293
|
+
Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
|
4294
|
+
StyleGuide: '#functional-code'
|
4295
|
+
Enabled: pending
|
4296
|
+
VersionAdded: '1.63'
|
4297
|
+
Safe: false
|
4298
|
+
|
4252
4299
|
Style/MapToHash:
|
4253
4300
|
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
4254
4301
|
Enabled: pending
|
@@ -4835,8 +4882,9 @@ Style/RaiseArgs:
|
|
4835
4882
|
Description: 'Checks the arguments passed to raise/fail.'
|
4836
4883
|
StyleGuide: '#exception-class-messages'
|
4837
4884
|
Enabled: true
|
4885
|
+
Safe: false
|
4838
4886
|
VersionAdded: '0.14'
|
4839
|
-
VersionChanged: '1.
|
4887
|
+
VersionChanged: '1.61'
|
4840
4888
|
EnforcedStyle: exploded
|
4841
4889
|
SupportedStyles:
|
4842
4890
|
- compact # raise Exception.new(msg)
|
@@ -4977,10 +5025,11 @@ Style/RedundantHeredocDelimiterQuotes:
|
|
4977
5025
|
Style/RedundantInitialize:
|
4978
5026
|
Description: 'Checks for redundant `initialize` methods.'
|
4979
5027
|
Enabled: pending
|
5028
|
+
AutoCorrect: contextual
|
4980
5029
|
Safe: false
|
4981
5030
|
AllowComments: true
|
4982
5031
|
VersionAdded: '1.27'
|
4983
|
-
VersionChanged: '1.
|
5032
|
+
VersionChanged: '1.61'
|
4984
5033
|
|
4985
5034
|
Style/RedundantInterpolation:
|
4986
5035
|
Description: 'Checks for strings that are just an interpolated expression.'
|
@@ -17,7 +17,10 @@ module RuboCop
|
|
17
17
|
|
18
18
|
PHASE_1_OVERRIDDEN = '(skipped because the default Layout/LineLength:Max is overridden)'
|
19
19
|
PHASE_1_DISABLED = '(skipped because Layout/LineLength is disabled)'
|
20
|
-
|
20
|
+
PHASE_1_SKIPPED_ONLY_COPS =
|
21
|
+
'(skipped because a list of cops is passed to the `--only` flag)'
|
22
|
+
PHASE_1_SKIPPED_ONLY_EXCLUDE =
|
23
|
+
'(skipped because only excludes will be generated due to `--auto-gen-only-exclude` flag)'
|
21
24
|
|
22
25
|
def run
|
23
26
|
add_formatter
|
@@ -29,12 +32,14 @@ module RuboCop
|
|
29
32
|
private
|
30
33
|
|
31
34
|
def maybe_run_line_length_cop
|
32
|
-
if
|
35
|
+
if only_exclude?
|
36
|
+
skip_line_length_cop(PHASE_1_SKIPPED_ONLY_EXCLUDE)
|
37
|
+
elsif !line_length_enabled?(@config_store.for_pwd)
|
33
38
|
skip_line_length_cop(PHASE_1_DISABLED)
|
34
39
|
elsif !same_max_line_length?(@config_store.for_pwd, ConfigLoader.default_configuration)
|
35
40
|
skip_line_length_cop(PHASE_1_OVERRIDDEN)
|
36
41
|
elsif options_has_only_flag?
|
37
|
-
skip_line_length_cop(
|
42
|
+
skip_line_length_cop(PHASE_1_SKIPPED_ONLY_COPS)
|
38
43
|
else
|
39
44
|
run_line_length_cop
|
40
45
|
end
|
@@ -65,6 +70,10 @@ module RuboCop
|
|
65
70
|
@options[:only]
|
66
71
|
end
|
67
72
|
|
73
|
+
def only_exclude?
|
74
|
+
@options[:auto_gen_only_exclude]
|
75
|
+
end
|
76
|
+
|
68
77
|
# Do an initial run with only Layout/LineLength so that cops that
|
69
78
|
# depend on Layout/LineLength:Max get the correct value for that
|
70
79
|
# parameter.
|
@@ -7,11 +7,11 @@ module RuboCop
|
|
7
7
|
module Command
|
8
8
|
# Start Language Server Protocol of RuboCop.
|
9
9
|
# @api private
|
10
|
-
class
|
10
|
+
class LSP < Base
|
11
11
|
self.command_name = :lsp
|
12
12
|
|
13
13
|
def run
|
14
|
-
RuboCop::
|
14
|
+
RuboCop::LSP::Server.new(@config_store).start
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/rubocop/cli.rb
CHANGED
@@ -12,7 +12,7 @@ module RuboCop
|
|
12
12
|
STATUS_INTERRUPTED = Signal.list['INT'] + 128
|
13
13
|
DEFAULT_PARALLEL_OPTIONS = %i[
|
14
14
|
color config debug display_style_guide display_time display_only_fail_level_offenses
|
15
|
-
display_only_failed except extra_details fail_level fix_layout format
|
15
|
+
display_only_failed editor_mode except extra_details fail_level fix_layout format
|
16
16
|
ignore_disable_comments lint only only_guide_cops require safe
|
17
17
|
autocorrect safe_autocorrect autocorrect_all
|
18
18
|
].freeze
|
@@ -151,6 +151,7 @@ module RuboCop
|
|
151
151
|
|
152
152
|
def act_on_options
|
153
153
|
set_options_to_config_loader
|
154
|
+
handle_editor_mode
|
154
155
|
|
155
156
|
@config_store.options_config = @options[:config] if @options[:config]
|
156
157
|
@config_store.force_default_config! if @options[:force_default_config]
|
@@ -174,6 +175,10 @@ module RuboCop
|
|
174
175
|
ConfigLoader.ignore_unrecognized_cops = @options[:ignore_unrecognized_cops]
|
175
176
|
end
|
176
177
|
|
178
|
+
def handle_editor_mode
|
179
|
+
RuboCop::LSP.enable if @options[:editor_mode]
|
180
|
+
end
|
181
|
+
|
177
182
|
# rubocop:disable Metrics/CyclomaticComplexity
|
178
183
|
def handle_exiting_options
|
179
184
|
return unless Options::EXITING_OPTIONS.any? { |o| @options.key? o }
|