aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2021-11-12 15:48:44 +0000
committerChris Kay <chris.kay@arm.com>2021-11-17 16:04:36 +0000
commitfa3a13824a8b025cbd69c0efa435892c81734448 (patch)
treea0ca3e632337c2bcef39209e817440318aec0a8a
parentdc59d726e79c26b5a3ee2f1cea2e903d5dd1e191 (diff)
downloadarm-trusted-firmware-fa3a13824a8b025cbd69c0efa435892c81734448.tar.gz
build(hooks): add commitlint checks for trailers
This change adds checks for the `Change-Id` and `Signed-off-by` trailers. These are already required by Gerrit, so they have been configured as warnings as an early heads-up after committing without needing to push. This also renames the commitlint configuration file to align it with the style used by Standard Version when it's eventually introduced: `commitlint.config.js` -> `.commitlintrc.js` Change-Id: I4e3c158e6b3a5407fabd873360d5efce86ebd19e Signed-off-by: Chris Kay <chris.kay@arm.com>
-rw-r--r--.commitlintrc.js31
-rw-r--r--commitlint.config.js14
2 files changed, 31 insertions, 14 deletions
diff --git a/.commitlintrc.js b/.commitlintrc.js
new file mode 100644
index 000000000..648246c4a
--- /dev/null
+++ b/.commitlintrc.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/* eslint-env es6 */
+
+"use strict";
+
+const cz = require("./.cz.json");
+const { "trailer-exists": trailerExists } = require("@commitlint/rules").default;
+
+module.exports = {
+ extends: ["@commitlint/config-conventional"],
+ plugins: [
+ {
+ rules: {
+ "signed-off-by-exists": trailerExists,
+ "change-id-exists": trailerExists,
+ },
+ },
+ ],
+ rules: {
+ "body-max-line-length": [1, "always", cz.maxLineWidth], /* Warning */
+ "header-max-length": [1, "always", cz.maxHeaderWidth], /* Warning */
+
+ "change-id-exists": [1, "always", "Change-Id:"], /* Warning */
+ "signed-off-by-exists": [1, "always", "Signed-off-by:"], /* Warning */
+ },
+};
diff --git a/commitlint.config.js b/commitlint.config.js
deleted file mode 100644
index 94cad8f2b..000000000
--- a/commitlint.config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* eslint-env node */
-
-"use strict";
-
-const config = require("./.cz.json");
-
-module.exports = {
- extends: ["@commitlint/config-conventional"],
- rules: {
- "header-max-length": [1, "always", config.maxHeaderWidth], /* Warning */
- "body-max-line-length": [1, "always", config.maxLineWidth], /* Warning */
- "signed-off-by": [0, "always", "Signed-off-by:"] /* Disabled - buggy */
- }
-};