Skip to content
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

Text file, newlines at end of files #9804

Merged
merged 12 commits into from
Mar 18, 2024

Conversation

philderbeast
Copy link
Collaborator

@philderbeast philderbeast commented Mar 13, 2024

Fixes #9802 for *.hs and *.project files and adds a script taking a file glob pattern for doing this, adding newlines at the ends of files where needed. Adds back the whitespace github workflow and uses fix-whitespace to fix non-conformance. Add a short note about this in the contributing readme.

@ffaf1
Copy link
Collaborator

ffaf1 commented Mar 13, 2024

@andreasabel created whitespace.yml, let us see what he has to say.

@philderbeast
Copy link
Collaborator Author

@ulysses4ever I see you are a fix-whitespace contributor. Do you think we can get fix-whitespace and fourmolu to play nicely together?

@philderbeast philderbeast force-pushed the script/eol-eof-conformance branch from bc51c4f to d5ed8f1 Compare March 14, 2024 14:51
@philderbeast philderbeast force-pushed the script/eol-eof-conformance branch 2 times, most recently from 0a0b0fe to cc2372d Compare March 14, 2024 15:43
doc/getting-started.rst Outdated Show resolved Hide resolved
Copy link
Member

@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

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

You could also use https://github.com/andreasabel/fix-whitespace-action:

steps:
- uses: actions/checkout@v4
- uses: andreasabel/fix-whitespace-action@v1

This action downloads the pre-build binary of fix-whitespace and runs it, and also caches it.

@philderbeast philderbeast force-pushed the script/eol-eof-conformance branch from 1c9385e to 9435037 Compare March 15, 2024 10:14
@philderbeast
Copy link
Collaborator Author

Thanks @andreasabel fix-whitespace-action is way less configuration. I reverted one of the corrections and it shows violations in the output.

@philderbeast
Copy link
Collaborator Author

Label merge+no rebase is necessary when the pull request is from an organisation.

Copy link
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

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

Instead of creating a separate workflow, can we add it to the quick-jobs workflow?

Can you check that fix-whitespace is run with a flag that will show the actual violations?

@philderbeast
Copy link
Collaborator Author

I reverted one of the corrections and it shows violations in the output.

@ulysses4ever I checked and it shows violations.

@ulysses4ever
Copy link
Collaborator

Very cool, thanks!

@philderbeast
Copy link
Collaborator Author

philderbeast commented Mar 15, 2024

@ulysses4ever, funny thing about moving it to quick jobs is that it now doesn't run nearly as quickly (the ghcup, hackage and alex stuff takes a lot longer to run)!

@philderbeast
Copy link
Collaborator Author

philderbeast commented Mar 15, 2024

In terms of developer feedback, putting it alongside (at the end of) quick jobs is a big degradation.

@ulysses4ever
Copy link
Collaborator

Mm, good point. My intention was not having it run quickly, though, and rather I dislike proliferation of standalone workflows. But maybe it’d be good to get an actually quick feedback from this job…

We need to fix quick-jobs to only download binaries and not build anything with ghc!

@philderbeast
Copy link
Collaborator Author

@ulysses4ever I see there is something wrong with the cache in quick jobs;

Post job cleanup.
Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist,
hence no cache is being saved.

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Mar 15, 2024

Interesting... Maybe worth a new ticket with the continuous-integration label.

@philderbeast philderbeast force-pushed the script/eol-eof-conformance branch from 9435037 to eb87ffd Compare March 16, 2024 11:33
@philderbeast
Copy link
Collaborator Author

How much squashing should I be doing with this given that the advice is:

If you push a fix of a whitespace violation, please do so in a separate commit.

@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Mar 18, 2024
@mergify mergify bot merged commit 46e8221 into haskell:master Mar 18, 2024
55 checks passed
@philderbeast
Copy link
Collaborator Author

Sorry @Mikolaj for the lack of squashing. I asked about squashing but forgot to come back to it. Noticed when I got the cabal.head email.

@Mikolaj
Copy link
Member

Mikolaj commented Mar 26, 2024

Ouch. With no-rebase and no manual rebase nor squash just before merging, the 12 commits are strewn artistically across other PRs from the several last days. I guess we have to get used to git art. :D

@andreasabel
Copy link
Member

For the sake of bisecting, a linear history is really a plus. Can't we enforce it on this repo? (On the Agda repo, I disabled merge commits.)

@ffaf1
Copy link
Collaborator

ffaf1 commented Mar 28, 2024

Some contributors — and most importantly, some employers — do not fancy cabal to have write access their repos (e.g.).

At first we did some manual cherry-picking, but then we gave in and merge+no rebase was introduced.

@andreasabel
Copy link
Member

Can mergify do the rebase by copying the contributor branch to a new branch on this repo first? Can this be set up? This might be a technical solution.

If a PR cannot be rebased then it should be rejected by default. Otherwise, we'll not get a linear history.

Contributors with write access could be encouraged to push to a branch here rather than on their own repo.

@geekosaur
Copy link
Collaborator

Contributors with write access could be encouraged to push to a branch here rather than on their own repo.

This could be difficult if the contributor is working on an employer's tree as part of their job.

@ffaf1
Copy link
Collaborator

ffaf1 commented Mar 28, 2024

This requires a new issue for visibility and discussion.

@ulysses4ever
Copy link
Collaborator

@mergify backport 3.12

Copy link
Contributor

mergify bot commented May 13, 2024

backport 3.12

✅ Backports have been created

mergify bot added a commit that referenced this pull request May 13, 2024
* Add back whitespace workflow

(cherry picked from commit 265f149)

* Whitespace conventions in contributing

(cherry picked from commit 7c9346b)

* Fix whitespace in workflows

(cherry picked from commit c31ca12)

# Conflicts:
#	.github/workflows/validate.yml

* Fix whitespace in docs

(cherry picked from commit 2ea012e)

* Fix whitespace in *.hs sources

(cherry picked from commit e420bf2)

* Add missing line at EOF for cabal-testsuite/**/*.hs

- Fix whitespace in cabal-testsuite + other tests

(cherry picked from commit e386a13)

* Fix whitespace in fourmolu configuration

(cherry picked from commit b790751)

* Configure fix-whitespace to include *.project

Needed for POSIX compliance for text files

(cherry picked from commit ed4c36a)

* Fix whitespace in *.project

(cherry picked from commit 38eb1e8)

* Ignore generated doc/buildinfo-fields-reference.rst

(cherry picked from commit b414faf)

* Reduce double space between prose words

Co-authored-by: brandon s allbery kf8nh <allbery.b@gmail.com>
(cherry picked from commit 834e1ed)

* Use fix-whitespace-action

(cherry picked from commit eb87ffd)

* Fix merge conflict

---------

Co-authored-by: Phil de Joux <philderbeast@gmail.com>
Co-authored-by: Hécate <Kleidukos@users.noreply.github.com>
@ulysses4ever
Copy link
Collaborator

@philderbeast

Can you check that fix-whitespace is run with a flag that will show the actual violations?

I checked and it shows violations.

Apparently, we misunderstood each other. What I meant is that it should show not only the names of the files with whitespace issues but also the issues themselves. It could be done by the verbose: true option of the action:

https://github.com/andreasabel/fix-whitespace-action/blob/2a7678e2f1319ae6e9595acb06b8cfb46e38af23/action.yml#L17-L20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge+no rebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We have zero-line text files that aren't empty
6 participants