gitlab-styles 14.0.0 → 15.0.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 +2 -3
- data/.rubocop.yml +2 -23
- data/.rubocop_todo.yml +2 -11
- data/Gemfile.lock +243 -132
- data/README.md +21 -10
- data/gitlab-styles.gemspec +21 -22
- data/lib/gitlab/styles/rubocop/rspec.rb +4 -0
- data/lib/gitlab/styles/rubocop.rb +6 -3
- data/lib/gitlab/styles/version.rb +1 -1
- data/lib/rubocop/cop/avoid_return_from_blocks.rb +4 -3
- data/lib/rubocop/cop/gitlab_security/deep_munge.rb +10 -0
- data/lib/rubocop/cop/internal_affairs/use_restrict_on_send.rb +17 -16
- data/lib/rubocop/cop/line_break_around_conditional_block.rb +30 -30
- data/lib/rubocop/cop/migration/update_large_table.rb +24 -1
- data/lib/rubocop/cop/rspec/base.rb +1 -0
- data/lib/rubocop/cop/rspec/empty_line_after_let_block.rb +1 -0
- data/lib/rubocop/cop/rspec/empty_line_after_shared_example.rb +3 -2
- data/lib/rubocop/cop/rspec/example_starting_character.rb +3 -4
- data/lib/rubocop/cop/rspec/feature_spec_max_examples.rb +46 -0
- data/lib/rubocop/cop/rspec/single_line_hook.rb +1 -0
- data/rubocop-all.yml +1 -1
- data/rubocop-capybara.yml +1 -2
- data/rubocop-code_reuse.yml +1 -1
- data/rubocop-default.yml +0 -3
- data/rubocop-factory_bot.yml +1 -2
- data/rubocop-fips.yml +3 -1
- data/rubocop-graphql.yml +1 -1
- data/rubocop-internal-affairs.yml +4 -1
- data/rubocop-layout.yml +6 -1
- data/rubocop-migrations.yml +1 -1
- data/rubocop-performance.yml +3 -8
- data/rubocop-rails.yml +8 -2
- data/rubocop-rspec.yml +25 -2
- data/rubocop-security.yml +7 -1
- data/rubocop-style.yml +4 -1
- data/rubocop-tailwind.yml +2 -1
- metadata +43 -57
- data/lib/rubocop/cop/line_break_after_guard_clauses.rb +0 -99
- data/lib/rubocop/cop/style/open_struct_use.rb +0 -49
data/gitlab-styles.gemspec
CHANGED
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
require 'gitlab/styles/version'
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.required_ruby_version = '>= 3.
|
|
8
|
+
spec.required_ruby_version = '>= 3.3'
|
|
9
9
|
spec.name = 'gitlab-styles'
|
|
10
10
|
spec.version = Gitlab::Styles::VERSION
|
|
11
11
|
spec.authors = ['GitLab']
|
|
@@ -16,31 +16,30 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
spec.license = 'MIT'
|
|
17
17
|
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
19
|
-
f.match(%r{^(docs|test|spec|features
|
|
19
|
+
f.match(%r{^(docs|test|spec|features)/})
|
|
20
20
|
end
|
|
21
21
|
spec.bindir = 'exe'
|
|
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', '1.
|
|
26
|
-
spec.add_dependency 'rubocop-capybara', '
|
|
27
|
-
spec.add_dependency 'rubocop-factory_bot', '2.
|
|
28
|
-
spec.add_dependency 'rubocop-graphql', '1.
|
|
29
|
-
spec.add_dependency 'rubocop-performance', '1.
|
|
30
|
-
spec.add_dependency 'rubocop-rails', '2.
|
|
31
|
-
spec.add_dependency 'rubocop-rspec', '3.
|
|
32
|
-
spec.add_dependency 'rubocop-rspec_rails', '2.
|
|
25
|
+
spec.add_dependency 'rubocop', '1.92.1'
|
|
26
|
+
spec.add_dependency 'rubocop-capybara', '3.1.0'
|
|
27
|
+
spec.add_dependency 'rubocop-factory_bot', '2.28.0'
|
|
28
|
+
spec.add_dependency 'rubocop-graphql', '1.8.0'
|
|
29
|
+
spec.add_dependency 'rubocop-performance', '1.27.0'
|
|
30
|
+
spec.add_dependency 'rubocop-rails', '2.38.0'
|
|
31
|
+
spec.add_dependency 'rubocop-rspec', '3.10.2'
|
|
32
|
+
spec.add_dependency 'rubocop-rspec_rails', '2.33.0'
|
|
33
33
|
|
|
34
|
-
spec.add_development_dependency 'bundler', '~>
|
|
35
|
-
spec.add_development_dependency 'gitlab-dangerfiles', '~> 4.
|
|
36
|
-
spec.add_development_dependency 'lefthook', '~>
|
|
37
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.
|
|
38
|
-
spec.add_development_dependency 'rake', '~> 13.
|
|
39
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
|
40
|
-
spec.add_development_dependency 'rspec-parameterized-table_syntax', '~> 1
|
|
41
|
-
spec.add_development_dependency 'rubocop-rake', '~> 0.
|
|
42
|
-
spec.add_development_dependency 'simplecov', '~>
|
|
43
|
-
spec.add_development_dependency 'simplecov-cobertura', '~>
|
|
44
|
-
spec.add_development_dependency '
|
|
45
|
-
spec.add_development_dependency 'test_file_finder', '~> 0.1.4'
|
|
34
|
+
spec.add_development_dependency 'bundler', '~> 4.0'
|
|
35
|
+
spec.add_development_dependency 'gitlab-dangerfiles', '~> 4.14.0'
|
|
36
|
+
spec.add_development_dependency 'lefthook', '~> 2.2'
|
|
37
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.12'
|
|
38
|
+
spec.add_development_dependency 'rake', '~> 13.4'
|
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.13'
|
|
40
|
+
spec.add_development_dependency 'rspec-parameterized-table_syntax', '~> 2.1'
|
|
41
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.7'
|
|
42
|
+
spec.add_development_dependency 'simplecov', '~> 1.3'
|
|
43
|
+
spec.add_development_dependency 'simplecov-cobertura', '~> 4.0'
|
|
44
|
+
spec.add_development_dependency 'test_file_finder', '~> 0.3'
|
|
46
45
|
end
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Auto-require all cops under `rubocop/cop/**/*.rb
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
# Auto-require all cops under `rubocop/cop/**/*.rb`, except the RSpec cops, which need rubocop-rspec.
|
|
4
|
+
# The rubocop-*.yml configs don't use this: each requires only the cops it configures, and
|
|
5
|
+
# `rubocop-rspec.yml` loads the RSpec cops through `gitlab/styles/rubocop/rspec`.
|
|
6
|
+
cops_dir = File.expand_path('../../rubocop/cop', __dir__)
|
|
7
|
+
rspec_cops_dir = File.join(cops_dir, 'rspec')
|
|
8
|
+
Dir[File.join(cops_dir, '**', '*.rb')].each { |cop| require(cop) unless cop.start_with?("#{rspec_cops_dir}/") }
|
|
6
9
|
|
|
7
10
|
module Gitlab
|
|
8
11
|
module Styles
|
|
@@ -39,6 +39,7 @@ module Rubocop
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
alias_method :on_numblock, :on_block
|
|
42
|
+
alias_method :on_itblock, :on_block
|
|
42
43
|
|
|
43
44
|
private
|
|
44
45
|
|
|
@@ -47,7 +48,7 @@ module Rubocop
|
|
|
47
48
|
top_block = nil
|
|
48
49
|
|
|
49
50
|
while current_node && current_node.type != :def
|
|
50
|
-
top_block = current_node if current_node.
|
|
51
|
+
top_block = current_node if current_node.any_block_type?
|
|
51
52
|
current_node = current_node.parent
|
|
52
53
|
end
|
|
53
54
|
|
|
@@ -58,7 +59,7 @@ module Rubocop
|
|
|
58
59
|
blocks = []
|
|
59
60
|
|
|
60
61
|
until node == current_node || def?(current_node)
|
|
61
|
-
blocks << current_node if current_node.
|
|
62
|
+
blocks << current_node if current_node.any_block_type?
|
|
62
63
|
current_node = current_node.parent
|
|
63
64
|
end
|
|
64
65
|
|
|
@@ -67,7 +68,7 @@ module Rubocop
|
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
def def?(node)
|
|
70
|
-
node.any_def_type? || (node.
|
|
71
|
+
node.any_def_type? || (node.any_block_type? && DEF_METHODS.include?(node.method_name))
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
def allowed?(block_node)
|
|
@@ -13,7 +13,17 @@ module RuboCop
|
|
|
13
13
|
# # bad
|
|
14
14
|
# config.action_dispatch.perform_deep_munge = false
|
|
15
15
|
#
|
|
16
|
+
# # bad
|
|
17
|
+
# config.action_dispatch.perform_deep_munge = !true
|
|
18
|
+
#
|
|
19
|
+
# # good
|
|
20
|
+
# config.action_dispatch.perform_deep_munge = true
|
|
21
|
+
#
|
|
22
|
+
# # good
|
|
23
|
+
# # Deep munge is not explicitly disabled
|
|
24
|
+
#
|
|
16
25
|
# See CVE-2012-2660, CVE-2012-2694, and CVE-2013-0155.
|
|
26
|
+
|
|
17
27
|
class DeepMunge < RuboCop::Cop::Base
|
|
18
28
|
MSG = 'Never disable the deep munge security option.'
|
|
19
29
|
|
|
@@ -45,37 +45,35 @@ module RuboCop
|
|
|
45
45
|
MSG = 'Define constant `RESTRICT_ON_SEND` to speed up calls to `on_send`. ' \
|
|
46
46
|
'The following line is then no longer necessary:'
|
|
47
47
|
|
|
48
|
-
# @!method method_name_plain(node)
|
|
48
|
+
# @!method method_name_plain(node, send_param)
|
|
49
49
|
def_node_matcher :method_name_plain, <<~PATTERN
|
|
50
50
|
{
|
|
51
|
-
(send _ :method_name
|
|
52
|
-
(send
|
|
53
|
-
(send _ :children) :[] (int 1) # node.children[1]
|
|
54
|
-
)
|
|
51
|
+
(send _ :method_name (lvar %1) ...) # method_name(on_send_param)
|
|
52
|
+
(send (send (lvar %1) :children) :[] (int 1)) # on_send_param.children[1]
|
|
55
53
|
}
|
|
56
54
|
PATTERN
|
|
57
55
|
|
|
58
|
-
# @!method method_name_call(node)
|
|
56
|
+
# @!method method_name_call(node, send_param, local_assignments)
|
|
59
57
|
def_node_matcher :method_name_call, <<~PATTERN
|
|
60
58
|
{
|
|
61
|
-
#method_name_plain
|
|
62
|
-
(lvar %
|
|
59
|
+
#method_name_plain(%1) # direct method_name/children[1] call on the on_send param
|
|
60
|
+
(lvar %2) # local variable previously assigned from such a call
|
|
63
61
|
}
|
|
64
62
|
PATTERN
|
|
65
63
|
|
|
66
|
-
# @!method method_name_assignment(node)
|
|
64
|
+
# @!method method_name_assignment(node, send_param)
|
|
67
65
|
def_node_search :method_name_assignment, <<~PATTERN
|
|
68
|
-
(lvasgn $
|
|
66
|
+
(lvasgn $_ #method_name_plain(%1))
|
|
69
67
|
PATTERN
|
|
70
68
|
|
|
71
|
-
# @!method method_name_check(node)
|
|
69
|
+
# @!method method_name_check(node, send_param, local_assignments)
|
|
72
70
|
def_node_search :method_name_check, <<~PATTERN
|
|
73
71
|
(if
|
|
74
72
|
${
|
|
75
|
-
(send #method_name_call(%1) {:== :!=} _) # method_name(
|
|
76
|
-
(send _ :include? #method_name_call(%1)) # a.include?(method_name(
|
|
73
|
+
(send #method_name_call(%1, %2) {:== :!=} _) # method_name(on_send_param) == foo
|
|
74
|
+
(send _ :include? #method_name_call(%1, %2)) # a.include?(method_name(on_send_param))
|
|
77
75
|
}
|
|
78
|
-
{!nil? nil? | nil? !nil?}
|
|
76
|
+
{!nil? nil? | nil? !nil?} # has either `if` or `else` branch - not both
|
|
79
77
|
)
|
|
80
78
|
PATTERN
|
|
81
79
|
|
|
@@ -83,9 +81,12 @@ module RuboCop
|
|
|
83
81
|
return unless node.method?(:on_send)
|
|
84
82
|
return if @restrict_on_send_set
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
send_param = node.first_argument&.name
|
|
85
|
+
return unless send_param
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
local_assignments = method_name_assignment(node, send_param).to_set
|
|
88
|
+
|
|
89
|
+
method_name_check(node, send_param, local_assignments) do |call_node|
|
|
89
90
|
add_offense(call_node)
|
|
90
91
|
end
|
|
91
92
|
end
|
|
@@ -5,43 +5,43 @@ module Rubocop
|
|
|
5
5
|
# Ensures a line break around conditional blocks.
|
|
6
6
|
#
|
|
7
7
|
# @example
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
8
|
+
# # bad
|
|
9
|
+
# do_something
|
|
10
|
+
# if condition
|
|
11
|
+
# do_extra_stuff
|
|
12
|
+
# end
|
|
13
|
+
# do_something_more
|
|
14
14
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
15
|
+
# # good
|
|
16
|
+
# do_something
|
|
17
17
|
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
18
|
+
# if condition
|
|
19
|
+
# do_extra_stuff
|
|
20
|
+
# end
|
|
21
21
|
#
|
|
22
|
-
#
|
|
22
|
+
# do_something_more
|
|
23
23
|
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
24
|
+
# # bad
|
|
25
|
+
# do_something
|
|
26
|
+
# unless condition
|
|
27
|
+
# do_extra_stuff
|
|
28
|
+
# end
|
|
29
29
|
#
|
|
30
|
-
#
|
|
30
|
+
# do_something_more
|
|
31
31
|
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
32
|
+
# # good
|
|
33
|
+
# def a_method
|
|
34
|
+
# if condition
|
|
35
|
+
# do_something
|
|
36
|
+
# end
|
|
37
|
+
# end
|
|
38
38
|
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
39
|
+
# # good
|
|
40
|
+
# on_block do
|
|
41
|
+
# if condition
|
|
42
|
+
# do_something
|
|
43
|
+
# end
|
|
44
|
+
# end
|
|
45
45
|
class LineBreakAroundConditionalBlock < RuboCop::Cop::Base
|
|
46
46
|
extend RuboCop::Cop::AutoCorrector
|
|
47
47
|
include RuboCop::Cop::RangeHelp
|
|
@@ -8,10 +8,33 @@ module Rubocop
|
|
|
8
8
|
# Checks for methods that may lead to batch type issues on a table that's been
|
|
9
9
|
# explicitly denied because of its size.
|
|
10
10
|
#
|
|
11
|
-
# Even though
|
|
11
|
+
# Even though these methods perform functions to avoid
|
|
12
12
|
# downtime, using it with tables with millions of rows still causes a
|
|
13
13
|
# significant delay in the deploy process and is best avoided.
|
|
14
14
|
#
|
|
15
|
+
# @example
|
|
16
|
+
#
|
|
17
|
+
# # bad
|
|
18
|
+
# class ExampleMigration < ActiveRecord::Migration[7.0]
|
|
19
|
+
# def change
|
|
20
|
+
# denied_method(:denied_table, column: :value)
|
|
21
|
+
# end
|
|
22
|
+
# end
|
|
23
|
+
#
|
|
24
|
+
# # good
|
|
25
|
+
# class ExampleMigration < ActiveRecord::Migration[7.0]
|
|
26
|
+
# def change
|
|
27
|
+
# denied_method(:allowed_table, column: :value)
|
|
28
|
+
# end
|
|
29
|
+
# end
|
|
30
|
+
#
|
|
31
|
+
# # good
|
|
32
|
+
# class ExampleMigration < ActiveRecord::Migration[7.0]
|
|
33
|
+
# def change
|
|
34
|
+
# allowed_method(:denied_table, column: :value)
|
|
35
|
+
# end
|
|
36
|
+
# end
|
|
37
|
+
#
|
|
15
38
|
# See https://gitlab.com/gitlab-com/infrastructure/issues/1602 for more
|
|
16
39
|
# information.
|
|
17
40
|
class UpdateLargeTable < RuboCop::Cop::Base
|
|
@@ -46,9 +46,9 @@ module Rubocop
|
|
|
46
46
|
# @!method shared_examples(node)
|
|
47
47
|
def_node_matcher :shared_examples, <<~PATTERN
|
|
48
48
|
{
|
|
49
|
-
(
|
|
49
|
+
(any_block (send #rspec? #SharedGroups.all ...) ...)
|
|
50
50
|
{
|
|
51
|
-
(
|
|
51
|
+
(any_block (send nil? #Includes.all ...) ...)
|
|
52
52
|
(send nil? #Includes.all ...)
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -64,6 +64,7 @@ module Rubocop
|
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
alias_method :on_numblock, :on_block
|
|
67
|
+
alias_method :on_itblock, :on_block
|
|
67
68
|
end
|
|
68
69
|
end
|
|
69
70
|
end
|
|
@@ -54,7 +54,7 @@ module Rubocop
|
|
|
54
54
|
|
|
55
55
|
# @!method it_description(node)
|
|
56
56
|
def_node_matcher :it_description, <<-PATTERN
|
|
57
|
-
(
|
|
57
|
+
(any_block (send _ :it ${
|
|
58
58
|
(str $_)
|
|
59
59
|
(dstr (str $_ ) ...)
|
|
60
60
|
} ...) ...)
|
|
@@ -66,6 +66,7 @@ module Rubocop
|
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
alias_method :on_numblock, :on_block
|
|
69
|
+
alias_method :on_itblock, :on_block
|
|
69
70
|
|
|
70
71
|
private
|
|
71
72
|
|
|
@@ -91,9 +92,7 @@ module Rubocop
|
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
def replacement_text(node)
|
|
94
|
-
text = text(node)
|
|
95
|
-
|
|
96
|
-
text.strip!
|
|
95
|
+
text = text(node).strip
|
|
97
96
|
|
|
98
97
|
text = downcase_first_letter(text) if invalid_description?(text)
|
|
99
98
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rubocop-rspec'
|
|
4
|
+
require_relative 'base'
|
|
5
|
+
|
|
6
|
+
module Rubocop
|
|
7
|
+
module Cop
|
|
8
|
+
module RSpec
|
|
9
|
+
# Limits the number of examples in feature spec files.
|
|
10
|
+
#
|
|
11
|
+
# Feature specs with too many examples are slow to run, hard to maintain,
|
|
12
|
+
# and often indicate the file should be split into smaller, focused specs.
|
|
13
|
+
#
|
|
14
|
+
# The maximum number of examples can be configured with the `Max` option
|
|
15
|
+
# (default: 25).
|
|
16
|
+
#
|
|
17
|
+
# @example Max: 25 (default)
|
|
18
|
+
#
|
|
19
|
+
# # bad
|
|
20
|
+
# # A feature spec file with more than 25 examples.
|
|
21
|
+
#
|
|
22
|
+
# # good
|
|
23
|
+
# # A feature spec file with 25 or fewer examples.
|
|
24
|
+
class FeatureSpecMaxExamples < Base
|
|
25
|
+
MSG = 'Feature spec file has %<count>d examples, which exceeds the maximum of %<max>d. ' \
|
|
26
|
+
'Consider splitting into smaller, focused files grouped by user flow or feature area.'
|
|
27
|
+
|
|
28
|
+
def on_new_investigation
|
|
29
|
+
super
|
|
30
|
+
@example_count = 0
|
|
31
|
+
@max = cop_config['Max'] || 25
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def on_block(node)
|
|
35
|
+
@example_count += 1 if example?(node)
|
|
36
|
+
end
|
|
37
|
+
alias_method :on_numblock, :on_block
|
|
38
|
+
alias_method :on_itblock, :on_block
|
|
39
|
+
|
|
40
|
+
def on_investigation_end
|
|
41
|
+
add_global_offense(format(MSG, count: @example_count, max: @max)) if @example_count > @max
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
data/rubocop-all.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
AllCops:
|
|
3
3
|
# The oldest supported Ruby version.
|
|
4
|
-
TargetRubyVersion: 3.
|
|
4
|
+
TargetRubyVersion: 3.3
|
|
5
5
|
# Cop names are not displayed in offense messages by default. Change behavior
|
|
6
6
|
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
|
7
7
|
# option.
|
data/rubocop-capybara.yml
CHANGED
data/rubocop-code_reuse.yml
CHANGED
data/rubocop-default.yml
CHANGED
data/rubocop-factory_bot.yml
CHANGED
data/rubocop-fips.yml
CHANGED
data/rubocop-graphql.yml
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
require:
|
|
3
|
-
- ./lib/
|
|
3
|
+
- ./lib/rubocop/cop/internal_affairs/cop_description_with_example
|
|
4
|
+
- ./lib/rubocop/cop/internal_affairs/deprecate_cop_helper
|
|
5
|
+
- ./lib/rubocop/cop/internal_affairs/missing_cop_department
|
|
6
|
+
- ./lib/rubocop/cop/internal_affairs/use_restrict_on_send
|
|
4
7
|
|
|
5
8
|
InternalAffairs/DeprecateCopHelper:
|
|
6
9
|
Include:
|
data/rubocop-layout.yml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
require:
|
|
3
|
-
- ./lib/
|
|
3
|
+
- ./lib/rubocop/cop/layout/line_break_after_final_mixin
|
|
4
|
+
- ./lib/rubocop/cop/line_break_around_conditional_block
|
|
4
5
|
|
|
5
6
|
# Check indentation of private/protected visibility modifiers.
|
|
6
7
|
Layout/AccessModifierIndentation:
|
|
@@ -57,6 +58,10 @@ Layout/DotPosition:
|
|
|
57
58
|
Layout/ElseAlignment:
|
|
58
59
|
Enabled: true
|
|
59
60
|
|
|
61
|
+
# Add an empty line after guard clauses.
|
|
62
|
+
Layout/EmptyLineAfterGuardClause:
|
|
63
|
+
Enabled: true
|
|
64
|
+
|
|
60
65
|
# Checks for a newline after the final magic comment.
|
|
61
66
|
Layout/EmptyLineAfterMagicComment:
|
|
62
67
|
Enabled: true
|
data/rubocop-migrations.yml
CHANGED
data/rubocop-performance.yml
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
plugins:
|
|
3
3
|
- rubocop-performance
|
|
4
|
-
|
|
4
|
+
require:
|
|
5
|
+
- ./lib/rubocop/cop/performance/rubyzip
|
|
5
6
|
|
|
6
7
|
# Used to identify usages of ancestors.include? and change them to use ⇐ instead.
|
|
7
8
|
# https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performanceancestorsinclude
|
|
8
9
|
Performance/AncestorsInclude:
|
|
9
10
|
Enabled: true
|
|
10
11
|
|
|
11
|
-
# Identifies places where numeric argument to BigDecimal should be converted to string.
|
|
12
|
-
# Initializing from String is faster than from Numeric for BigDecimal.
|
|
13
|
-
# https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performancebigdecimalwithnumericargument
|
|
14
|
-
Performance/BigDecimalWithNumericArgument:
|
|
15
|
-
Enabled: true
|
|
16
|
-
|
|
17
12
|
Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
|
|
18
13
|
Enabled: true
|
|
19
14
|
|
data/rubocop-rails.yml
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
plugins:
|
|
3
3
|
- rubocop-rails
|
|
4
|
-
|
|
4
|
+
require:
|
|
5
|
+
- ./lib/rubocop/cop/active_record_dependent
|
|
6
|
+
- ./lib/rubocop/cop/active_record_serialize
|
|
7
|
+
- ./lib/rubocop/cop/in_batches
|
|
8
|
+
- ./lib/rubocop/cop/polymorphic_associations
|
|
9
|
+
- ./lib/rubocop/cop/redirect_with_status
|
|
10
|
+
- ./lib/rubocop/cop/rails/include_url_helper
|
|
5
11
|
|
|
6
12
|
# Cop that prevents the use of `dependent: ...` in ActiveRecord models.
|
|
7
13
|
Cop/ActiveRecordDependent:
|
data/rubocop-rspec.yml
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
plugins:
|
|
3
3
|
- rubocop-rspec
|
|
4
4
|
- rubocop-rspec_rails
|
|
5
|
-
|
|
5
|
+
require:
|
|
6
|
+
- ./lib/gitlab/styles/rubocop/rspec
|
|
6
7
|
|
|
7
8
|
# Check that instances are not being stubbed globally.
|
|
8
9
|
RSpec/AnyInstance:
|
|
@@ -21,6 +22,22 @@ RSpec/BeforeAfterAll:
|
|
|
21
22
|
RSpec/ClassCheck:
|
|
22
23
|
Enabled: false
|
|
23
24
|
|
|
25
|
+
# Checks that `context` docstrings start with an allowed prefix. These are the
|
|
26
|
+
# most common prefixes in gitlab-org/gitlab:
|
|
27
|
+
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92980
|
|
28
|
+
# Quote them all, because YAML reads unquoted `on` as `true`.
|
|
29
|
+
RSpec/ContextWording:
|
|
30
|
+
Prefixes:
|
|
31
|
+
- 'when'
|
|
32
|
+
- 'with'
|
|
33
|
+
- 'without'
|
|
34
|
+
- 'for'
|
|
35
|
+
- 'and'
|
|
36
|
+
- 'on'
|
|
37
|
+
- 'in'
|
|
38
|
+
- 'as'
|
|
39
|
+
- 'if'
|
|
40
|
+
|
|
24
41
|
# Check that the first argument to the top level describe is the tested class or
|
|
25
42
|
# module.
|
|
26
43
|
RSpec/DescribeClass:
|
|
@@ -96,6 +113,12 @@ RSpec/ExpectChange:
|
|
|
96
113
|
RSpec/ExpectOutput:
|
|
97
114
|
Enabled: true
|
|
98
115
|
|
|
116
|
+
# Limits the number of examples in feature spec files to encourage splitting
|
|
117
|
+
# large specs into smaller, focused files.
|
|
118
|
+
RSpec/FeatureSpecMaxExamples:
|
|
119
|
+
Enabled: false
|
|
120
|
+
Max: 25
|
|
121
|
+
|
|
99
122
|
# Checks if there are focused specs.
|
|
100
123
|
RSpec/Focus:
|
|
101
124
|
Enabled: true
|
data/rubocop-security.yml
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
require:
|
|
3
|
-
- ./lib/
|
|
3
|
+
- ./lib/rubocop/cop/gitlab_security/deep_munge
|
|
4
|
+
- ./lib/rubocop/cop/gitlab_security/json_serialization
|
|
5
|
+
- ./lib/rubocop/cop/gitlab_security/public_send
|
|
6
|
+
- ./lib/rubocop/cop/gitlab_security/redirect_to_params_update
|
|
7
|
+
- ./lib/rubocop/cop/gitlab_security/send_file_params
|
|
8
|
+
- ./lib/rubocop/cop/gitlab_security/sql_injection
|
|
9
|
+
- ./lib/rubocop/cop/gitlab_security/system_command_injection
|
|
4
10
|
|
|
5
11
|
# Checks for implementations of the hash method which combine values using
|
|
6
12
|
# custom logic instead of delegating to Array#hash.
|