Skip to content

Introduce fourmolu #1500

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

Merged
merged 7 commits into from
May 19, 2025
Merged

Introduce fourmolu #1500

merged 7 commits into from
May 19, 2025

Conversation

geo2a
Copy link
Contributor

@geo2a geo2a commented May 9, 2025

Fixes #1499

PR description

This PR introduces fourmolu as an automatic code formatter to replace stylish-haskell

Beyond the actual reformatting, I've introduced the following changes:

  • add fourmolu to the Nix shell
  • add the scripts/ci/run-fourmolu.sh scripts, which is based on the previously used script for stylish-haskell
  • add a Hydra job to check the project with fourmolu (and pushed a dummy commit to check that the CI rejects improperly styled code)
  • add The Big Reformatting Commit to .git-blame-ignore-revs and checked that the blame interface on GitHub respects it
  • with a somewhat heavy heart, butchered the style guide. The layout-related sections are removed as the layout is now enforced by fourmolu.

Additionally, I've enabled ImportQualifiedPost in all cabal files, alongside with the -Wprepositive-qualified-module warning. This extension and warning could be removed once (if?) we transition to GHC2021 as the default language.

@geo2a geo2a force-pushed the geo2a/issue-1499-introduce-fourmolu branch 4 times, most recently from f02fd29 to bcd85b6 Compare May 9, 2025 12:05
@geo2a geo2a force-pushed the geo2a/issue-1499-introduce-fourmolu branch 7 times, most recently from 8b917de to 3d236c7 Compare May 13, 2025 08:21
@geo2a geo2a marked this pull request as ready for review May 13, 2025 08:24
@@ -0,0 +1,6 @@
indentation: 2
column-limit: 100
Copy link
Member

Choose a reason for hiding this comment

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

Enforcing a column limit has various idempotency issues. Usually minor, so no need to do sth immediately, but something to keep in mind if it gets too annoying.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you rather suggest to reformat the code base and to not enforce the limit? I do not see how we would be able to prevent addition of longer lines in this case.

Copy link
Member

Choose a reason for hiding this comment

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

No, what you do in this PR looks good to me, just pointing out this potential downside of column-limit, but no immediate action required.

@geo2a geo2a force-pushed the geo2a/issue-1499-introduce-fourmolu branch 2 times, most recently from 4c93d83 to 03f535a Compare May 13, 2025 13:52
Copy link
Contributor

@jasagredo jasagredo left a comment

Choose a reason for hiding this comment

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

I think the final code looks good. Just a minor remark on CONTRIBUTING but overall I am fine with the result.

@geo2a geo2a force-pushed the geo2a/issue-1499-introduce-fourmolu branch 2 times, most recently from ccfa979 to d5b6477 Compare May 16, 2025 09:55
geo2a added 2 commits May 19, 2025 15:04
Allows ignoring code reformatting and similar changes
@geo2a geo2a force-pushed the geo2a/issue-1499-introduce-fourmolu branch from d5b6477 to a92669f Compare May 19, 2025 13:11
@geo2a geo2a enabled auto-merge May 19, 2025 13:12
@geo2a geo2a added this pull request to the merge queue May 19, 2025
Merged via the queue into main with commit 2c06471 May 19, 2025
17 of 18 checks passed
@geo2a geo2a deleted the geo2a/issue-1499-introduce-fourmolu branch May 19, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce automatic code formatting
3 participants