gitlab-styles 5.0.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +5 -16
- data/.gitlab/merge_request_templates/New Static Analysis Check.md +21 -0
- data/.gitlab/merge_request_templates/Release.md +4 -4
- data/.rubocop.yml +8 -1
- data/Gemfile +1 -1
- data/gitlab-styles.gemspec +5 -5
- data/lib/gitlab/styles/rubocop.rb +3 -16
- data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +6 -3
- data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/internal_affairs/deprecate_cop_helper.rb +43 -0
- data/lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb +132 -0
- data/lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb +1 -1
- data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +1 -1
- 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/rspec/helpers.rb +1 -1
- 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 +13 -0
- metadata +16 -13
- data/.rubocop_todo.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88825b6aaa4961f16a29bfc14cdb1d590700a74e81fe68e072fccd2046506c6b
|
4
|
+
data.tar.gz: 5634afcb51a117e54f4760c43f12d3b2564d08b62bbcd49d97b7cde7c88014d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99652ceb45ae8e31ac3105bd7913a2c85e0a5a22cd97ad5d30081fd1b55b4d1734671d9cdbfdf1875dbdbc314efb9fe433b8859a18761ebea1d1054f58aa88d1
|
7
|
+
data.tar.gz: 2b16d7dc347ec66fd1656d735bc6427c485c88e27d7fb3030e0a852d76fb338705a976e85fb949b25b3994035134251da3771a9f3c914767d6d7158ecf5137e4
|
data/.gitlab-ci.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
stages:
|
2
|
-
- release
|
3
2
|
- test
|
3
|
+
- deploy
|
4
4
|
|
5
5
|
default:
|
6
|
-
image: ruby:2.
|
6
|
+
image: ruby:2.7
|
7
7
|
tags:
|
8
8
|
- gitlab-org
|
9
9
|
before_script:
|
@@ -29,17 +29,6 @@ specs:
|
|
29
29
|
script:
|
30
30
|
- bundle exec rspec
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
- if: '$CI_COMMIT_TAG'
|
36
|
-
script:
|
37
|
-
- gem update --system
|
38
|
-
- ruby --version
|
39
|
-
- gem env version
|
40
|
-
- gem build gitlab-styles.gemspec
|
41
|
-
- gem push gitlab-styles*.gem
|
42
|
-
artifacts:
|
43
|
-
paths:
|
44
|
-
- gitlab-styles*.gem
|
45
|
-
expire_in: 30 days
|
32
|
+
include:
|
33
|
+
- project: 'gitlab-org/quality/pipeline-common'
|
34
|
+
file: '/ci/gem-release.yml'
|
@@ -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
|
@@ -7,7 +7,7 @@ with the latest commit from https://gitlab.com/gitlab-org/gitlab-styles/commits/
|
|
7
7
|
<!-- Keep the sections order but remove the empty sections -->
|
8
8
|
|
9
9
|
```markdown
|
10
|
-
### New
|
10
|
+
### New features and features updates
|
11
11
|
|
12
12
|
- !aaa <Title of the aaa MR>.
|
13
13
|
|
@@ -19,7 +19,7 @@ with the latest commit from https://gitlab.com/gitlab-org/gitlab-styles/commits/
|
|
19
19
|
|
20
20
|
- !ccc <Title of the ccc MR>.
|
21
21
|
|
22
|
-
### Other changes (
|
22
|
+
### Other changes (tooling, technical debt)
|
23
23
|
|
24
24
|
- !ddd <Title of the ddd MR>.
|
25
25
|
```
|
@@ -30,6 +30,6 @@ with the latest commit from https://gitlab.com/gitlab-org/gitlab-styles/commits/
|
|
30
30
|
- [ ] Release notes are accurate.
|
31
31
|
|
32
32
|
- Checklist after merging:
|
33
|
-
- [ ] [
|
33
|
+
- [ ] [Update the release notes for the newly created tag](docs/release_process.md#how-to).
|
34
34
|
|
35
|
-
/label ~"Engineering Productivity" ~"
|
35
|
+
/label ~"Engineering Productivity" ~"feature" ~"feature::maintenance" ~"static code analysis"
|
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.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,21 +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/code_reuse/active_record'
|
12
|
-
require 'gitlab/styles/rubocop/cop/migration/update_large_table'
|
13
|
-
require 'gitlab/styles/rubocop/cop/without_reactive_cache'
|
14
|
-
require 'gitlab/styles/rubocop/cop/rspec/single_line_hook'
|
15
|
-
require 'gitlab/styles/rubocop/cop/rspec/have_link_parameters'
|
16
|
-
require 'gitlab/styles/rubocop/cop/rspec/verbose_include_metadata'
|
17
|
-
require 'gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example'
|
18
|
-
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) }
|
19
6
|
|
20
7
|
module Gitlab
|
21
8
|
module Styles
|
@@ -21,7 +21,8 @@ module Gitlab
|
|
21
21
|
MSG = 'Use `Class.new(SuperClass)` to define an empty custom error class.'
|
22
22
|
|
23
23
|
def on_class(node)
|
24
|
-
|
24
|
+
parent = node.parent_class
|
25
|
+
body = node.body
|
25
26
|
|
26
27
|
return if body
|
27
28
|
|
@@ -29,11 +30,13 @@ module Gitlab
|
|
29
30
|
|
30
31
|
return unless parent_klass&.to_s&.end_with?('Error')
|
31
32
|
|
32
|
-
add_offense(node
|
33
|
+
add_offense(node)
|
33
34
|
end
|
34
35
|
|
35
36
|
def autocorrect(node)
|
36
|
-
klass
|
37
|
+
klass = node.identifier
|
38
|
+
parent = node.parent_class
|
39
|
+
|
37
40
|
replacement = "#{class_name_from_node(klass)} = Class.new(#{class_name_from_node(parent)})"
|
38
41
|
|
39
42
|
lambda do |corrector|
|
@@ -20,7 +20,7 @@ module Gitlab
|
|
20
20
|
|
21
21
|
node.children.last.each_node(:pair) do |pair|
|
22
22
|
key_name = pair.children[0].children[0].to_sym
|
23
|
-
add_offense(node, location: pair.source_range
|
23
|
+
add_offense(node, location: pair.source_range) if GIT_KEYS.include?(key_name)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -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
|
@@ -69,7 +69,7 @@ module Gitlab
|
|
69
69
|
return unless guard_clause?(node)
|
70
70
|
return if next_line(node).blank? || clause_last_line?(next_line(node)) || guard_clause?(next_sibling(node))
|
71
71
|
|
72
|
-
add_offense(node
|
72
|
+
add_offense(node)
|
73
73
|
end
|
74
74
|
|
75
75
|
def autocorrect(node)
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module Styles
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
# Ensures a line break around conditional blocks.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# # bad
|
11
|
+
# do_something
|
12
|
+
# if condition
|
13
|
+
# do_extra_stuff
|
14
|
+
# end
|
15
|
+
# do_something_more
|
16
|
+
#
|
17
|
+
# # good
|
18
|
+
# do_something
|
19
|
+
#
|
20
|
+
# if condition
|
21
|
+
# do_extra_stuff
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# do_something_more
|
25
|
+
#
|
26
|
+
# # bad
|
27
|
+
# do_something
|
28
|
+
# unless condition
|
29
|
+
# do_extra_stuff
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# do_something_more
|
33
|
+
#
|
34
|
+
# # good
|
35
|
+
# def a_method
|
36
|
+
# if condition
|
37
|
+
# do_something
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# # good
|
42
|
+
# on_block do
|
43
|
+
# if condition
|
44
|
+
# do_something
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
class LineBreakAroundConditionalBlock < RuboCop::Cop::Cop
|
48
|
+
include RuboCop::Cop::RangeHelp
|
49
|
+
|
50
|
+
MSG = 'Add a line break around conditional blocks'
|
51
|
+
|
52
|
+
def on_if(node)
|
53
|
+
# This cop causes errors in haml files, so let's skip those
|
54
|
+
return if in_haml?(node)
|
55
|
+
return if node.single_line?
|
56
|
+
return unless node.if? || node.unless?
|
57
|
+
|
58
|
+
add_offense(node) unless previous_line_valid?(node)
|
59
|
+
add_offense(node) unless last_line_valid?(node)
|
60
|
+
end
|
61
|
+
|
62
|
+
def autocorrect(node)
|
63
|
+
lambda do |corrector|
|
64
|
+
line = range_by_whole_lines(node.source_range)
|
65
|
+
|
66
|
+
corrector.insert_before(line, "\n") unless previous_line_valid?(node)
|
67
|
+
corrector.insert_after(line, "\n") unless last_line_valid?(node)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def previous_line_valid?(node)
|
74
|
+
previous_line(node).empty? ||
|
75
|
+
start_clause_line?(previous_line(node)) ||
|
76
|
+
block_start?(previous_line(node)) ||
|
77
|
+
begin_line?(previous_line(node)) ||
|
78
|
+
assignment_line?(previous_line(node)) ||
|
79
|
+
rescue_line?(previous_line(node))
|
80
|
+
end
|
81
|
+
|
82
|
+
def last_line_valid?(node)
|
83
|
+
last_line(node).empty? ||
|
84
|
+
end_line?(last_line(node)) ||
|
85
|
+
end_clause_line?(last_line(node))
|
86
|
+
end
|
87
|
+
|
88
|
+
def previous_line(node)
|
89
|
+
processed_source[node.loc.line - 2]
|
90
|
+
end
|
91
|
+
|
92
|
+
def last_line(node)
|
93
|
+
processed_source[node.loc.last_line]
|
94
|
+
end
|
95
|
+
|
96
|
+
def start_clause_line?(line)
|
97
|
+
line =~ /^\s*(def|=end|#|module|class|if|unless|else|elsif|ensure|when)/
|
98
|
+
end
|
99
|
+
|
100
|
+
def end_clause_line?(line)
|
101
|
+
line =~ /^\s*(#|rescue|else|elsif|when)/
|
102
|
+
end
|
103
|
+
|
104
|
+
def begin_line?(line)
|
105
|
+
# an assignment followed by a begin or ust a begin
|
106
|
+
line =~ /^\s*(@?(\w|\|+|=|\[|\]|\s)+begin|begin)/
|
107
|
+
end
|
108
|
+
|
109
|
+
def assignment_line?(line)
|
110
|
+
line =~ /^\s*.*=/
|
111
|
+
end
|
112
|
+
|
113
|
+
def rescue_line?(line)
|
114
|
+
line =~ /^\s*rescue/
|
115
|
+
end
|
116
|
+
|
117
|
+
def block_start?(line)
|
118
|
+
line.match(/ (do|{)( \|.*?\|)?\s?(#.+)?\z/)
|
119
|
+
end
|
120
|
+
|
121
|
+
def end_line?(line)
|
122
|
+
line =~ /^\s*(end|})/
|
123
|
+
end
|
124
|
+
|
125
|
+
def in_haml?(node)
|
126
|
+
node.location.expression.source_buffer.name.end_with?('.haml.rb')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
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
|
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:
|
@@ -201,6 +205,9 @@ Style/InfiniteLoop:
|
|
201
205
|
Style/InverseMethods:
|
202
206
|
Enabled: false
|
203
207
|
|
208
|
+
Style/KeywordParametersOrder: # (new in 0.90)
|
209
|
+
Enabled: true
|
210
|
+
|
204
211
|
# Use lambda.call(...) instead of lambda.(...).
|
205
212
|
Style/LambdaCall:
|
206
213
|
Enabled: true
|
@@ -334,6 +341,9 @@ Style/RedundantRegexpCharacterClass:
|
|
334
341
|
Style/RedundantRegexpEscape:
|
335
342
|
Enabled: true
|
336
343
|
|
344
|
+
Style/RedundantSelfAssignment: # (new in 0.90)
|
345
|
+
Enabled: true
|
346
|
+
|
337
347
|
# Use `sort` instead of `sort_by { |x| x }`.
|
338
348
|
Style/RedundantSortBy:
|
339
349
|
Enabled: true
|
@@ -357,6 +367,9 @@ Style/SignalException:
|
|
357
367
|
Style/SlicingWithRange:
|
358
368
|
Enabled: true
|
359
369
|
|
370
|
+
Style/SoleNestedConditional: # (new in 0.89)
|
371
|
+
Enabled: true
|
372
|
+
|
360
373
|
# Check for the usage of parentheses around stabby lambda arguments.
|
361
374
|
Style/StabbyLambdaParentheses:
|
362
375
|
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.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.91.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.91.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-gitlab-security
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
33
|
+
version: 0.1.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.
|
40
|
+
version: 0.1.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-performance
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.9.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.9.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.9'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '2.
|
68
|
+
version: '2.9'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1
|
89
|
+
version: '2.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1
|
96
|
+
version: '2.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,10 +132,10 @@ files:
|
|
132
132
|
- ".editorconfig"
|
133
133
|
- ".gitignore"
|
134
134
|
- ".gitlab-ci.yml"
|
135
|
+
- ".gitlab/merge_request_templates/New Static Analysis Check.md"
|
135
136
|
- ".gitlab/merge_request_templates/Release.md"
|
136
137
|
- ".rspec"
|
137
138
|
- ".rubocop.yml"
|
138
|
-
- ".rubocop_todo.yml"
|
139
139
|
- CODE_OF_CONDUCT.md
|
140
140
|
- CONTRIBUTING.md
|
141
141
|
- Gemfile
|
@@ -153,13 +153,16 @@ files:
|
|
153
153
|
- lib/gitlab/styles/rubocop/cop/custom_error_class.rb
|
154
154
|
- lib/gitlab/styles/rubocop/cop/gem_fetcher.rb
|
155
155
|
- lib/gitlab/styles/rubocop/cop/in_batches.rb
|
156
|
+
- lib/gitlab/styles/rubocop/cop/internal_affairs/deprecate_cop_helper.rb
|
156
157
|
- lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb
|
158
|
+
- lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb
|
157
159
|
- lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb
|
158
160
|
- lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb
|
159
161
|
- lib/gitlab/styles/rubocop/cop/redirect_with_status.rb
|
160
162
|
- lib/gitlab/styles/rubocop/cop/rspec/base.rb
|
161
163
|
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb
|
162
164
|
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb
|
165
|
+
- lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb
|
163
166
|
- lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb
|
164
167
|
- lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb
|
165
168
|
- lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb
|
data/.rubocop_todo.yml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-11-03 15:49:59 +0100 using RuboCop version 0.51.0.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|