gitlab-dangerfiles 4.13.0 → 4.14.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/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +7 -7
- data/lefthook.yml +1 -1
- data/lib/danger/plugins/changelog.rb +10 -10
- data/lib/danger/plugins/commit_messages.rb +1 -1
- data/lib/gitlab/dangerfiles/base_linter.rb +11 -4
- data/lib/gitlab/dangerfiles/title_linting.rb +4 -1
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e62a200646d128a780ee1e17bb644f5fe296fef2f530631ebdabe677a2eea93f
|
|
4
|
+
data.tar.gz: 73aec620889b66c1c7f61fe845ab2b43c528c21301ed7b1bb4a8b6ad6e93656b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cfaa1d404d59cb656354135dd146d6ea908046f51430fd5d4f7d9aa83f13446bed69f7dc21b018a8f9e6154b6a65b5abf0a3fc90c6863986702b2b64403ffa81
|
|
7
|
+
data.tar.gz: 6300e9593543c6f635ced6fb6b1c9d04773bf1baac66d0dbc7bb2957607196f094d2a429e2372c64dcdbc31b331047e40ac387e2b99bd7b2777d52956c3e6b25
|
data/CONTRIBUTING.md
CHANGED
|
@@ -6,7 +6,7 @@ Except for the license granted herein to GitLab B.V. and recipients of software
|
|
|
6
6
|
distributed by GitLab B.V., you reserve all right, title, and interest in and to
|
|
7
7
|
your Contributions.
|
|
8
8
|
|
|
9
|
-
All contributions are subject to the Developer Certificate of Origin and license set out at [docs.gitlab.com/
|
|
9
|
+
All contributions are subject to the Developer Certificate of Origin and license set out at [docs.gitlab.com/legal/developer_certificate_of_origin](https://docs.gitlab.com/legal/developer_certificate_of_origin/).
|
|
10
10
|
|
|
11
11
|
_This notice should stay as the first item in the CONTRIBUTING.md file._
|
|
12
12
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -148,7 +148,7 @@ Danger rules are located under `lib/danger/rules`.
|
|
|
148
148
|
|
|
149
149
|
#### `changelog`
|
|
150
150
|
|
|
151
|
-
This rule ensures the merge request follows our [Changelog guidelines](https://docs.gitlab.com/
|
|
151
|
+
This rule ensures the merge request follows our [Changelog guidelines](https://docs.gitlab.com/development/changelog/).
|
|
152
152
|
|
|
153
153
|
#### `changes_size`
|
|
154
154
|
|
|
@@ -281,7 +281,7 @@ include:
|
|
|
281
281
|
- component: gitlab.com/gitlab-org/components/danger-review/danger-review@~latest
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
3. Create a [Project or group access token](https://docs.gitlab.com/
|
|
284
|
+
3. Create a [Project or group access token](https://docs.gitlab.com/user/project/settings/project_access_tokens/)
|
|
285
285
|
with scope `api` and role `Developer`.
|
|
286
286
|
4. Add a [CI/CD variable](https://docs.gitlab.com/ee/ci/variables/#add-a-cicd-variable-to-a-project)
|
|
287
287
|
`DANGER_GITLAB_API_TOKEN` (`Masked` but not `Protected`) and use Project access token as value.
|
|
@@ -292,7 +292,7 @@ See a [real world example](https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles
|
|
|
292
292
|
|
|
293
293
|
Danger is a Ruby project and uses [`bundler`](https://bundler.io/) to manage
|
|
294
294
|
its dependencies. This requires a project to have a `Gemfile` and
|
|
295
|
-
`Gemfile.lock`
|
|
295
|
+
`Gemfile.lock` committed. This is helpful especially if Danger is also used
|
|
296
296
|
locally - with `lefthook`, for example.
|
|
297
297
|
|
|
298
298
|
You don't need a `Gemfile` to use the `danger-review` component. If your project
|
|
@@ -343,7 +343,7 @@ The following lint violations generate warnings:
|
|
|
343
343
|
1. The commit changes too many lines across too many files without describing the changes in the commit body ([code](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/blob/bccb167/lib/gitlab/dangerfiles/commit_linter.rb#L83-85)).
|
|
344
344
|
1. The commit body contains too many characters per line ([code](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/blob/bccb167/lib/gitlab/dangerfiles/commit_linter.rb#L87-96)).
|
|
345
345
|
|
|
346
|
-
All other lint violations generate errors, except when the MR has [Squash commits when merge request is accepted](https://docs.gitlab.com/
|
|
346
|
+
All other lint violations generate errors, except when the MR has [Squash commits when merge request is accepted](https://docs.gitlab.com/user/project/merge_requests/squash_and_merge/#squash-commits-in-a-merge-request) enabled, which downgrades lint violations to warnings.
|
|
347
347
|
|
|
348
348
|
## Documentation
|
|
349
349
|
|
|
@@ -381,9 +381,9 @@ See an [example](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92580) fo
|
|
|
381
381
|
|
|
382
382
|
## Contributing
|
|
383
383
|
|
|
384
|
-
Bug reports and merge requests are welcome at https://gitlab.com/gitlab-org/gitlab-dangerfiles. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/gitlab-org/gitlab-dangerfiles/blob/master/CODE_OF_CONDUCT.md).
|
|
384
|
+
Bug reports and merge requests are welcome at https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/blob/master/CODE_OF_CONDUCT.md).
|
|
385
385
|
|
|
386
|
-
Make sure to include a changelog entry in your commit message and read the [changelog entries section](https://docs.gitlab.com/
|
|
386
|
+
Make sure to include a changelog entry in your commit message and read the [changelog entries section](https://docs.gitlab.com/development/changelog/).
|
|
387
387
|
|
|
388
388
|
## Release
|
|
389
389
|
|
|
@@ -415,4 +415,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
415
415
|
|
|
416
416
|
## Code of Conduct
|
|
417
417
|
|
|
418
|
-
Everyone interacting in the Gitlab::Danger project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/gitlab-org/gitlab-dangerfiles/blob/master/CODE_OF_CONDUCT.md).
|
|
418
|
+
Everyone interacting in the Gitlab::Danger project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/blob/master/CODE_OF_CONDUCT.md).
|
data/lefthook.yml
CHANGED
|
@@ -13,34 +13,34 @@ module Danger
|
|
|
13
13
|
NO_CHANGELOG_CATEGORIES = %i[docs none].freeze
|
|
14
14
|
CHANGELOG_TRAILER_REGEX = /^(?<name>Changelog):\s*(?<category>.+)$/i.freeze
|
|
15
15
|
CHANGELOG_EE_TRAILER_REGEX = /^EE: true$/.freeze
|
|
16
|
-
CHANGELOG_MODIFIED_URL_TEXT = "**CHANGELOG.md was edited.** Please remove the additions and follow the [changelog guidelines](https://docs.gitlab.com/
|
|
17
|
-
CHANGELOG_MISSING_URL_TEXT = "**[CHANGELOG missing](https://docs.gitlab.com/
|
|
16
|
+
CHANGELOG_MODIFIED_URL_TEXT = "**CHANGELOG.md was edited.** Please remove the additions and follow the [changelog guidelines](https://docs.gitlab.com/development/changelog/).\n\n"
|
|
17
|
+
CHANGELOG_MISSING_URL_TEXT = "**[CHANGELOG missing](https://docs.gitlab.com/development/changelog/)**:\n\n"
|
|
18
18
|
IF_REVERT_MR_TEXT = <<~MARKDOWN
|
|
19
|
-
In a revert merge request? Use the revert merge request template to add labels [that skip changelog checks](https://docs.gitlab.com/
|
|
19
|
+
In a revert merge request? Use the revert merge request template to add labels [that skip changelog checks](https://docs.gitlab.com/development/pipelines/#revert-mrs).
|
|
20
20
|
|
|
21
21
|
Reverting something in the current milestone? A changelog isn't required. Skip changelog checks by adding `~"regression:*"` label, then re-run the danger job (there is a link at the bottom of this comment).
|
|
22
22
|
MARKDOWN
|
|
23
23
|
|
|
24
24
|
OPTIONAL_CHANGELOG_MESSAGE = {
|
|
25
|
-
local: "If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/
|
|
25
|
+
local: "If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/development/changelog/#what-warrants-a-changelog-entry), feel free to ignore this message.",
|
|
26
26
|
ci: <<~MSG
|
|
27
27
|
If this merge request needs a changelog entry, add the `Changelog` trailer to the commit message you want to add to the changelog.
|
|
28
28
|
|
|
29
|
-
If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/
|
|
29
|
+
If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/development/changelog/#what-warrants-a-changelog-entry), feel free to ignore this message.
|
|
30
30
|
MSG
|
|
31
31
|
}.freeze
|
|
32
|
-
SEE_DOC = "See the [changelog documentation](https://docs.gitlab.com/
|
|
32
|
+
SEE_DOC = "See the [changelog documentation](https://docs.gitlab.com/development/changelog/)."
|
|
33
33
|
|
|
34
34
|
REQUIRED_CHANGELOG_REASONS = {
|
|
35
35
|
db_changes: "introduces a database migration",
|
|
36
36
|
feature_flag_removed: "removes a feature flag"
|
|
37
37
|
}.freeze
|
|
38
38
|
REQUIRED_CHANGELOG_MESSAGE = {
|
|
39
|
-
local: "This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/
|
|
39
|
+
local: "This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/development/changelog/#what-warrants-a-changelog-entry).",
|
|
40
40
|
ci: <<~MSG
|
|
41
41
|
To create a changelog entry, add the `Changelog` trailer to one of your Git commit messages.
|
|
42
42
|
|
|
43
|
-
This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/
|
|
43
|
+
This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/development/changelog/#what-warrants-a-changelog-entry).
|
|
44
44
|
MSG
|
|
45
45
|
}.freeze
|
|
46
46
|
DEFAULT_CHANGELOG_CATEGORIES = %w[
|
|
@@ -191,7 +191,7 @@ module Danger
|
|
|
191
191
|
ee_changes = helper.changed_files(%r{\Aee/})
|
|
192
192
|
|
|
193
193
|
if ee_changes.any? && !ee_changelog? && !required?
|
|
194
|
-
check_result.warning("This MR changes code in `ee/`, but its Changelog commit is missing the [`EE: true` trailer](https://docs.gitlab.com/
|
|
194
|
+
check_result.warning("This MR changes code in `ee/`, but its Changelog commit is missing the [`EE: true` trailer](https://docs.gitlab.com/development/changelog/#gitlab-enterprise-changes). Consider adding it to your Changelog commits.")
|
|
195
195
|
end
|
|
196
196
|
|
|
197
197
|
if ee_changes.empty? && ee_changelog?
|
|
@@ -199,7 +199,7 @@ module Danger
|
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
if ee_changes.any? && ee_changelog? && required_reasons.include?(:db_changes) && non_ee_database_migration_changes?
|
|
202
|
-
check_result.warning("This MR has a Changelog commit with the `EE: true` trailer, but there are database changes which [requires](https://docs.gitlab.com/
|
|
202
|
+
check_result.warning("This MR has a Changelog commit with the `EE: true` trailer, but there are database changes which [requires](https://docs.gitlab.com/development/changelog/#what-warrants-a-changelog-entry) the Changelog commit to not have the `EE: true` trailer. Consider removing the `EE: true` trailer from your commits.")
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
check_result
|
|
@@ -7,7 +7,7 @@ module Danger
|
|
|
7
7
|
# Common helper functions for our danger scripts. See Danger::Helper
|
|
8
8
|
# for more details
|
|
9
9
|
class CommitMessages < Danger::Plugin
|
|
10
|
-
COMMIT_MSG_DOC = "https://docs.gitlab.com/
|
|
10
|
+
COMMIT_MSG_DOC = "https://docs.gitlab.com/development/contributing/merge_request_workflow/#commit-messages-guidelines"
|
|
11
11
|
MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MSG_DOC}).".freeze
|
|
12
12
|
THE_DANGER_JOB_TEXT = "the `%<job_name>s` job"
|
|
13
13
|
MAX_COMMITS_COUNT_EXCEEDED_MESSAGE = <<~MSG
|
|
@@ -7,6 +7,7 @@ module Gitlab
|
|
|
7
7
|
class BaseLinter
|
|
8
8
|
MIN_SUBJECT_WORDS_COUNT = 3
|
|
9
9
|
MAX_LINE_LENGTH = 72
|
|
10
|
+
PREFIX_REGEX = /\A(\[[^\]]+\]|[^:\s]+:)\s/
|
|
10
11
|
|
|
11
12
|
attr_reader :commit, :problems
|
|
12
13
|
|
|
@@ -92,11 +93,17 @@ module Gitlab
|
|
|
92
93
|
return false if subject_starts_with_a_space?
|
|
93
94
|
return false if ("A".."Z").cover?(subject[0])
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
if PREFIX_REGEX.match?(subject)
|
|
97
|
+
first_char = subject.sub(PREFIX_REGEX, "")[0]
|
|
98
|
+
return true if first_char.nil?
|
|
98
99
|
|
|
99
|
-
|
|
100
|
+
first_char_downcased = first_char.downcase
|
|
101
|
+
return true unless ("a".."z").cover?(first_char_downcased)
|
|
102
|
+
|
|
103
|
+
false
|
|
104
|
+
else
|
|
105
|
+
true
|
|
106
|
+
end
|
|
100
107
|
end
|
|
101
108
|
|
|
102
109
|
def subject_ends_with_a_period?
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
module Gitlab
|
|
4
4
|
module Dangerfiles
|
|
5
5
|
module TitleLinting
|
|
6
|
-
|
|
6
|
+
# Matches the markers a title starts with, one or several in a row, and
|
|
7
|
+
# a WIP or draft it ends with. The same markers anywhere else in a title
|
|
8
|
+
# are part of its text.
|
|
9
|
+
DRAFT_REGEX = /\A(?:(?:\[WIP\]|WIP:|\[draft\]|\(draft\)|draft:|draft\s-\s)\s*)+|(?:WIP|draft)\z/i.freeze
|
|
7
10
|
CHERRY_PICK_REGEX = /cherry[\s-]*pick/i.freeze
|
|
8
11
|
RUN_ALL_RSPEC_REGEX = /RUN ALL RSPEC/i.freeze
|
|
9
12
|
RUN_AS_IF_FOSS_REGEX = /RUN AS-IF-FOSS/i.freeze
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitlab-dangerfiles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitLab
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|