gitlab-styles 5.1.0 → 6.1.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/.gitlab-ci.yml +1 -1
- data/.gitlab/merge_request_templates/New Static Analysis Check.md +21 -0
- data/.rubocop.yml +5 -0
- data/Gemfile +1 -1
- data/gitlab-styles.gemspec +5 -5
- data/lib/gitlab/styles/rubocop.rb +3 -17
- data/lib/gitlab/styles/rubocop/cop/code_reuse/active_record.rb +0 -1
- data/lib/gitlab/styles/rubocop/cop/internal_affairs/deprecate_cop_helper.rb +43 -0
- data/lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb +124 -0
- data/lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/style/hash_transformation.rb +87 -0
- data/lib/gitlab/styles/version.rb +1 -1
- data/rubocop-default.yml +3 -0
- data/rubocop-layout.yml +3 -0
- data/rubocop-lint.yml +21 -0
- data/rubocop-performance.yml +12 -0
- data/rubocop-rails.yml +6 -0
- data/rubocop-style.yml +20 -0
- metadata +26 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ffdef3ce888f639822f2931093c590fa0ef9979fc38ec290f4a7b4a18393b55
|
4
|
+
data.tar.gz: d22d5faa3fbcafe4a899ad1f8315813a5b8dd0d2e9c0baa2aa80cfcf2c56f12a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31dc65dd2a632d76307e85f9350babbda6032e9934fa9a6a363a5aecab344ef744a741f5f69c185eea7826391cfea4ad5f02ccda540f35b3b0baf9cecf331e65
|
7
|
+
data.tar.gz: b39f7fead8a619e687543a451a31870b9f3c05f7c06e88b16e2d120c5ae28e71e33edbc333660ce5e8560daee737870f7049f7f2cde776ad21bfd092efab52b6
|
data/.gitlab-ci.yml
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
## Description of the proposal
|
2
|
+
|
3
|
+
<!--
|
4
|
+
Please describe the proposal and add a link to the source (for example, http://www.betterspecs.org/).
|
5
|
+
-->
|
6
|
+
|
7
|
+
### Check-list
|
8
|
+
|
9
|
+
- [ ] Mention this proposal in the relevant Slack channels (e.g. `#development`, `#backend`, `#frontend`)
|
10
|
+
- [ ] If there is a choice to make between two potential styles, set up an emoji vote in the MR:
|
11
|
+
- CHOICE_A: :a:
|
12
|
+
- CHOICE_B: :b:
|
13
|
+
- Vote yourself for both choices so that people know these are the choices
|
14
|
+
- [ ] The MR doesn't have significant objections, and is getting a majority of :+1: vs :-1: (remember that [we don't need to reach a consensus](https://about.gitlab.com/handbook/values/#collaboration-is-not-consensus))
|
15
|
+
- [ ] (If applicable) One style is getting a majority of vote (compared to the other choice)
|
16
|
+
- [ ] (If applicable) Update the MR with the chosen style
|
17
|
+
- [ ] Follow the [review process](https://docs.gitlab.com/ee/development/code_review.html) as usual
|
18
|
+
|
19
|
+
/label ~"Engineering Productivity" ~"development guidelines" ~"static code analysis"
|
20
|
+
|
21
|
+
/cc @gitlab-org/maintainers/rails-backend
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/gitlab-styles.gemspec
CHANGED
@@ -22,13 +22,13 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_dependency 'rubocop', '~> 0.
|
26
|
-
spec.add_dependency 'rubocop-gitlab-security', '~> 0.1.
|
27
|
-
spec.add_dependency 'rubocop-performance', '~> 1.
|
28
|
-
spec.add_dependency 'rubocop-rails', '~> 2.
|
25
|
+
spec.add_dependency 'rubocop', '~> 0.91', '>= 0.91.1'
|
26
|
+
spec.add_dependency 'rubocop-gitlab-security', '~> 0.1.1'
|
27
|
+
spec.add_dependency 'rubocop-performance', '~> 1.9.2'
|
28
|
+
spec.add_dependency 'rubocop-rails', '~> 2.9'
|
29
29
|
spec.add_dependency 'rubocop-rspec', '~> 1.44'
|
30
30
|
|
31
|
-
spec.add_development_dependency 'bundler', '~> 1
|
31
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
32
32
|
spec.add_development_dependency 'rake', '~> 10.0'
|
33
33
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
34
|
end
|
@@ -1,22 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
require
|
6
|
-
require 'gitlab/styles/rubocop/cop/redirect_with_status'
|
7
|
-
require 'gitlab/styles/rubocop/cop/polymorphic_associations'
|
8
|
-
require 'gitlab/styles/rubocop/cop/active_record_dependent'
|
9
|
-
require 'gitlab/styles/rubocop/cop/in_batches'
|
10
|
-
require 'gitlab/styles/rubocop/cop/line_break_after_guard_clauses'
|
11
|
-
require 'gitlab/styles/rubocop/cop/line_break_around_conditional_block'
|
12
|
-
require 'gitlab/styles/rubocop/cop/code_reuse/active_record'
|
13
|
-
require 'gitlab/styles/rubocop/cop/migration/update_large_table'
|
14
|
-
require 'gitlab/styles/rubocop/cop/without_reactive_cache'
|
15
|
-
require 'gitlab/styles/rubocop/cop/rspec/single_line_hook'
|
16
|
-
require 'gitlab/styles/rubocop/cop/rspec/have_link_parameters'
|
17
|
-
require 'gitlab/styles/rubocop/cop/rspec/verbose_include_metadata'
|
18
|
-
require 'gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example'
|
19
|
-
require 'gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block'
|
3
|
+
# Auto-require all cops under `gitlab/styles/rubocop/cop/**/*.rb`
|
4
|
+
cops_glob = File.join(__dir__, 'rubocop', 'cop', '**', '*.rb')
|
5
|
+
Dir[cops_glob].sort.each { |cop| require(cop) }
|
20
6
|
|
21
7
|
module Gitlab
|
22
8
|
module Styles
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module Styles
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
module InternalAffairs
|
8
|
+
# Cop that denies the use of CopHelper.
|
9
|
+
class DeprecateCopHelper < RuboCop::Cop::Cop
|
10
|
+
MSG = 'Do not use `CopHelper` or methods from it, use improved patterns described in https://www.rubydoc.info/gems/rubocop/RuboCop/RSpec/ExpectOffense'
|
11
|
+
|
12
|
+
def_node_matcher :cop_helper, <<~PATTERN
|
13
|
+
(send nil? ${:include :extend :prepend}
|
14
|
+
(const _ {:CopHelper}))
|
15
|
+
PATTERN
|
16
|
+
|
17
|
+
def_node_search :cop_helper_method, <<~PATTERN
|
18
|
+
(send nil? {:inspect_source :inspect_source_file :parse_source :autocorrect_source_file :autocorrect_source :_investigate} ...)
|
19
|
+
PATTERN
|
20
|
+
|
21
|
+
def_node_search :cop_helper_method_on_instance, <<~PATTERN
|
22
|
+
(send (send nil? _) {:messages :highlights :offenses} ...)
|
23
|
+
PATTERN
|
24
|
+
|
25
|
+
def on_send(node)
|
26
|
+
cop_helper(node) do
|
27
|
+
add_offense(node)
|
28
|
+
end
|
29
|
+
|
30
|
+
cop_helper_method(node) do
|
31
|
+
add_offense(node)
|
32
|
+
end
|
33
|
+
|
34
|
+
cop_helper_method_on_instance(node) do
|
35
|
+
add_offense(node)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop-rspec'
|
4
|
+
require_relative 'base'
|
5
|
+
|
6
|
+
module Gitlab
|
7
|
+
module Styles
|
8
|
+
module Rubocop
|
9
|
+
module Cop
|
10
|
+
module RSpec
|
11
|
+
# Checks for common mistakes in example descriptions.
|
12
|
+
#
|
13
|
+
# This cop will correct docstrings that begin/end with space or words that start with a capital letter.
|
14
|
+
#
|
15
|
+
# @see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46336#note_442669518
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# # bad
|
19
|
+
# it 'Does something' do
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# # good
|
23
|
+
# it 'does nothing' do
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# # bad
|
28
|
+
# it ' does something' do
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# # good
|
32
|
+
# it 'does something' do
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# # bad
|
37
|
+
# it 'does something ' do
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# # good
|
41
|
+
# it 'does something' do
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# # bad
|
46
|
+
# it ' does something ' do
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# # good
|
50
|
+
# it 'does something' do
|
51
|
+
# end
|
52
|
+
class ExampleStartingCharacter < Base
|
53
|
+
extend RuboCop::Cop::AutoCorrector
|
54
|
+
|
55
|
+
MSG = 'Only start words with lowercase alpha with no leading/trailing spaces when describing your tests.'
|
56
|
+
|
57
|
+
def_node_matcher :it_description, <<-PATTERN
|
58
|
+
(block (send _ :it ${
|
59
|
+
(str $_)
|
60
|
+
(dstr (str $_ ) ...)
|
61
|
+
} ...) ...)
|
62
|
+
PATTERN
|
63
|
+
|
64
|
+
def on_block(node)
|
65
|
+
it_description(node) do |description_node, _message|
|
66
|
+
add_wording_offense(description_node, MSG) if invalid_description?(text(description_node))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def add_wording_offense(node, message)
|
73
|
+
docstring = docstring(node)
|
74
|
+
add_offense(docstring, message: message) do |corrector|
|
75
|
+
corrector.replace(docstring, replacement_text(node))
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def docstring(node)
|
80
|
+
expr = node.loc.expression
|
81
|
+
|
82
|
+
Parser::Source::Range.new(
|
83
|
+
expr.source_buffer,
|
84
|
+
expr.begin_pos + 1,
|
85
|
+
expr.end_pos - 1
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
def invalid_description?(message)
|
90
|
+
message.match?(/(^([A-Z]{1}[a-z]+\s|\s)|\s$)/)
|
91
|
+
end
|
92
|
+
|
93
|
+
def replacement_text(node)
|
94
|
+
text = text(node)
|
95
|
+
|
96
|
+
text.strip!
|
97
|
+
|
98
|
+
text = downcase_first_letter(text) if invalid_description?(text)
|
99
|
+
|
100
|
+
text
|
101
|
+
end
|
102
|
+
|
103
|
+
# Recursive processing is required to process nested dstr nodes
|
104
|
+
# that is the case for \-separated multiline strings with interpolation.
|
105
|
+
def text(node)
|
106
|
+
case node.type
|
107
|
+
when :dstr
|
108
|
+
node.node_parts.map { |child_node| text(child_node) }.join
|
109
|
+
when :str
|
110
|
+
node.value
|
111
|
+
when :begin
|
112
|
+
node.source
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def downcase_first_letter(str)
|
117
|
+
str[0].downcase + str[1..]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module Styles
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
module Style
|
8
|
+
# This cop identifies places where `map { ... }.to_h` or
|
9
|
+
# `Hash[map { ... }]` can be replaced with `to_h { ... }`,
|
10
|
+
# saving an intermediate array allocation.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# # bad
|
14
|
+
# hash.map { |k, v| [v.upcase, k.downcase] }.to_h
|
15
|
+
# hash.collect { |k, v| [v.upcase, k.downcase] }.to_h
|
16
|
+
# Hash[hash.map { |k, v| [v.upcase, k.downcase] }]
|
17
|
+
# Hash[hash.collect { |k, v| [v.upcase, k.downcase] }]
|
18
|
+
# array.map { |x| [x, x + 1] }.to_h
|
19
|
+
#
|
20
|
+
# # good
|
21
|
+
# hash.to_h { |k, v| [v.upcase, k.downcase] }
|
22
|
+
# array.to_h { |x| [x, x + 1] }
|
23
|
+
#
|
24
|
+
# Full credit: https://github.com/eugeneius/rubocop-performance/blob/hash_transformation/lib/rubocop/cop/performance/hash_transformation.rb
|
25
|
+
class HashTransformation < RuboCop::Cop::Cop
|
26
|
+
include RuboCop::Cop::RangeHelp
|
27
|
+
|
28
|
+
MSG = 'Use `to_h { ... }` instead of `%<current>s`.'
|
29
|
+
|
30
|
+
def_node_matcher :to_h_candidate?, <<~PATTERN
|
31
|
+
{
|
32
|
+
[(send
|
33
|
+
$(block $(send _ {:map :collect}) ...) :to_h) !block_literal?]
|
34
|
+
(send (const nil? :Hash) :[]
|
35
|
+
$(block $(send _ {:map :collect}) ...))
|
36
|
+
}
|
37
|
+
PATTERN
|
38
|
+
|
39
|
+
def on_send(node)
|
40
|
+
to_h_candidate?(node) do |_block, call|
|
41
|
+
range = offense_range(node, call)
|
42
|
+
message = message(node, call)
|
43
|
+
add_offense(node, location: range, message: message)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def autocorrect(node)
|
48
|
+
block, call = to_h_candidate?(node)
|
49
|
+
|
50
|
+
lambda do |corrector|
|
51
|
+
corrector.remove(after_block(node, block))
|
52
|
+
corrector.replace(call.loc.selector, 'to_h')
|
53
|
+
corrector.remove(before_block(node, block))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def offense_range(node, call)
|
60
|
+
return node.source_range if node.children.first.const_type?
|
61
|
+
|
62
|
+
range_between(call.loc.selector.begin_pos, node.loc.selector.end_pos)
|
63
|
+
end
|
64
|
+
|
65
|
+
def message(node, call)
|
66
|
+
current = if node.children.first.const_type?
|
67
|
+
"Hash[#{call.method_name} { ... }]"
|
68
|
+
else
|
69
|
+
"#{call.method_name} { ... }.to_h"
|
70
|
+
end
|
71
|
+
|
72
|
+
format(MSG, current: current)
|
73
|
+
end
|
74
|
+
|
75
|
+
def after_block(node, block)
|
76
|
+
block.source_range.end.join(node.source_range.end)
|
77
|
+
end
|
78
|
+
|
79
|
+
def before_block(node, block)
|
80
|
+
node.source_range.begin.join(block.source_range.begin)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/rubocop-default.yml
CHANGED
data/rubocop-layout.yml
CHANGED
data/rubocop-lint.yml
CHANGED
@@ -28,6 +28,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
28
28
|
Lint/CircularArgumentReference:
|
29
29
|
Enabled: true
|
30
30
|
|
31
|
+
Lint/ConstantDefinitionInBlock: # (new in 0.91)
|
32
|
+
Enabled: true
|
33
|
+
|
31
34
|
# Check for debugger calls.
|
32
35
|
Lint/Debugger:
|
33
36
|
Enabled: true
|
@@ -47,6 +50,9 @@ Lint/DeprecatedOpenSSLConstant:
|
|
47
50
|
Lint/DuplicateElsifCondition:
|
48
51
|
Enabled: true
|
49
52
|
|
53
|
+
Lint/DuplicateRequire: # (new in 0.90)
|
54
|
+
Enabled: true
|
55
|
+
|
50
56
|
# Checks that there are no repeated exceptions used in 'rescue' expressions.
|
51
57
|
# https://docs.rubocop.org/rubocop/0.89/cops_lint.html#lintduplicaterescueexception
|
52
58
|
Lint/DuplicateRescueException:
|
@@ -69,6 +75,9 @@ Lint/EmptyConditionalBody:
|
|
69
75
|
Lint/EmptyEnsure:
|
70
76
|
Enabled: true
|
71
77
|
|
78
|
+
Lint/EmptyFile: # (new in 0.90)
|
79
|
+
Enabled: true
|
80
|
+
|
72
81
|
# Checks for the presence of `when` branches without a body.
|
73
82
|
Lint/EmptyWhen:
|
74
83
|
Enabled: true
|
@@ -94,6 +103,9 @@ Lint/FloatOutOfRange:
|
|
94
103
|
Lint/FormatParameterMismatch:
|
95
104
|
Enabled: true
|
96
105
|
|
106
|
+
Lint/IdentityComparison: # (new in 0.91)
|
107
|
+
Enabled: true
|
108
|
+
|
97
109
|
# Checks for adjacent string literals on the same line, which could better be
|
98
110
|
# represented as a single string literal.
|
99
111
|
Lint/ImplicitStringConcatenation:
|
@@ -200,6 +212,9 @@ Lint/SuppressedException:
|
|
200
212
|
Lint/TopLevelReturnWithArgument:
|
201
213
|
Enabled: true
|
202
214
|
|
215
|
+
Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
|
216
|
+
Enabled: true
|
217
|
+
|
203
218
|
# Do not use prefix `_` for a variable that is used.
|
204
219
|
Lint/UnderscorePrefixedVariableName:
|
205
220
|
Enabled: true
|
@@ -238,10 +253,16 @@ Lint/UselessAssignment:
|
|
238
253
|
Lint/UselessElseWithoutRescue:
|
239
254
|
Enabled: true
|
240
255
|
|
256
|
+
Lint/UselessMethodDefinition: # (new in 0.90)
|
257
|
+
Enabled: true
|
258
|
+
|
241
259
|
# Checks for useless setter call to a local variable.
|
242
260
|
Lint/UselessSetterCall:
|
243
261
|
Enabled: true
|
244
262
|
|
263
|
+
Lint/UselessTimes: # (new in 0.91)
|
264
|
+
Enabled: true
|
265
|
+
|
245
266
|
# Possible use of operator/literal/variable in void context.
|
246
267
|
Lint/Void:
|
247
268
|
Enabled: true
|
data/rubocop-performance.yml
CHANGED
@@ -10,6 +10,9 @@ Performance/AncestorsInclude:
|
|
10
10
|
Performance/BigDecimalWithNumericArgument:
|
11
11
|
Enabled: true
|
12
12
|
|
13
|
+
Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
|
14
|
+
Enabled: true
|
15
|
+
|
13
16
|
# Use `caller(n..n)` instead of `caller`.
|
14
17
|
Performance/Caller:
|
15
18
|
Enabled: false
|
@@ -18,11 +21,20 @@ Performance/Caller:
|
|
18
21
|
Performance/Casecmp:
|
19
22
|
Enabled: true
|
20
23
|
|
24
|
+
Performance/CollectionLiteralInLoop: # (new in 1.8)
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
Performance/ConstantRegexp: # (new in 1.9)
|
28
|
+
Enabled: true
|
29
|
+
|
21
30
|
# Use `str.{start,end}_with?(x, ..., y, ...)` instead of
|
22
31
|
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
23
32
|
Performance/DoubleStartEndWith:
|
24
33
|
Enabled: true
|
25
34
|
|
35
|
+
Performance/MethodObjectAsBlock: # (new in 1.9)
|
36
|
+
Enabled: true
|
37
|
+
|
26
38
|
# Use `Range#cover?` instead of `Range#include?`.
|
27
39
|
Performance/RangeInclude:
|
28
40
|
Enabled: true
|
data/rubocop-rails.yml
CHANGED
@@ -24,6 +24,9 @@ Rails/AfterCommitOverride:
|
|
24
24
|
Rails/ApplicationRecord:
|
25
25
|
Enabled: false
|
26
26
|
|
27
|
+
Rails/AttributeDefaultBlockValue: # (new in 2.9)
|
28
|
+
Enabled: true
|
29
|
+
|
27
30
|
# Enforce using `blank?` and `present?`.
|
28
31
|
Rails/Blank:
|
29
32
|
Enabled: false
|
@@ -168,6 +171,9 @@ Rails/TimeZone:
|
|
168
171
|
Rails/Validation:
|
169
172
|
Enabled: true
|
170
173
|
|
174
|
+
Rails/WhereEquals: # (new in 2.9)
|
175
|
+
Enabled: true
|
176
|
+
|
171
177
|
# Enforces consistent style when using exists?.
|
172
178
|
# https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswhereexists
|
173
179
|
Rails/WhereExists:
|
data/rubocop-style.yml
CHANGED
@@ -13,6 +13,7 @@ Style/Alias:
|
|
13
13
|
# or completely (always).
|
14
14
|
Style/AndOr:
|
15
15
|
Enabled: true
|
16
|
+
EnforcedStyle: always
|
16
17
|
|
17
18
|
# Enforces the use of Array() instead of explicit Array check or [*var]
|
18
19
|
# https://docs.rubocop.org/rubocop/0.89/cops_style.html#stylearraycoercion
|
@@ -83,6 +84,9 @@ Style/ClassVars:
|
|
83
84
|
Style/ColonMethodCall:
|
84
85
|
Enabled: true
|
85
86
|
|
87
|
+
Style/CombinableLoops: # (new in 0.90)
|
88
|
+
Enabled: true
|
89
|
+
|
86
90
|
# This cop checks that comment annotation keywords are written according
|
87
91
|
# to guidelines.
|
88
92
|
Style/CommentAnnotation:
|
@@ -183,6 +187,13 @@ Style/HashTransformKeys:
|
|
183
187
|
Style/HashTransformValues:
|
184
188
|
Enabled: true
|
185
189
|
|
190
|
+
|
191
|
+
# This cop identifies places where `map { ... }.to_h` or
|
192
|
+
# `Hash[map { ... }]` can be replaced with `to_h { ... }`,
|
193
|
+
# saving an intermediate array allocation.
|
194
|
+
Style/HashTransformation:
|
195
|
+
Enabled: true
|
196
|
+
|
186
197
|
# Checks that conditional statements do not have an identical line at the
|
187
198
|
# end of each branch, which can validly be moved out of the conditional.
|
188
199
|
Style/IdenticalConditionalBranches:
|
@@ -201,6 +212,9 @@ Style/InfiniteLoop:
|
|
201
212
|
Style/InverseMethods:
|
202
213
|
Enabled: false
|
203
214
|
|
215
|
+
Style/KeywordParametersOrder: # (new in 0.90)
|
216
|
+
Enabled: true
|
217
|
+
|
204
218
|
# Use lambda.call(...) instead of lambda.(...).
|
205
219
|
Style/LambdaCall:
|
206
220
|
Enabled: true
|
@@ -334,6 +348,9 @@ Style/RedundantRegexpCharacterClass:
|
|
334
348
|
Style/RedundantRegexpEscape:
|
335
349
|
Enabled: true
|
336
350
|
|
351
|
+
Style/RedundantSelfAssignment: # (new in 0.90)
|
352
|
+
Enabled: true
|
353
|
+
|
337
354
|
# Use `sort` instead of `sort_by { |x| x }`.
|
338
355
|
Style/RedundantSortBy:
|
339
356
|
Enabled: true
|
@@ -357,6 +374,9 @@ Style/SignalException:
|
|
357
374
|
Style/SlicingWithRange:
|
358
375
|
Enabled: true
|
359
376
|
|
377
|
+
Style/SoleNestedConditional: # (new in 0.89)
|
378
|
+
Enabled: true
|
379
|
+
|
360
380
|
# Check for the usage of parentheses around stabby lambda arguments.
|
361
381
|
Style/StabbyLambdaParentheses:
|
362
382
|
EnforcedStyle: require_parentheses
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-styles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,56 +16,62 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.91'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.91.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
29
|
+
version: '0.91'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.91.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rubocop-gitlab-security
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
39
|
+
version: 0.1.1
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.
|
46
|
+
version: 0.1.1
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rubocop-performance
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
53
|
+
version: 1.9.2
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
60
|
+
version: 1.9.2
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rubocop-rails
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
67
|
+
version: '2.9'
|
62
68
|
type: :runtime
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2.
|
74
|
+
version: '2.9'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rubocop-rspec
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +92,14 @@ dependencies:
|
|
86
92
|
requirements:
|
87
93
|
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1
|
95
|
+
version: '2.1'
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
100
|
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1
|
102
|
+
version: '2.1'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: rake
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +128,7 @@ dependencies:
|
|
122
128
|
- - "~>"
|
123
129
|
- !ruby/object:Gem::Version
|
124
130
|
version: '3.0'
|
125
|
-
description:
|
131
|
+
description:
|
126
132
|
email:
|
127
133
|
- gitlab_rubygems@gitlab.com
|
128
134
|
executables: []
|
@@ -132,6 +138,7 @@ files:
|
|
132
138
|
- ".editorconfig"
|
133
139
|
- ".gitignore"
|
134
140
|
- ".gitlab-ci.yml"
|
141
|
+
- ".gitlab/merge_request_templates/New Static Analysis Check.md"
|
135
142
|
- ".gitlab/merge_request_templates/Release.md"
|
136
143
|
- ".rspec"
|
137
144
|
- ".rubocop.yml"
|
@@ -152,6 +159,7 @@ files:
|
|
152
159
|
- lib/gitlab/styles/rubocop/cop/custom_error_class.rb
|
153
160
|
- lib/gitlab/styles/rubocop/cop/gem_fetcher.rb
|
154
161
|
- lib/gitlab/styles/rubocop/cop/in_batches.rb
|
162
|
+
- lib/gitlab/styles/rubocop/cop/internal_affairs/deprecate_cop_helper.rb
|
155
163
|
- lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb
|
156
164
|
- lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb
|
157
165
|
- lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb
|
@@ -160,9 +168,11 @@ files:
|
|
160
168
|
- lib/gitlab/styles/rubocop/cop/rspec/base.rb
|
161
169
|
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb
|
162
170
|
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb
|
171
|
+
- lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb
|
163
172
|
- lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb
|
164
173
|
- lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb
|
165
174
|
- lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb
|
175
|
+
- lib/gitlab/styles/rubocop/cop/style/hash_transformation.rb
|
166
176
|
- lib/gitlab/styles/rubocop/cop/without_reactive_cache.rb
|
167
177
|
- lib/gitlab/styles/rubocop/migration_helpers.rb
|
168
178
|
- lib/gitlab/styles/rubocop/model_helpers.rb
|
@@ -187,7 +197,7 @@ homepage: https://gitlab.com/gitlab-org/gitlab-styles
|
|
187
197
|
licenses:
|
188
198
|
- MIT
|
189
199
|
metadata: {}
|
190
|
-
post_install_message:
|
200
|
+
post_install_message:
|
191
201
|
rdoc_options: []
|
192
202
|
require_paths:
|
193
203
|
- lib
|
@@ -203,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
213
|
version: '0'
|
204
214
|
requirements: []
|
205
215
|
rubygems_version: 3.1.4
|
206
|
-
signing_key:
|
216
|
+
signing_key:
|
207
217
|
specification_version: 4
|
208
218
|
summary: GitLab style guides and shared style configs.
|
209
219
|
test_files: []
|