fix/paragraphs #5431

Merged
tobiasd merged 4 commits from fix/paragraphs into master 2025-10-30 12:34:59 +00:00
Member

Currently implements both a format hook to remove white-space paragraphs, and a check to make their existence a critical failure.

In the end may implement only one or none of these, subject to major design changes.

Solves #5409

Currently implements both a format hook to remove white-space paragraphs, and a check to make their existence a critical failure. In the end may implement only one or none of these, subject to major design changes. Solves https://git.fsfe.org/FSFE/fsfe-website/issues/5409
delliott requested review from tobiasd 2025-10-26 17:33:51 +00:00
delliott requested review from hl 2025-10-26 17:33:55 +00:00
.drone.yml Outdated
@@ -143,5 +143,3 @@ volumes:
---
kind: signature
hmac: 997582ae47807c3367efcda28920c2d0f84bfd05d6fddf224bf7440a636d91e1
Owner

These lines should not be removed I think

These lines should not be removed I think
Author
Member

That is what prettier does to yml files, and then drone sign changes it again.

That is what prettier does to yml files, and then drone sign changes it again.
Owner

CI is failing, I cannot check all the 11k changed files - but what I've seen of the trivial removals of whitespace LGTM for the 1st two commits they look good for me as well.

CI is failing, I cannot check all the 11k changed files - but what I've seen of the trivial removals of whitespace LGTM for the 1st two commits they look good for me as well.
tobiasd removed review request for hl 2025-10-27 08:44:29 +00:00
Author
Member

So, there is a little bit of discussion t be had here when it comes to automating some formatting of xhtml files.

At present we have a bunch of formatters and linters, as we have many kinds of files in the repo.

We currently have automated linting but nor formatting of xhtml. The lints are generally easy enough to fix manually.

Using the empty paragraph remover does perform some whitespace changes on files, and so we have kind of introduced our first xhtml formatter. Perhaps when we are already altering 11k files, and causing the biggest merge and ensuring merge conflicts to follow, we should just go whole hog and run the xmllint format we currently use on xml and xsl files on xhtml too? I do not mind.

Also, we are now entering a somewhat interesting point with our ci.

So, at present all the pre-commit checks are ran as ci. Some of them do not fail if the files have changed, like most of the formatters. But the formatters will fail if they see invalid xml, or js, or so forth. But assuming that committed files are not formatted, but syntactically correct they will pass ci.

And then we also have checks, which are mainly some bash and python scripts that assert something is/is not the case. These fail ci if they check is failed.

Do we want to make unformatted files a CI failure? I would like to, but know that this project has many contributors who use the web interface, without pre-commit hooks, quite frequently.

So, there is a little bit of discussion t be had here when it comes to automating some formatting of xhtml files. At present we have a bunch of formatters and linters, as we have many kinds of files in the repo. We currently have automated linting but nor formatting of xhtml. The lints are generally easy enough to fix manually. Using the empty paragraph remover does perform some whitespace changes on files, and so we have kind of introduced our first xhtml formatter. Perhaps when we are already altering 11k files, and causing the biggest merge and ensuring merge conflicts to follow, we should just go whole hog and run the `xmllint format` we currently use on xml and xsl files on xhtml too? I do not mind. Also, we are now entering a somewhat interesting point with our ci. So, at present all the pre-commit checks are ran as ci. Some of them do not fail if the files have changed, like most of the formatters. But the formatters will fail if they see invalid xml, or js, or so forth. But assuming that committed files are not formatted, but syntactically correct they will pass ci. And then we also have checks, which are mainly some bash and python scripts that assert something is/is not the case. These fail ci if they check is failed. Do we want to make unformatted files a CI failure? I would like to, but know that this project has many contributors who use the web interface, without pre-commit hooks, quite frequently.
Author
Member

Or we could do something maybe inadvisable, and use drone to push to the branch after running the formatters:

https://github.com/appleboy/drone-git-push/blob/master/DOCS.md

So if the commits failed the checks, requring manual intervention, one does so and no automated commits will be made yet.

Once the manual intervention requiring errors are fixed, the ci will proceed to the next stage, and push the formatting changes, if there are any. There will be none for those using the pre-commit hooks locally properly, but for web edit changes there might be.

And then merge.

We could also maybe do something like having it make the commits during a merge, so they are not seen in the pr, or making the commits on master after a merge? I am not sure.

Or we could do something maybe inadvisable, and use drone to push to the branch after running the formatters: https://github.com/appleboy/drone-git-push/blob/master/DOCS.md So if the commits failed the checks, requring manual intervention, one does so and no automated commits will be made yet. Once the manual intervention requiring errors are fixed, the ci will proceed to the next stage, and push the formatting changes, if there are any. There will be none for those using the pre-commit hooks locally properly, but for web edit changes there might be. And then merge. We could also maybe do something like having it make the commits during a merge, so they are not seen in the pr, or making the commits on master after a merge? I am not sure.
Author
Member

Failing CI as the removal of empty paragraphs touches a huge number of older xhtml files that do not pass our newer checks.

Failing CI as the removal of empty paragraphs touches a huge number of older xhtml files that do not pass our newer checks.
delliott marked the pull request as ready for review 2025-10-27 16:53:29 +00:00
delliott requested review from tobiasd 2025-10-27 16:53:38 +00:00
delliott marked the pull request as work in progress 2025-10-28 11:12:21 +00:00
delliott marked the pull request as ready for review 2025-10-28 11:27:20 +00:00
delliott added 1 commit 2025-10-30 12:26:32 +00:00
chore: run pre-commit on all files
continuous-integration/drone/pr Build is failing
a28bc64480
tobiasd merged commit b9caf021a4 into master 2025-10-30 12:34:59 +00:00
tobiasd referenced this issue from a commit 2025-10-30 12:35:01 +00:00
tobiasd deleted branch fix/paragraphs 2025-10-30 12:35:02 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FSFE/fsfe-website#5431