gitlab-dangerfiles 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/helper.rb +28 -89
- data/lib/danger/roulette.rb +56 -31
- data/lib/gitlab/dangerfiles.rb +0 -34
- data/lib/gitlab/dangerfiles/version.rb +1 -1
- metadata +2 -24
- data/lib/danger/changelog.rb +0 -39
- data/lib/danger/sidekiq_queues.rb +0 -37
- data/lib/gitlab/dangerfiles/bundle_size/Dangerfile +0 -38
- data/lib/gitlab/dangerfiles/ce_ee_vue_templates/Dangerfile +0 -56
- data/lib/gitlab/dangerfiles/changelog/Dangerfile +0 -90
- data/lib/gitlab/dangerfiles/changes_size/Dangerfile +0 -17
- data/lib/gitlab/dangerfiles/commit_messages/Dangerfile +0 -135
- data/lib/gitlab/dangerfiles/database/Dangerfile +0 -67
- data/lib/gitlab/dangerfiles/documentation/Dangerfile +0 -29
- data/lib/gitlab/dangerfiles/duplicate_yarn_dependencies/Dangerfile +0 -29
- data/lib/gitlab/dangerfiles/eslint/Dangerfile +0 -31
- data/lib/gitlab/dangerfiles/frozen_string/Dangerfile +0 -28
- data/lib/gitlab/dangerfiles/karma/Dangerfile +0 -51
- data/lib/gitlab/dangerfiles/metadata/Dangerfile +0 -50
- data/lib/gitlab/dangerfiles/popen.rb +0 -55
- data/lib/gitlab/dangerfiles/prettier/Dangerfile +0 -41
- data/lib/gitlab/dangerfiles/roulette/Dangerfile +0 -97
- data/lib/gitlab/dangerfiles/sidekiq_queues/Dangerfile +0 -27
- data/lib/gitlab/dangerfiles/specs/Dangerfile +0 -42
- data/lib/gitlab/dangerfiles/tasks.rb +0 -19
- data/lib/gitlab/dangerfiles/telemetry/Dangerfile +0 -32
- data/lib/gitlab/dangerfiles/utility_css/Dangerfile +0 -51
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
NO_SPECS_LABELS = [
|
4
|
-
'backstage', # To be removed by https://gitlab.com/gitlab-org/gitlab/-/issues/222360.
|
5
|
-
'tooling',
|
6
|
-
'tooling::pipelines',
|
7
|
-
'tooling::workflow',
|
8
|
-
'documentation',
|
9
|
-
'QA'
|
10
|
-
].freeze
|
11
|
-
NO_NEW_SPEC_MESSAGE = <<~MSG
|
12
|
-
You've made some app changes, but didn't add any tests.
|
13
|
-
That's OK as long as you're refactoring existing code,
|
14
|
-
but please consider adding any of the %<labels>s labels.
|
15
|
-
MSG
|
16
|
-
EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE = <<~MSG
|
17
|
-
You've made some EE-specific changes, but only made changes to FOSS tests.
|
18
|
-
This could be a sign that you're testing an EE-specific behavior in a FOSS test.
|
19
|
-
|
20
|
-
Please make sure the spec files pass in AS-IF-FOSS mode either:
|
21
|
-
|
22
|
-
1. Locally with `FOSS_ONLY=1 bin/rspec -- %<spec_files>s`.
|
23
|
-
1. In the MR pipeline by verifying that the `rspec foss-impact` job has passed.
|
24
|
-
1. In the MR pipelines by including `RUN AS-IF-FOSS` in the MR title (you can do it with the ``/title %<mr_title>s [RUN AS-IF-FOSS]`` quick action) and start a new MR pipeline.
|
25
|
-
|
26
|
-
MSG
|
27
|
-
|
28
|
-
has_app_changes = helper.all_changed_files.grep(%r{\A(app|lib|db/(geo/)?(post_)?migrate)/}).any?
|
29
|
-
has_ee_app_changes = helper.all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?migrate)/}).any?
|
30
|
-
spec_changes = helper.all_changed_files.grep(%r{\Aspec/})
|
31
|
-
has_spec_changes = spec_changes.any?
|
32
|
-
has_ee_spec_changes = helper.all_changed_files.grep(%r{\Aee/spec/}).any?
|
33
|
-
new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty?
|
34
|
-
|
35
|
-
if (has_app_changes || has_ee_app_changes) && !(has_spec_changes || has_ee_spec_changes) && new_specs_needed
|
36
|
-
warn format(NO_NEW_SPEC_MESSAGE, labels: helper.labels_list(NO_SPECS_LABELS)), sticky: false
|
37
|
-
end
|
38
|
-
|
39
|
-
# The only changes outside `ee/` are in `spec/`
|
40
|
-
if has_ee_app_changes && has_spec_changes && !(has_app_changes || has_ee_spec_changes)
|
41
|
-
warn format(EE_CHANGE_WITH_FOSS_SPEC_CHANGE_MESSAGE, spec_files: spec_changes.join(" "), mr_title: gitlab.mr_json['title']), sticky: false
|
42
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
desc "Run local Danger rules"
|
4
|
-
task :danger_local do
|
5
|
-
require "gitlab/dangerfiles"
|
6
|
-
require "popen/danger/popen"
|
7
|
-
|
8
|
-
puts("#{Gitlab::Dangerfiles.local_warning_message}\n")
|
9
|
-
|
10
|
-
# _status will _always_ be 0, regardless of failure or success :(
|
11
|
-
output, _status = Gitlab::Dangerfiles::Popen.popen(%w{danger dry_run})
|
12
|
-
|
13
|
-
if output.empty?
|
14
|
-
puts(Gitlab::Dangerfiles.success_message)
|
15
|
-
else
|
16
|
-
puts(output)
|
17
|
-
exit(1)
|
18
|
-
end
|
19
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
TELEMETRY_CHANGED_FILES_MESSAGE = <<~MSG
|
4
|
-
For the following files, a review from the [Data team and Telemetry team](https://gitlab.com/groups/gitlab-org/growth/telemetry/engineers/-/group_members?with_inherited_permissions=exclude) is recommended
|
5
|
-
Please check the ~telemetry [guide](https://docs.gitlab.com/ee/development/telemetry/usage_ping.html) and reach out to @gitlab-org/growth/telemetry/engineers group for a review.
|
6
|
-
|
7
|
-
%<changed_files>s
|
8
|
-
|
9
|
-
MSG
|
10
|
-
|
11
|
-
tracking_files = [
|
12
|
-
'lib/gitlab/tracking.rb',
|
13
|
-
'spec/lib/gitlab/tracking_spec.rb',
|
14
|
-
'app/helpers/tracking_helper.rb',
|
15
|
-
'spec/helpers/tracking_helper_spec.rb',
|
16
|
-
'app/assets/javascripts/tracking.js',
|
17
|
-
'spec/frontend/tracking_spec.js'
|
18
|
-
]
|
19
|
-
|
20
|
-
usage_data_changed_files = git.modified_files.grep(%r{usage_data})
|
21
|
-
snowplow_events_changed_files = git.modified_files & tracking_files
|
22
|
-
|
23
|
-
changed_files = (usage_data_changed_files + snowplow_events_changed_files)
|
24
|
-
|
25
|
-
if changed_files.any?
|
26
|
-
warn format(TELEMETRY_CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(changed_files))
|
27
|
-
|
28
|
-
telemetry_labels = ['telemetry']
|
29
|
-
telemetry_labels << 'telemetry::review pending' unless helper.mr_has_labels?('telemetry::reviewed')
|
30
|
-
|
31
|
-
markdown(helper.prepare_labels_for_mr(telemetry_labels))
|
32
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
common = 'app/assets/stylesheets/framework/common.scss'
|
4
|
-
utilities = 'app/assets/stylesheets/utilities.scss'
|
5
|
-
|
6
|
-
def get_css_files(files, common_filepath, utilities_filepath)
|
7
|
-
files.select do |file|
|
8
|
-
file.include?(common_filepath) ||
|
9
|
-
file.include?(utilities_filepath)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
changed_util_files = get_css_files(helper.all_changed_files.to_a, common, utilities)
|
14
|
-
|
15
|
-
unless changed_util_files.empty?
|
16
|
-
|
17
|
-
markdown(<<~MARKDOWN)
|
18
|
-
## Changes to utility SCSS files
|
19
|
-
MARKDOWN
|
20
|
-
|
21
|
-
if changed_util_files.include?(common)
|
22
|
-
|
23
|
-
markdown(<<~MARKDOWN)
|
24
|
-
### Addition to `#{common}`
|
25
|
-
|
26
|
-
You have added a new rule to `#{common}`. Are you sure you need this rule?
|
27
|
-
|
28
|
-
If it is a component class shared across items, could it be added to the component as a utility class or to the component's stylesheet? If not, you can ignore this warning.
|
29
|
-
|
30
|
-
If it is a new utility class, is there another class that shares the same values in either this file or in `#{utilities}`? If not, please add it to `#{utilities}`, following the [Gitlab UI naming style](https://unpkg.com/browse/@gitlab/ui/src/scss/utilities.scss).
|
31
|
-
|
32
|
-
MARKDOWN
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
if changed_util_files.include?(utilities)
|
37
|
-
markdown(<<~MARKDOWN)
|
38
|
-
### Addition to `#{utilities}`
|
39
|
-
|
40
|
-
You have added a new rule to `#{utilities}`. Are you sure you need this rule?
|
41
|
-
|
42
|
-
If it is a component class shared across items, could it be added to the component as a utility class or to the component's stylesheet? If not, consider adding it to `#{common}`
|
43
|
-
|
44
|
-
If it is a new utility class, is there another class that shares the same values in either this file or in `#{utilities}`? If not, please be sure this addition follows the [Gitlab UI naming style](https://unpkg.com/browse/@gitlab/ui/src/scss/utilities.scss) so it may be removed when these rules are included. See [Include gitlab-ui utility-class library](https://gitlab.com/gitlab-org/gitlab/issues/36857) for more about this project.
|
45
|
-
|
46
|
-
MARKDOWN
|
47
|
-
end
|
48
|
-
|
49
|
-
warn "This merge request adds a new rule to #{common} or #{utilities}."
|
50
|
-
|
51
|
-
end
|