gitlab-styles 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.gitlab-ci.yml +36 -4
- data/.gitlab/merge_request_templates/Release.md +35 -0
- data/Gemfile +2 -0
- data/README.md +4 -0
- data/Rakefile +2 -0
- data/gitlab-styles.gemspec +3 -1
- data/lib/gitlab/styles.rb +2 -0
- data/lib/gitlab/styles/rubocop.rb +2 -0
- data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/active_record_serialize.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/in_batches.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/redirect_with_status.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb +3 -1
- data/lib/gitlab/styles/rubocop/cop/without_reactive_cache.rb +3 -1
- data/lib/gitlab/styles/rubocop/migration_helpers.rb +2 -0
- data/lib/gitlab/styles/rubocop/model_helpers.rb +2 -0
- data/lib/gitlab/styles/version.rb +3 -1
- data/rubocop-style.yml +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5f56cd42de5afd61307ea92fd0114cb64e79b575697800b948e6d3e42e32d7c
|
4
|
+
data.tar.gz: 25c343aae93b4bb8d03d57b92152c5c51433cacec86c86b6449ba8a6af3cc6e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7e7dbc2a80150595404fb1639266f462687668411b4410378a1021d9d07915fec14d6b34265d2a6672d65e5005cb4e2d7a1e99acff2ddbe0bc827280dc1c011
|
7
|
+
data.tar.gz: c0b9073e17bf0c11f283ef485612746c3baa1a6de27392029ca930413f939cc192d797e0a3a3016da2db0bdc219444c93129199fbba9ab81e533f86182c65d10
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,13 +1,45 @@
|
|
1
|
-
|
1
|
+
stages:
|
2
|
+
- release
|
3
|
+
- test
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
5
|
+
default:
|
6
|
+
image: ruby:2.6
|
7
|
+
tags:
|
8
|
+
- gitlab-org
|
9
|
+
before_script:
|
10
|
+
- bundle --version
|
11
|
+
- bundle install
|
12
|
+
|
13
|
+
workflow:
|
14
|
+
rules:
|
15
|
+
# For merge requests, create a pipeline.
|
16
|
+
- if: '$CI_MERGE_REQUEST_IID'
|
17
|
+
# For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
|
18
|
+
- if: '$CI_COMMIT_BRANCH == "master"'
|
19
|
+
# For tags, create a pipeline.
|
20
|
+
- if: '$CI_COMMIT_TAG'
|
6
21
|
|
7
22
|
styles:
|
23
|
+
stage: test
|
8
24
|
script:
|
9
25
|
- bundle exec rubocop --debug --parallel
|
10
26
|
|
11
27
|
specs:
|
28
|
+
stage: test
|
12
29
|
script:
|
13
30
|
- bundle exec rspec
|
31
|
+
|
32
|
+
release:
|
33
|
+
stage: release
|
34
|
+
rules:
|
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
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!-- Replace `v4.5.0` with the previous release here, and `e18d76b309e42888759c1effe96767f13e34ae55`
|
2
|
+
with the latest commit from https://gitlab.com/gitlab-org/gitlab-styles/commits/master that will be included in the release. -->
|
3
|
+
- Diff: https://gitlab.com/gitlab-org/gitlab-styles/compare/v4.5.0...e18d76b309e42888759c1effe96767f13e34ae55
|
4
|
+
|
5
|
+
- Release notes:
|
6
|
+
|
7
|
+
<!-- Keep the sections order but remove the empty sections -->
|
8
|
+
|
9
|
+
```markdown
|
10
|
+
### New scenarios and scenario updates
|
11
|
+
|
12
|
+
- !aaa <Title of the aaa MR>.
|
13
|
+
|
14
|
+
### Fixes
|
15
|
+
|
16
|
+
- !bbb <Title of the bbb MR>.
|
17
|
+
|
18
|
+
### Doc changes
|
19
|
+
|
20
|
+
- !ccc <Title of the ccc MR>.
|
21
|
+
|
22
|
+
### Other changes (CI, backstage)
|
23
|
+
|
24
|
+
- !ddd <Title of the ddd MR>.
|
25
|
+
```
|
26
|
+
|
27
|
+
- Checklist before merging:
|
28
|
+
- [ ] Diff link is up-to-date.
|
29
|
+
- [ ] Based on the diff, `lib/gitlab/styles/version.rb` is updated, according to [SemVer](https://semver.org).
|
30
|
+
- [ ] Release notes are accurate.
|
31
|
+
|
32
|
+
- Checklist after merging:
|
33
|
+
- [ ] [Create a tag for the new release version](docs/release_process.md#how-to).
|
34
|
+
|
35
|
+
/label ~"Engineering Productivity" ~backstage
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -77,6 +77,10 @@ https://gitlab.com/gitlab-org/gitlab-styles. This project is intended to be a
|
|
77
77
|
safe, welcoming space for collaboration, and contributors are expected to adhere
|
78
78
|
to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
79
79
|
|
80
|
+
## Release Process
|
81
|
+
|
82
|
+
Please refer to the [Release Process](docs/release_process.md).
|
83
|
+
|
80
84
|
## License
|
81
85
|
|
82
86
|
The gem is available as open source under the terms of the
|
data/Rakefile
CHANGED
data/gitlab-styles.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'gitlab/styles/version'
|
@@ -13,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
13
15
|
spec.license = 'MIT'
|
14
16
|
|
15
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
+
f.match(%r{^(docs|test|spec|features)/})
|
17
19
|
end
|
18
20
|
spec.bindir = 'exe'
|
19
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
data/lib/gitlab/styles.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../model_helpers'
|
2
4
|
|
3
5
|
module Gitlab
|
@@ -9,7 +11,7 @@ module Gitlab
|
|
9
11
|
include ModelHelpers
|
10
12
|
|
11
13
|
MSG = 'Do not use `dependent: to remove associated data, ' \
|
12
|
-
'use foreign keys with cascading deletes instead'
|
14
|
+
'use foreign keys with cascading deletes instead'
|
13
15
|
|
14
16
|
METHOD_NAMES = [:has_many, :has_one, :belongs_to].freeze
|
15
17
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../model_helpers'
|
2
4
|
|
3
5
|
module Gitlab
|
@@ -8,7 +10,7 @@ module Gitlab
|
|
8
10
|
class ActiveRecordSerialize < RuboCop::Cop::Cop
|
9
11
|
include ModelHelpers
|
10
12
|
|
11
|
-
MSG = 'Do not store serialized data in the database, use separate columns and/or tables instead'
|
13
|
+
MSG = 'Do not store serialized data in the database, use separate columns and/or tables instead'
|
12
14
|
|
13
15
|
def on_send(node)
|
14
16
|
return unless in_model?(node)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module Styles
|
3
5
|
module Rubocop
|
@@ -16,7 +18,7 @@ module Gitlab
|
|
16
18
|
# # good
|
17
19
|
# FooError = Class.new(StandardError)
|
18
20
|
class CustomErrorClass < RuboCop::Cop::Cop
|
19
|
-
MSG = 'Use `Class.new(SuperClass)` to define an empty custom error class.'
|
21
|
+
MSG = 'Use `Class.new(SuperClass)` to define an empty custom error class.'
|
20
22
|
|
21
23
|
def on_class(node)
|
22
24
|
_klass, parent, body = node.children
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module Styles
|
3
5
|
module Rubocop
|
@@ -6,7 +8,7 @@ module Gitlab
|
|
6
8
|
# `Gemfile` in order to avoid additional points of failure beyond
|
7
9
|
# rubygems.org.
|
8
10
|
class GemFetcher < RuboCop::Cop::Cop
|
9
|
-
MSG = 'Do not use gems from git repositories, only use gems from RubyGems.'
|
11
|
+
MSG = 'Do not use gems from git repositories, only use gems from RubyGems.'
|
10
12
|
|
11
13
|
GIT_KEYS = [:git, :github].freeze
|
12
14
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../model_helpers'
|
2
4
|
|
3
5
|
module Gitlab
|
@@ -6,7 +8,7 @@ module Gitlab
|
|
6
8
|
module Cop
|
7
9
|
# Cop that prevents the use of `in_batches`
|
8
10
|
class InBatches < RuboCop::Cop::Cop
|
9
|
-
MSG = 'Do not use `in_batches`, use `each_batch` from the EachBatch module instead'
|
11
|
+
MSG = 'Do not use `in_batches`, use `each_batch` from the EachBatch module instead'
|
10
12
|
|
11
13
|
def on_send(node)
|
12
14
|
return unless node.children[1] == :in_batches
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module Styles
|
3
5
|
module Rubocop
|
@@ -56,7 +58,7 @@ module Gitlab
|
|
56
58
|
#
|
57
59
|
# do_something_more
|
58
60
|
class LineBreakAfterGuardClauses < RuboCop::Cop::Cop
|
59
|
-
MSG = 'Add a line break after guard clauses'
|
61
|
+
MSG = 'Add a line break after guard clauses'
|
60
62
|
|
61
63
|
def_node_matcher :guard_clause_node?, <<-PATTERN
|
62
64
|
[{(send nil? {:raise :fail :throw} ...) return break next} single_line?]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../model_helpers'
|
2
4
|
|
3
5
|
module Gitlab
|
@@ -8,7 +10,7 @@ module Gitlab
|
|
8
10
|
class PolymorphicAssociations < RuboCop::Cop::Cop
|
9
11
|
include ModelHelpers
|
10
12
|
|
11
|
-
MSG = 'Do not use polymorphic associations, use separate tables instead'
|
13
|
+
MSG = 'Do not use polymorphic associations, use separate tables instead'
|
12
14
|
|
13
15
|
def on_send(node)
|
14
16
|
return unless in_model?(node)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module Styles
|
3
5
|
module Rubocop
|
@@ -5,7 +7,7 @@ module Gitlab
|
|
5
7
|
# This cop prevents usage of 'redirect_to' in actions 'destroy' without specifying 'status'.
|
6
8
|
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/31840
|
7
9
|
class RedirectWithStatus < RuboCop::Cop::Cop
|
8
|
-
MSG = 'Do not use "redirect_to" without "status" in "destroy" action'
|
10
|
+
MSG = 'Do not use "redirect_to" without "status" in "destroy" action'
|
9
11
|
|
10
12
|
def on_def(node)
|
11
13
|
return unless in_controller?(node)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubocop-rspec'
|
2
4
|
|
3
5
|
module Gitlab
|
@@ -16,7 +18,7 @@ module Gitlab
|
|
16
18
|
# expect(page).to have_link('Link', href: 'https://example.com')
|
17
19
|
# expect(page).to have_link('Example')
|
18
20
|
class HaveLinkParameters < RuboCop::Cop::RSpec::Cop
|
19
|
-
MESSAGE = "The second argument to `have_link` should be a Hash."
|
21
|
+
MESSAGE = "The second argument to `have_link` should be a Hash."
|
20
22
|
|
21
23
|
def_node_matcher :unused_parameters?, <<~PATTERN
|
22
24
|
(send nil? :have_link
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubocop-rspec'
|
2
4
|
|
3
5
|
module Gitlab
|
@@ -22,7 +24,7 @@ module Gitlab
|
|
22
24
|
# undo_something
|
23
25
|
# end
|
24
26
|
class SingleLineHook < RuboCop::Cop::RSpec::Cop
|
25
|
-
MESSAGE = "Don't use single-line hook blocks."
|
27
|
+
MESSAGE = "Don't use single-line hook blocks."
|
26
28
|
|
27
29
|
def_node_search :rspec_hook?, <<~PATTERN
|
28
30
|
(send nil? {:after :around :before} ...)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubocop-rspec'
|
2
4
|
|
3
5
|
module Gitlab
|
@@ -16,7 +18,7 @@ module Gitlab
|
|
16
18
|
# describe MyClass, :js do
|
17
19
|
# end
|
18
20
|
class VerboseIncludeMetadata < RuboCop::Cop::RSpec::Cop
|
19
|
-
MSG = 'Use `%s` instead of `%s`.'
|
21
|
+
MSG = 'Use `%s` instead of `%s`.'
|
20
22
|
|
21
23
|
SELECTORS = %i[describe context feature example_group it specify example scenario its].freeze
|
22
24
|
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module Styles
|
3
5
|
module Rubocop
|
4
6
|
module Cop
|
5
7
|
# Cop that prevents the use of `without_reactive_cache`
|
6
8
|
class WithoutReactiveCache < RuboCop::Cop::Cop
|
7
|
-
MSG = 'without_reactive_cache is for debugging purposes only. Please use with_reactive_cache.'
|
9
|
+
MSG = 'without_reactive_cache is for debugging purposes only. Please use with_reactive_cache.'
|
8
10
|
|
9
11
|
def on_send(node)
|
10
12
|
return unless node.children[1] == :without_reactive_cache
|
data/rubocop-style.yml
CHANGED
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: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
133
|
- ".gitlab-ci.yml"
|
134
|
+
- ".gitlab/merge_request_templates/Release.md"
|
134
135
|
- ".rspec"
|
135
136
|
- ".rubocop.yml"
|
136
137
|
- ".rubocop_todo.yml"
|
@@ -192,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
193
|
- !ruby/object:Gem::Version
|
193
194
|
version: '0'
|
194
195
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
196
|
+
rubygems_version: 3.1.2
|
196
197
|
signing_key:
|
197
198
|
specification_version: 4
|
198
199
|
summary: GitLab style guides and shared style configs.
|