Skip to content

lint: add trailing whitespace and missing newline checks#4582

Draft
jandubois wants to merge 1 commit intomasterfrom
add-trailing-whitespace-linter
Draft

lint: add trailing whitespace and missing newline checks#4582
jandubois wants to merge 1 commit intomasterfrom
add-trailing-whitespace-linter

Conversation

@jandubois
Copy link
Member

Remove trailing whitespace from all source files and ensure all text files end with a newline. Add lint checks to prevent reintroduction of both issues.

Fixes #4581

@jandubois jandubois marked this pull request as draft February 13, 2026 23:59
Remove trailing whitespace from all source files and ensure all
text files end with a newline. Add lint checks to prevent
reintroduction of both issues.

Fixes #4581

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
@jandubois jandubois force-pushed the add-trailing-whitespace-linter branch from 1e04681 to ca322b2 Compare February 14, 2026 00:10
@jandubois jandubois marked this pull request as ready for review February 14, 2026 00:32
@jandubois
Copy link
Member Author

jandubois commented Feb 14, 2026

While fixing one of the test failures I realized that YAML files actually can have semantically significant trailing white space in text blocks. I think Markdown can have it too.

Personally I consider those to be mis-features, as the trailing whitespace is often not visible in the shell, so I would prefer that we don't use these features. But I wanted to point this out, in case somebody disagrees.

@@ -576,6 +576,16 @@ bats: native limactl-plugins

.PHONY: lint
lint: check-generated
Copy link
Member

Choose a reason for hiding this comment

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

Not executed in CI

@AkihiroSuda AkihiroSuda added this to the v2.1.0 milestone Feb 14, 2026
@result=$$(git grep -rIl '' -- . ':!*.pb.desc' | while IFS= read -r f; do \
test "$$(tail -c 1 "$$f")" && echo "$$f: missing newline at end of file"; \
done); \
if [ -n "$$result" ]; then echo "$$result"; echo "Please ensure all text files end with a newline"; false; fi
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can rather use https://github.com/editorconfig-checker/editorconfig-checker or something else existing

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Feb 14, 2026

from
add-trailing-whitespace-linter

Next time please use your fork

@jandubois
Copy link
Member Author

Next time please use your fork

Sorry, that was an accident; I normally do.

@jandubois jandubois marked this pull request as draft February 14, 2026 05:41
@jandubois jandubois removed this from the v2.1.0 milestone Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a linter for trailing whitespace

2 participants