gitlab-styles 9.0.0 → 9.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 +7 -1
- data/Gemfile +6 -2
- data/README.md +25 -5
- data/bin/console +1 -0
- data/gitlab-styles.gemspec +3 -3
- data/lefthook.yml +16 -0
- data/lib/gitlab/styles/version.rb +1 -1
- data/rubocop-rspec.yml +20 -6
- data/rubocop-security.yml +4 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50eab9da6dd93cfbda3c8a8877e6ac2f8ce8274d6f92116973e6c9c1ee590d5f
|
4
|
+
data.tar.gz: f7e187d901c89bb4d4ba4a40d72523b10c5148ef965d60b243e8c09c9bc21642
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9d90f34b3a3e6d97c6a791c5f91a26318b956751a77b2827f5370e15f8717bdf30cf30ddad0c63afd1f2335707d76dd948d1c7898c0d762f9b19389dea55d49
|
7
|
+
data.tar.gz: 9634b21fcc052557e12ebd277279089e4cfd325b88860c45a5250da554b0f14e378b7cdf8c9648d019649cd1396b327fc7cf10d48462622f00f1af888cd61b31
|
data/.gitlab-ci.yml
CHANGED
@@ -3,7 +3,7 @@ stages:
|
|
3
3
|
- deploy
|
4
4
|
|
5
5
|
default:
|
6
|
-
image: ruby
|
6
|
+
image: "ruby:${RUBY_VERSION}"
|
7
7
|
tags:
|
8
8
|
- gitlab-org
|
9
9
|
before_script:
|
@@ -23,11 +23,17 @@ styles:
|
|
23
23
|
stage: test
|
24
24
|
script:
|
25
25
|
- bundle exec rubocop --debug --parallel
|
26
|
+
parallel:
|
27
|
+
matrix:
|
28
|
+
- RUBY_VERSION: ['2.7', '3.0']
|
26
29
|
|
27
30
|
specs:
|
28
31
|
stage: test
|
29
32
|
script:
|
30
33
|
- bundle exec rspec
|
34
|
+
parallel:
|
35
|
+
matrix:
|
36
|
+
- RUBY_VERSION: ['2.7', '3.0']
|
31
37
|
|
32
38
|
include:
|
33
39
|
- project: 'gitlab-org/quality/pipeline-common'
|
data/Gemfile
CHANGED
@@ -5,9 +5,13 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in gitlab-rubocop.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
+
group :development do
|
9
|
+
gem "lefthook", require: false
|
10
|
+
end
|
11
|
+
|
8
12
|
group :test do
|
9
13
|
# Pin these dependencies, otherwise a new rule could break the CI pipelines
|
10
|
-
gem 'rubocop', '1.
|
11
|
-
gem 'rubocop-rspec', '2.
|
14
|
+
gem 'rubocop', '1.38.0'
|
15
|
+
gem 'rubocop-rspec', '2.15.0'
|
12
16
|
gem 'rspec-parameterized', '0.5.2', require: false
|
13
17
|
end
|
data/README.md
CHANGED
@@ -66,10 +66,19 @@ After checking out the repo, run `bin/setup` to install dependencies.
|
|
66
66
|
Then, run `rake spec` to run the tests. You can also run `bin/console` for an
|
67
67
|
interactive prompt that will allow you to experiment.
|
68
68
|
|
69
|
-
To
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
To test some rules locally, there is a test application [in the playground folder](./playground/). It is a vanilla Rails 6 application with your local `gitlab-styles` included, and it is used to test RuboCop rules. You can add code in it (preferably RuboCop offenses) and run the following command to test the RuboCop policy we setup:
|
70
|
+
|
71
|
+
```shell
|
72
|
+
cd playground
|
73
|
+
bundle install
|
74
|
+
bundle exec rubocop -c .rubocop.yml
|
75
|
+
```
|
76
|
+
|
77
|
+
### Activate lefthook locally
|
78
|
+
|
79
|
+
```shell
|
80
|
+
lefthook install
|
81
|
+
```
|
73
82
|
|
74
83
|
## Contributing
|
75
84
|
|
@@ -80,7 +89,18 @@ to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
80
89
|
|
81
90
|
## Release Process
|
82
91
|
|
83
|
-
|
92
|
+
We release `gitlab-styles` on an ad-hoc basis. There is no regularity to when
|
93
|
+
we release, we just release when we make a change - no matter the size of the
|
94
|
+
change.
|
95
|
+
|
96
|
+
To release a new version:
|
97
|
+
|
98
|
+
1. Create a Merge Request.
|
99
|
+
1. Use Merge Request template [Release.md](https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/blob/master/.gitlab/merge_request_templates/Release.md).
|
100
|
+
1. Follow the instructions.
|
101
|
+
1. A new gem version is [published automatically](https://gitlab.com/gitlab-org/quality/pipeline-common/-/blob/master/ci/gem-release.yml) after the Merge Request has been merged.
|
102
|
+
|
103
|
+
See [!123](https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/123) as an example.
|
84
104
|
|
85
105
|
## License
|
86
106
|
|
data/bin/console
CHANGED
data/gitlab-styles.gemspec
CHANGED
@@ -16,18 +16,18 @@ 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|playground)/})
|
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.
|
25
|
+
spec.add_dependency 'rubocop', '~> 1.38.0'
|
26
26
|
spec.add_dependency 'rubocop-gitlab-security', '~> 0.1.1'
|
27
27
|
spec.add_dependency 'rubocop-graphql', '~> 0.14'
|
28
28
|
spec.add_dependency 'rubocop-performance', '~> 1.14'
|
29
29
|
spec.add_dependency 'rubocop-rails', '~> 2.15'
|
30
|
-
spec.add_dependency 'rubocop-rspec', '~> 2.
|
30
|
+
spec.add_dependency 'rubocop-rspec', '~> 2.15'
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
33
33
|
spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.11.0'
|
data/lefthook.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Lefthook configuration. For more information, see:
|
2
|
+
# https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
|
3
|
+
|
4
|
+
pre-push:
|
5
|
+
parallel: true
|
6
|
+
commands:
|
7
|
+
# Run ruby linting
|
8
|
+
rubocop:
|
9
|
+
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
|
10
|
+
glob: '*.{rb,rake}'
|
11
|
+
run: bundle exec rubocop --parallel --force-exclusion {files}
|
12
|
+
|
13
|
+
# Run all tests (warn if there are any missing tools required for tests).
|
14
|
+
rspec:
|
15
|
+
run: bundle exec rspec -f progress
|
16
|
+
glob: '*.rb'
|
data/rubocop-rspec.yml
CHANGED
@@ -14,6 +14,16 @@ RSpec/BeEql:
|
|
14
14
|
RSpec/BeforeAfterAll:
|
15
15
|
Enabled: false
|
16
16
|
|
17
|
+
# Checks if there is a more specific finder offered by Capybara.
|
18
|
+
# https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/131#note_1141024624
|
19
|
+
RSpec/Capybara/SpecificFinders:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
# Enforces consistent use of be_a or be_kind_of.
|
23
|
+
# https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/131#note_1141022718
|
24
|
+
RSpec/ClassCheck:
|
25
|
+
Enabled: false
|
26
|
+
|
17
27
|
# Check that the first argument to the top level describe is the tested class or
|
18
28
|
# module.
|
19
29
|
RSpec/DescribeClass:
|
@@ -61,6 +71,12 @@ RSpec/ExampleWording:
|
|
61
71
|
RSpec/ExpectActual:
|
62
72
|
Enabled: true
|
63
73
|
|
74
|
+
# Checks for `expect {...}.to change {...}` using a block.
|
75
|
+
# See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/122#note_1089192391
|
76
|
+
RSpec/ExpectChange:
|
77
|
+
Enabled: true
|
78
|
+
EnforcedStyle: block
|
79
|
+
|
64
80
|
# Checks for opportunities to use `expect { … }.to output`.
|
65
81
|
RSpec/ExpectOutput:
|
66
82
|
Enabled: true
|
@@ -131,6 +147,10 @@ RSpec/NotToNot:
|
|
131
147
|
EnforcedStyle: not_to
|
132
148
|
Enabled: true
|
133
149
|
|
150
|
+
# See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/merge_requests/122#note_1089202045
|
151
|
+
RSpec/PredicateMatcher:
|
152
|
+
Enabled: false
|
153
|
+
|
134
154
|
# Check for repeated description strings in example groups.
|
135
155
|
RSpec/RepeatedDescription:
|
136
156
|
Enabled: false
|
@@ -161,9 +181,3 @@ RSpec:
|
|
161
181
|
- let_it_be
|
162
182
|
- let_it_be_with_refind
|
163
183
|
- let_it_be_with_reload
|
164
|
-
Includes:
|
165
|
-
Examples:
|
166
|
-
- run_permission_checks
|
167
|
-
- run_group_permission_checks
|
168
|
-
- it_should_email!
|
169
|
-
- it_should_not_email!
|
data/rubocop-security.yml
CHANGED
@@ -11,6 +11,10 @@ Security/JSONLoad:
|
|
11
11
|
Security/Eval:
|
12
12
|
Enabled: true
|
13
13
|
|
14
|
+
# Checks for the first argument to IO.read, IO.binread, IO.write, IO.binwrite, IO.foreach, and IO.readlines
|
15
|
+
Security/IoMethods:
|
16
|
+
Enabled: true
|
17
|
+
|
14
18
|
GitlabSecurity/DeepMunge:
|
15
19
|
Enabled: true
|
16
20
|
Exclude:
|
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: 9.
|
4
|
+
version: 9.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.38.0
|
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: 1.
|
26
|
+
version: 1.38.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop-gitlab-security
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '2.
|
89
|
+
version: '2.15'
|
90
90
|
type: :runtime
|
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: '2.
|
96
|
+
version: '2.15'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- bin/console
|
176
176
|
- bin/setup
|
177
177
|
- gitlab-styles.gemspec
|
178
|
+
- lefthook.yml
|
178
179
|
- lib/gitlab/styles.rb
|
179
180
|
- lib/gitlab/styles/common/banned_constants.rb
|
180
181
|
- lib/gitlab/styles/rubocop.rb
|