-
Notifications
You must be signed in to change notification settings - Fork 1.9k
github: scripts: Skip validations for code blocks on commit linter #11381
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
github: scripts: Skip validations for code blocks on commit linter #11381
Conversation
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
📝 WalkthroughWalkthroughThe pull request adds support for stripping fenced code blocks from commit messages before validation. A new regex pattern and Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.github/scripts/commit_prefix_check.py:
- Around line 238-246: The current branch allows umbrella prefixes (checked via
subj_lower in umbrella_prefixes) even when the commit touches mixed components;
modify the block inside the len(non_build_prefixes) > 1 check to only accept
umbrella prefixes when all changed file paths belong to the umbrella domain(s)
(e.g., all paths start with the umbrella directory like "lib/"); specifically,
when evaluating subj_lower against umbrella_prefixes, add a predicate that
verifies every changed path in the commit is within the umbrella directories
before returning success, otherwise treat it as a mismatch and return the
existing False with expected_str (using subject_prefix, non_build_prefixes,
umbrella_prefixes, and expected to locate and adjust the logic).
In @.github/scripts/tests/test_commit_lint.py:
- Around line 207-208: The test assigns a second return value to msg from
validate_commit(commit) but never uses it; rename msg to _ or _msg to satisfy
RUF059. Update the line "ok, msg = validate_commit(commit)" to "ok, _ =
validate_commit(commit)" or "ok, _msg = validate_commit(commit)" so the unused
variable is clearly ignored while keeping validate_commit and commit references
intact.
…de blocks Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
2ee617d to
96f9299
Compare
This change does not relax commit message validation rules.
It only prevents false positives caused by fenced code blocks
commonly used to include logs, YAML configs, or command output
in Fluent Bit commit messages.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit
Chores
Tests
✏️ Tip: You can customize this high-level summary in your review settings.