Skip to content

scripts: compliance: Avoid exception when commit message body is empty #89888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025

Conversation

carlescufi
Copy link
Member

@carlescufi carlescufi commented May 13, 2025

Avoid the following exception in the Identity test when the commit body is empty:

Traceback (most recent call last):
  File "zephyr/scripts/ci/check_compliance.py", line 2053, in main
    n_fails = _main(args)
              ^^^^^^^^^^^
  File "zephyr/scripts/ci/check_compliance.py", line 1988, in _main
    test.run()
  File "zephyr/scripts/ci/check_compliance.py", line 1459, in run
    auth_name, auth_email, body = git(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 2)

This is triggered because %b represents the body of the commit message, which can be empty if there's a single line in it, because the first line is considered the title.

Tested here: zephyrproject-rtos/zephyr-testing#347

Avoid the following exception in the Identity test when the commit body
is empty:

Traceback (most recent call last):
  File "zephyr/scripts/ci/check_compliance.py", line 2053, in main
    n_fails = _main(args)
              ^^^^^^^^^^^
  File "zephyr/scripts/ci/check_compliance.py", line 1988, in _main
    test.run()
  File "zephyr/scripts/ci/check_compliance.py", line 1459, in run
    auth_name, auth_email, body = git(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 2)

This is triggered because ``%b`` represents the body of the commit
message, which can be empty if there's a single line in it, because the
first line is considered the title.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Copy link

@fabiobaltieri
Copy link
Member

Do we allow commits with no description?

@carlescufi
Copy link
Member Author

Do we allow commits with no description?

With an empty body? no, but we want the script to complain, not to crash. Right now it was crashing with an exception.

@kartben kartben merged commit 9f7b786 into zephyrproject-rtos:main May 15, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants