coreboot/util/lint
Nicholas Sudsgaard 48207895af lint: Warn about using change IDs for merged changes
This script will warn and suggest fixes when a CB:<change-id> of an
already merged change is found in the commit message. This should
enforce the clarification that was added to the documentation in
CB:88776.

This script requires a JSON parser (i.e. jq) to parse Gerrit's
REST API[1]. While it may be possible to grep the values, we chose to
use a proper parser to ensure there would be no false-positives.

TEST=
Prepare a commit with the following commit message:

  Here are some open changes: CB:88614 CB:88717 CB:87282
  Here are some abandoned changes: CB:88413 CB:84504 CB:82136
  Here are some merged changes: CB:88566 CB:88598 CB:88697
  Here are some old merged commits: CB:1 CB:50 CB:950
  Here are some wrong stuff: CL:100 CB:TEST CB:99999

The script produces the following result (may change in the future when
open changes are merged etc):

  Using a change ID (CB:88566) for an already merged commit; please replace it with:
  commit 21639c3771 ("mb/getac/p470: Use common gpio functions")
  Using a change ID (CB:88598) for an already merged commit; please replace it with:
  commit 05a38e2af3 ("mb/google/fatcat: Disable memory training progress bar")
  Using a change ID (CB:88697) for an already merged commit; please replace it with:
  commit 1da2f46db8 ("soc/intel/alderlake: Restore mem_init_override_channel_mask()")
  Using a change ID (CB:1) for an already merged commit; please replace it with:
  commit 140a990a61 ("Teach abuild to emit JUnit formatted build reports")
  Using a change ID (CB:50) for an already merged commit; please replace it with:
  commit 7c634ae8c1 ("msrtool: added support for Intel CPUs")
  Using a change ID (CB:950) for an already merged commit; please replace it with:
  commit c31384e62c ("Fix up Sandybridge C state generation code")
  CB:99999 does not exist

[1] https://gerrit-review.googlesource.com/Documentation/rest-api.html

Change-Id: I1c72f739b1f47b1227ef1e158b1553aa56945d7e
Signed-off-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88715
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
2025-08-19 20:57:26 +00:00
..
check-style
check_lint_tests util/lint: Add lint tests to make sure they fail correctly 2022-09-04 16:43:50 +00:00
checkpatch.pl lint/checkpatch: Add __aligned to the list of attribute notes 2025-01-10 13:46:38 +00:00
checkpatch_json.py util/lint: Clear syntax warnings in Python 3.12 2025-01-17 00:34:29 +00:00
const_structs.checkpatch
coreboot.dict util/lint: Add coreboot specific dictionary file 2022-06-22 21:40:19 +00:00
description.md
helper_functions.sh util/lint: Fix linting outside of git repos 2022-10-21 14:30:42 +00:00
kconfig_lint util/lint/kconfig_lint: Fix operator precedence issue 2025-08-02 01:46:36 +00:00
kconfig_lint_README
lint util/lint: Add support for FreeBSD 2025-03-10 15:17:36 +00:00
lint-000-license-headers util/lint/lint-000-license-headers: Add license 2025-02-14 17:11:40 +00:00
lint-001-no-global-config-in-romstage tree: Replace egrep with grep -E 2023-04-06 19:54:44 +00:00
lint-007-checkpatch lib/jpeg: Replace decoder with Wuffs' implementation 2023-12-13 16:17:34 +00:00
lint-008-kconfig util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-014-qualified-types util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-extended-007-checkpatch util/lint: Remove missing dirs from checkpatch linter 2025-06-29 22:34:57 +00:00
lint-extended-015-final-newlines util/lint: Improve final newline check 2025-06-29 22:34:38 +00:00
lint-extended-020-signed-off-by util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-extended-025-merged-change-ids lint: Warn about using change IDs for merged changes 2025-08-19 20:57:26 +00:00
lint-stable-000-license-headers util/lint: Update to check all of src for license headers 2022-08-17 19:43:30 +00:00
lint-stable-003-whitespace lint-stable-003-whitespace: Exclude DTB files 2024-05-27 08:02:26 +00:00
lint-stable-004-style-labels lib/jpeg: Replace decoder with Wuffs' implementation 2023-12-13 16:17:34 +00:00
lint-stable-005-board-status util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-006-board-name
lint-stable-008-kconfig util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-009-old-licenses util/riscv: Add starfive Image building tool 2025-02-14 17:11:34 +00:00
lint-stable-010-asm-syntax util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-012-executable-bit util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-013-site-local util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-016-non-ascii util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-017-configs util/lint/stable-017: Update full config pattern matching 2023-04-06 15:11:44 +00:00
lint-stable-018-symlinks util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-019-header-files util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-021-coreboot-lowercase util/lint: Ignore binary files for cb lowercase linter 2025-06-29 22:33:23 +00:00
lint-stable-022-clang-format util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-023-filenames util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-024-kconfig-no-subsystem
lint-stable-026-line-endings util/lint: Update tools that use git to use a library 2022-09-30 19:19:53 +00:00
lint-stable-027-maintainers-syntax
lint-stable-028-touchpad-probed-warning util/lint: Add a check for touchpads using the "probed" flag 2022-09-14 20:52:02 +00:00
lint-stable-029-kconfig-name-selects util/lint: Add linter to keep selects out of Kconfig.name 2023-11-18 01:58:24 +00:00
lint-stable-030-makefile-inc util/lint: Add lint rule to watch for Makefile.inc 2024-04-20 21:08:36 +00:00
lint-stable-031-gofmt util/lint: Add lint file for gofmt 2025-05-10 22:49:22 +00:00
Makefile util: Add SPDX license headers to Makefiles 2022-11-22 12:47:09 +00:00
remccoms3.sed
spelling.txt util/lint: Fix some mistakes in spelling.txt 2023-11-01 15:26:57 +00:00