Add trailing newline and whitespace checks #11
Draft
BKPepe wants to merge 2 commits intoGeorgeSapkin:mainfrom
Draft
Add trailing newline and whitespace checks #11BKPepe wants to merge 2 commits intoGeorgeSapkin:mainfrom
BKPepe wants to merge 2 commits intoGeorgeSapkin:mainfrom
Conversation
This adds a new check to verify GPG/SSH signatures on commits. The check reports the signature status (Good, Bad, Unknown, etc.) and validates it: - Good (G): PASS - Bad (B), Revoked (R), Error (E): FAIL - Unknown (U), Expired (X, Y): WARN - None (N): SKIP The test suite has been updated to cover these changes and to enforce commit.gpgsign=false within the test environment to ensure deterministic results. Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit introduces two new checks for file content formality: 1. Trailing Newline Check (Mandatory): - Ensures that all modified files end with a newline character. - Files missing a newline at the end will fail the check. - Configurable via 'check_trailing_newline' input (default: true). 2. Trailing Whitespace Check (Warning): - Checks for trailing whitespace on lines in modified files. - Uses 'git show --check' to detect whitespace issues. - Issues a warning but does not fail the check by default. - Configurable via 'check_trailing_whitespace' input (default: true). Updates: - src/check_formalities.sh: Implements the 'check_content' function and integrates it into the main loop. - src/test.sh: Adds support for injecting custom file content in test commits and adds 4 new test cases covering the new checks. Updates all existing test expectations. - README.md: Documents the new rules and configuration inputs.
Failed checksIssues marked with an ❌ are failing checks. Commit c4d5a2c
For more details, see the full job log. Something broken? Consider providing feedback. |
| echo "Summary: $pass_count/$test_count tests passed" | ||
|
|
||
| [ "$pass_count" != "$test_count" ] \ | ||
| [ "$pass_count" -ne "$test_count" ] \ |
There was a problem hiding this comment.
Isn't -ne only for numeric values, but these are surrounded in quotes and therefore are strings, so this should be left as != ?
There was a problem hiding this comment.
Just read it. If it solves an issue and works, then makes sense to keep it.
|
@BKPepe One question: Were you intending to have this also enforce |
Owner
|
I think content checks go a bit outside of formalities: they should be optional, behind a flag and probably in some kind of an extension system. Same goes for OpenWrt-specific checks, e.g. package version, release, hash, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This time, I let the AI to write this.
Will need to check this.