[tracker/wip/carlosg/ci-pipelines: 3/7] ci: Add some additional commit formatting rules




commit ca35a190e5aff1bafeae05f586ae098ad3a5762b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Feb 19 11:36:42 2022 +0100

    ci: Add some additional commit formatting rules
    
    For ci-fairy check-commits to pick it up. These are mostly cosmetic:
    - Require that the commit subject has a prefix
    - Prevent commits from having links to the merge request itself
      (should be already there via merge commits)
    - Ensure commit subjects are properly capitalized
    - Avoid code filenames in commit subject
    
    We could add some further things in the future, like enforcing a
    set of prefixes to use in commit log subjects.

 .gitlab-ci/commit-rules.yml | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/.gitlab-ci/commit-rules.yml b/.gitlab-ci/commit-rules.yml
new file mode 100644
index 000000000..fbd78a35d
--- /dev/null
+++ b/.gitlab-ci/commit-rules.yml
@@ -0,0 +1,13 @@
+patterns:
+  require:
+    - regex: '^[^:]+: +[^ ]'
+      message: "Commit message subject must have a prefix. E.g. 'tests: '"
+  deny:
+    - regex: '^$CI_MERGE_REQUEST_PROJECT_URL/(-/)?merge_requests/$CI_MERGE_REQUEST_IID$'
+      message: "Commit message must not contain a link to its own merge request"
+    - regex: '^[^:]+: [a-z]'
+      message: "Commit message subject should be properly Capitalized. E.g.  'cli: Fix help subcommand'"
+      where: subject
+    - regex: '^\S*\.[ch]:'
+      message: Commit message subject prefix should not include .c, .h, etc.
+      where: subject


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]