Repository navigation
Add HLint configuraton. - #9041
Conversation
|
After @Kleidukos added the auto-formatting (via Fourmolu) I was thinking that HLint should be the next step. But simply adding the file with exceptions doesn't seem very useful. Imagine someone adds a patch that regresses some of these metrics (so the numbers will loose any meaning over time) or adds code that would need another HLint flag to silence it (so, you're back to square one seeing warnings locally). The way to go I think is to add a CI job alongside the HLint config. |
Some Hlint suggestions canbe really annoying (e.g. all those Sorting which ones are useful (always) and which not could be a good first step. I wonder what other large codebases do. |
|
I don't suggest to sort anything out. Just add a CI job along with the config file. Hopefully, the job could check that we don't regress beyond the current values in the file. |
|
The approach we took with liquid-fixpoint##552 was to tackle one hint at a time, each with its own pull request. For those hints we didn't want to adopt, we kept the ignores. The counts are useful for gauging which of the hints to tackle next. # The following are kept for usability and style sake
- ignore: {name: "Avoid lambda"} # 4 hints
- ignore: {name: "Eta reduce"} # 30 hints
- ignore: {name: "Use $>"} # 7 hints
- ignore: {name: "Use <$"} # 1 hint
- ignore: {name: "Use infix"} # 4 hints |
I actually started doing this as well but then saw that the gh-action wasn't running in my fork (after altering the |
|
@philderbeast did you allow actions on the fork? By default they are disabled, see the screenshot My opinion is that the action should go in the same PR as the config file for the reasons described above. But others may feel differently. |
ulysses4ever
left a comment
There was a problem hiding this comment.
Oh, you should have pinged me. Thanks a lot for doing this! Let's hope someone else adds the second approval.
|
Now, after 2 approvals, feel free to apply one of the merge labels. I'd expect squashing (via label or manually). |
|
Yes please! |
|
@mergify rebase |
❌ Pull request can't be updated with latest base branch changesDetailsMergify needs the author permission to update the base branch of the pull request. |
|
@philderbeast could you please allow maintainers' updates of your patch? Otherwise it's very tricky to make our merge bot happy. |
|
@philderbeast same here: our merge policy (rebased) requires permissions to update your branch |
I haven't been able to find where to do that for an organisation-owned fork. The advice for this setting is for user-owned forks.
|
1e77c92 to
47afac5
Compare
|
@ulysses4ever I did the squashing myself. |
47afac5 to
fc82e1b
Compare
* hlint --default -j . > .hlint.yaml
* Ignore modules that #include "MachDeps.h"
Warning: Can't find file "MachDeps.h" in directories
./cabal-testsuite/PackageTests/CmmSources/src
.
Asked for by: ./cabal-testsuite/PackageTests/CmmSources/src/Demo.hs at line 8 col 1
Warning: Can't find file "MachDeps.h" in directories
./cabal-testsuite/PackageTests/CmmSourcesDyn/src
.
Asked for by: ./cabal-testsuite/PackageTests/CmmSourcesDyn/src/Demo.hs at line 8 col 1
* Ignore the manually generated Lexer.hs
templates/Lexer.x:10:1-20: Warning: Use fewer LANGUAGE pragmas
Found:
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP #-}
Perhaps:
{-# LANGUAGE CPP #-}
1 hint
* Ignore templates/Paths_pkg.template.hs for its parse error
* Ignore templates/SPDX*.hs for their parse errors
* Add a linting workflow and rename the formatting one
* Redo default configuration with hlint-3.5
I had mistakenly used a development build before:
$ hlint --version
HLint v3.6.20230213, (C) Neil Mitchell 2006-2022
* Shorten github workflow
fc82e1b to
2f20049
Compare
|
@philderbeast thank you and sorry for the inconvenience. It's not only squashing it's also rebasing that bites us. I have a to-do to look into supporting people who can't / won't allow updating their branches: this does come up once in a while. We could have a separate, merge-based workflow besides the current rebase-based one. So far let's hope that by the time CI finishes master won't update. |
|
@ulysses4ever I rebased at the same time as squashing, if that helps. |
|
@philderbeast yes, thank you, this helps a bit. The issue is that every update starts CI which will take time to pass, and during that time master can get updates. Currently, any master update, even non-conflicting one, will make the whole thing fail because the merge bot is set up to rebase in such case, and it can't rebase without the permission. We need to create a bot setting that would simply merge instead of rebase for cases when the bot is not allowed to rebase. |
|
@philderbeast thanks and sorry it took so long! I noticed you have a couple older PRs open. Do you want to do anything about them? |
I think I'll need to go back to them myself first to see if they're worth reviving. Thanks for asking. |

HLS often alerts me to one HLint suggestion or another in this project. This adds a default configuration that silences these and shows how many of each suggestion we have so that when we want to tackle these we can.