Skip to content

Conversation

@GeorgeSapkin
Copy link
Member

@GeorgeSapkin GeorgeSapkin commented Nov 7, 2025

Refactor checks into separate functions to be more maintainable in preparation for posting formality check results to GitHub (next PR).

Check for more guideline violations based on https://openwrt.org/submitting-patches#submission_guidelines

  • Check if first word after prefix is capitalized (my personal pet peeve). Results in an error.

  • Check if subject ends with a period. Results in an error as well.

  • Check subject line and body line lengths and colorize the excess. Warn on soft subject length failure (50 chars) and error on hard (60 chars). Exclude Weblate commits from these checks.

Improve readability of ci_helper output by omitting unnecessary columns.

Example output with various scenarios: https://github.com/GeorgeSapkin/openwrt-packages/actions/runs/19236252019/job/54986863750?pr=1#step:5:1

Related discussion: openwrt/packages#27790

@GeorgeSapkin GeorgeSapkin force-pushed the formal-check-for-more-guideline-violations branch from e710b0f to 6e78b54 Compare November 7, 2025 23:11
line_num=$((line_num + 1))
if [ ${#line} -gt "$MAX_BODY_LINE_LEN" ]; then
warn "Commit body line $line_num is longer than $MAX_BODY_LINE_LEN characters (is ${#line}):"
split_err "$MAX_BODY_LINE_LEN" "$line"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, if we want to be such strict for commit description, because something I put there what it fixes, which error I've experienced and that usually contains more than 75 characters on one row. :-(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a warning and not an error, i.e the job will still pass. Same for subject.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you are completely right. I dont know how I missed it. Writing comments after midnight is not always a good idea. :)


# Check subject length
if [ ${#subject} -gt "$MAX_SUBJECT_LEN" ]; then
warn "Commit subject line is longer than $MAX_SUBJECT_LEN characters (is ${#subject})"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that the more rules there are, the more complicated it will simply be, but at this point I think that enforcing a rule that the commit subject should be brief, precise, simple and concise is something we want, and that it shouldn't be a warning, but an error.
An example is this pull request: openwrt/packages#27564, the GitHub UI hid that subject because it's simply too long, which should have helped tell the user that it's long, but apparently that didn't happen. Just to be sure, here's a link to the commit itself: openwrt/packages@a5a7ca7

On the other hand, the commit description can be a warning. Wrapping or not wrapping at 75 characters per line doesn't bother me personally.

Copy link
Member Author

@GeorgeSapkin GeorgeSapkin Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud here. Maybe we can add soft and hard limits? Warning at 50, error at 60? Some package names like the one in your example, take more than half of the 50 character budget.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... Sounds great!

Copy link
Member

@BKPepe BKPepe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. 👍 Thank you, @GeorgeSapkin

@Ansuel your thoughts?

@GeorgeSapkin GeorgeSapkin force-pushed the formal-check-for-more-guideline-violations branch from 6e78b54 to 6a1ea72 Compare November 10, 2025 13:29
Improve readability of CI output by omitting unnecessary columns.

Signed-off-by: George Sapkin <[email protected]>
Refactor checks into separate functions to be more maintainable in
preparation for posting formality check results to GitHub.

Check for more guideline violations based on
https://openwrt.org/submitting-patches#submission_guidelines

- Check if first word after prefix is capitalized.
- Check if subject ends with a period.
- Check subject line and body line lengths and colorize the excess. Warn
  on soft subject length failure (50 chars) and error on hard (60 chars
  ). Exclude Weblate commits from these checks.

Signed-off-by: George Sapkin <[email protected]>
@GeorgeSapkin GeorgeSapkin force-pushed the formal-check-for-more-guideline-violations branch from 6a1ea72 to ed92aba Compare November 10, 2025 15:15
@GeorgeSapkin GeorgeSapkin changed the title formal: check for more guideline violations formal: refactor and check for more guideline violations Nov 10, 2025
@GeorgeSapkin
Copy link
Member Author

GeorgeSapkin commented Nov 10, 2025

I have refactor checks into separate functions to be more maintainable in preparation for posting formality check results to GitHub (next PR) which will be configured at the repo side (i.e. opt-in) and look something like this:

(commit hashes are clickable in an actual PR)


Warning

Some formality checks failed.

Consider (re)reading submissions guidelines

Failed checks

Issues marked with a stop sign 🛑 are failing checks.

Commit 1b3158ac23041c9aa07f08fa17fabe05b336886b

  • ⚠️ Author name (?) seems to be a nickname or an alias
  • 🛑 Signed-off-by is missing or doesn't match author (should be Signed-off-by: ? <[email protected]>)

Commit adfcad580fad4828d7227824c824998571d84ea5

  • 🛑 Signed-off-by is missing or doesn't match author (should be Signed-off-by: George Sapkin <[email protected]>)
  • 🛑 Signed-off-by email cannot be a GitHub noreply email

Commit fa00178319f058f4ede84c4b5988ef47f06dbb10

  • 🛑 Signed-off-by is missing or doesn't match author (should be Signed-off-by: George Sapkin <[email protected]>)
  • 🛑 Commit message is missing. Please describe your changes.

Commit 80ef743772929b0ea838fdd35e870da31545fdd3

  • 🛑 Commit message is missing. Please describe your changes.

Commit 24f5ed50b8eb2435f511ac5c68d75e1f40bc31d1

  • 🛑 Commit subject line is longer than 50 characters (is 61)
  • 🛑 Signed-off-by is missing or doesn't match author (should be Signed-off-by: George Sapkin <[email protected]>)

Commit efdd422be6e6254871d212ab22a2650fcc6033e8

  • 🛑 Commit subject line MUST start with <package name>:

Commit d4a18b1085b0c88fb48a22a78edb2554b4a34a7f

  • ⚠️ Commit body line 3 is longer than 75 characters (is 111):
    Example line that is longer than 75 characters, which is not acceptable according to the submission guidelines.
  • ⚠️ Commit body line 7 is longer than 75 characters (is 86):
    Another example line that is also is longer than 75 characters, and it's still not OK.

Commit eb99d6415a3f1f67f1bd87c32221c10e175cc249

  • ⚠️ Commit subject line is longer than 50 characters (is 54)

Commit e02f3ea62a864eff7bef9996f18388786c26ce39

  • 🛑 First word after prefix in subject should not be capitalized

Commit 4dc4d27aa5654e8b7c9168b919af105c981d79df

  • 🛑 Commit subject line should not end with a period

For more details, see the full job log.

@GeorgeSapkin
Copy link
Member Author

@systemcrash can you double-check the Weblate logic, when you have time? I've been looking at this for so long, I probably missed something again 🫎

@systemcrash
Copy link
Contributor

weblate looks OK I think. But need it be flagged as 'warn'?

@GeorgeSapkin
Copy link
Member Author

weblate looks OK I think. But need it be flagged as 'warn'?

Not really. My though process is that it's something that's only shown in the job log, and only for Weblate jobs. It's not failing the job and it's not going to be show in the future GitHub comment. So in case somebody abuses this logic in a normal PR (i.e. author with a Weblate email), it's better that it slightly stands out. I don't have strong feeling about it either way.

@systemcrash
Copy link
Contributor

Fair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants