-
Notifications
You must be signed in to change notification settings - Fork 14
Further improve text-file ending requirements #306
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -102,8 +102,8 @@ If the workspace root contains a `srcs/` directory, it may contain symbolic link | |||||
|
|
||||||
| ### CRITICAL: Apply to ALL files you create or edit (bash scripts, Python, C++, YAML, Markdown, etc.) | ||||||
|
|
||||||
| - All text files must have their final line be non-empty and terminated with a single newline character, leaving no trailing blank lines | ||||||
| - **Never add trailing whitespace on any line** (spaces or tabs at end of lines) | ||||||
| - For all text files, the final character in the file **must** be a newline character, and the immediately-preceding character **must not** be either a newline character or other whitespace (space, tab, etc.) | ||||||
|
||||||
| - For all text files, the final character in the file **must** be a newline character, and the immediately-preceding character **must not** be either a newline character or other whitespace (space, tab, etc.) | |
| - For all text files, the final character in the file **must** be a newline character, and the immediately-preceding character **must not** be another newline character (no trailing blank lines) |
Copilot
AI
Feb 10, 2026
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.
The exception "unless it is part of a multi-line string" is ambiguous and could lead to inconsistent behavior. In most programming contexts, trailing whitespace within multi-line strings is preserved by the language runtime, not by the source file format.
Questions arise: Does this mean Copilot should add trailing whitespace to multi-line string literals when the string content requires it? Should it preserve trailing whitespace that already exists in multi-line strings even if it's not semantically meaningful? What about YAML multi-line strings, heredocs, or template literals?
Consider either removing this exception (letting language semantics handle multi-line string whitespace) or providing specific examples of when this exception applies. The blanket exception may create more confusion than it resolves.
| - **Never add trailing whitespace on any line** (spaces or tabs at end of lines) unless it is part of a multi-line string | |
| - **Never add trailing whitespace on any line** (spaces or tabs at end of lines) |
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.
The new wording in line 105 creates potential confusion about blank lines within files. The phrase "the immediately-preceding character must not be either a newline character" could be misinterpreted to mean that blank lines are never allowed, since blank lines consist of consecutive newline characters.
The intention appears to be: "files must end with exactly one newline character, and there must be no trailing blank lines at the end of the file." However, the current wording about "immediately-preceding character" doesn't clearly distinguish between legitimate blank lines within the file content versus prohibited trailing blank lines at the end.
Consider rewording to be more explicit, such as: "For all text files, the final character must be a newline character, and there must be no trailing blank lines or trailing whitespace at the end of the file."