[bug] checkcommit crashes with IndexError when the message has only a prefix

Aperta
#789 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@nemesifier ci sta già lavorando.

Dal 23/10/2026.

  • #790 di @nemesifier — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Describe the bug

checkcommit crashes with an IndexError instead of printing the usual style errors when the commit message only has a prefix and no description after it.

Steps To Reproduce

checkcommit --message "[fix]"
  File "openwisp_utils/qa.py", line 108, in check_commit_message
    if not suffix[0].isupper():
IndexError: string index out of range

The same happens with "[fix] " and with "[fix]\n\nsome body". An empty message is handled fine (exits with the "missing prefix" error).

Expected behavior

Exit with status 1 and the usual guidelines message, with an error like "please add a description after the prefix", the same way a missing prefix or a lowercase description is reported.

Notes

The cause is that suffix is empty when nothing follows the prefix. I saw that openwisp-qa-check now validates commits with openwisp-commit --check, so I am not sure if the standalone checkcommit is still meant to be supported. If it is, I can send a small fix with a test in test_qa.py. I will wait for confirmation before opening a PR.

System Information

  • OS: Windows 11
  • Python Version: 3.13
  • openwisp-utils: master (3497e3f)
Lingua principale
Python
Stelle
96
Fork
127
Merge medio
1g 5h
PR unite (30g)
21

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openwisp/openwisp-utils

Tutte le issue di openwisp/openwisp-utils

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.