From 47d1b8238234ae118759ddef19ecd775b83d3538 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 4 May 2022 22:43:26 +0200 Subject: [PATCH] tweak(ci): generalize commit linter defaults So Doom can be used for general CI/CD (as part of doomemacs/ci). These settings can be configured in .github/ci.el by default. Ref: 0f6a653a1376 --- core/cli/ci.el | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/core/cli/ci.el b/core/cli/ci.el index 88a8bca9b..3d97df68b 100644 --- a/core/cli/ci.el +++ b/core/cli/ci.el @@ -55,24 +55,16 @@ Accapted value types can be one or more of ref, hash, url, username, or name.") Accapted value types can be one or more of ref, hash, url, username, or name.") (defvar doom-cli-commit-types - '(bump dev docs feat fix merge module nit perf refactor release revert test tweak) + '(bump dev docs feat fix merge nit perf refactor release revert test tweak) "A list of valid commit types.") -(defvar doom-cli-commit-scopes - (list "cli" - "ci" - "lib" - "docs" - (fn! (scope (&key type)) - (when (and (memq type '(bump merge module release revert)) - scope) - (user-error "%s commits should never have a scope" type))) - (fn! (scope _) - (seq-find (doom-rpartial - #'doom-glob (if (string-prefix-p ":" scope) - (format "%s" (substring scope 1)) - (format "*/%s" scope))) - doom-modules-dirs))) +(defvar doom-cli-commit-scopeless-types '(bump merge release revert) + "A list of commit types whose scopes should be passed in its BODY. + + Don't: \"bump(SCOPE): ...\" + Do: \"bump: SCOPE\"") + +(defvar doom-cli-commit-scopes '("ci") "A list of valid commit scopes as strings or functions. Functions should take two arguments: a single scope (symbol) and a commit plist @@ -122,8 +114,8 @@ representing the current commit being checked against. See (fn! (&key type scopes summary) "Complain about scoped types that are incompatible with scopes" - (and (memq type '(bump revert merge module release)) - scopes + (and scopes + (memq type doom-cli-commit-scopeless-types) (fail! "Scopes for %s commits should go after the colon, not before" type)))