diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /danger/utility_css | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'danger/utility_css')
-rw-r--r-- | danger/utility_css/Dangerfile | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/danger/utility_css/Dangerfile b/danger/utility_css/Dangerfile new file mode 100644 index 00000000000..4f56c40379e --- /dev/null +++ b/danger/utility_css/Dangerfile @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +common = 'app/assets/stylesheets/framework/common.scss' +utilities = 'app/assets/stylesheets/utilities.scss' + +def get_css_files(files, common_filepath, utilities_filepath) + files.select do |file| + file.include?(common_filepath) || + file.include?(utilities_filepath) + end +end + +changed_util_files = get_css_files(helper.all_changed_files.to_a, common, utilities) + +unless changed_util_files.empty? + + markdown(<<~MARKDOWN) + ## Changes to utility SCSS files + MARKDOWN + + if changed_util_files.include?(common) + + markdown(<<~MARKDOWN) + ### Addition to `#{common}` + + You have added a new rule to `#{common}`. Are you sure you need this rule? + + 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. + + 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). + + MARKDOWN + + end + + if changed_util_files.include?(utilities) + markdown(<<~MARKDOWN) + ### Addition to `#{utilities}` + + You have added a new rule to `#{utilities}`. Are you sure you need this rule? + + 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}` + + 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. + + MARKDOWN + end + + warn "This merge request adds a new rule to #{common} or #{utilities}." + +end |