Repository navigation
feat(lint): check for a trailing newline - #362
Merged
Merged
Conversation
Check the files changed between the pull request merge base and head. Skip empty files, binary files and deleted paths. The two gitleaks exclusions duplicate the end-of-file-fixer hook. Rules release archives omit the pre-commit configuration, so the shared checker carries the same two paths. Generated-by: LLM harness=codex;model=openai:gpt-6.2-sol Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:538cbd04813c8b8f;surface=exec
Generated-by: LLM harness=codex;model=openai:gpt-6.2-sol Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:da550adca6cf25f3;surface=exec
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.
Why
Pre-commit runs
end-of-file-fixer, but CI has no matching check. A hook bypass or a web edit can put a file without a final newline on main. @tbhb decided on 2026-11-22 that CI checks every new or changed text file.Behavior change
//lint:trailing_newline. It lists the files changed between a base and a head commit and fails on each text file that lacks a final newline. The message gives the path.workspace.jsonand Worker types.repo-checks.ymlruns it on pull requests. The range starts at the merge base from//lint:pr_merge_base, the helper that the commit checks use.Decisions
Deviations from the task
//lint:pr_merge_basefiles from fix(lint): range commit checks from the merge base #361, because this branch predates that merge. The files match main byte for byte.Risk
Mode-only changes and renames of a file that already lacks a newline fail the check. No test compares the checker's excluded paths with the hook, so a new hook exclusion needs a matching edit here.
Verification
//lint:trailing_newline_testcovers a missing newline, a present newline, an empty file, a binary file, a deleted file, each excluded family, a sibling of an excluded path that still fails, and a bad revision (exit 2).//lint:trailing_newline_test, verify the Git subprocess test on Windows and remove the exclusion.Opened-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:debb814921f029ad;surface=cli
Generated-by: LLM harness=codex;model=openai:gpt-6.2-sol
Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:538cbd04813c8b8f;surface=exec
Generated-by: LLM effort=high;harness=codex:0.171.0;model=openai:gpt-6.2-sol;session=sha-256-64:da550adca6cf25f3;surface=exec
Assisted-by: LLM effort=medium;harness=claude-code:2.1.330;model=anthropic:claude-sonnet-5-5;session=sha-256-64:debb814921f029ad;surface=cli