Add hlint configuration & gh workflow#906
Conversation
|
Thanks! Currently all of our jobs are under one workflow, As an aside, there are a number of warnings in GHC 9.8 (use of partial functions like Also, FYI, when I last looked at the hlint output, I recall some of them being unhelpful (possibly contrary to my own opinions on style, such as valuing reader clarity over redundancy), so maybe we'll want to use a non-default configuration? But certainly keeping track of the output is good. Instead of just the counts, though, would it be helpful to store the entire output and compute a diff, that way someone who makes changes to the source can see specifically what new message they introduced? |
Yes I do. If a workflow step is much faster than other steps, I like seeing it in its own workflow. Taking the haskell/cabal actions for instance, rough timings for some of its workflows are;
Having a separate smaller workflow can make finding the error much easier if inspecting the logs online through the web interface of GitHub. I like how with haskell/cabal, there's usually a Makefile rule that corresponds to a CI workflow that I can run that will show me the failure locally. |
That's a very interesting suggestion and would be a way to get feedback on ignored HLint suggestions. I fear it would be fragile because HLint output includes line numbers. |
I'd always prioritize doing fixes for compiler warnings first before fixing linting warnings and suggestions. That said, I find HLint very helpful. It usually suggests a change to make and I've learnt about Haskell, the language, that way. |
I usually accept HLints suggestions and go with the flow but contrarian opinions can be accommodated with HLint's various ways of ignoring suggestions, either within the - ignore: {name: Eta reduce, within: [MyModule1, MyModule2]} |
|
Thank you again for this. In talking with others about it, there is agreement that the Makefile in I would also suggest putting the HLint configuration file in Also, the whitespace and testsuite linting checks could be moved of the GitHub workflows directory and into appropriate places -- again, I can do that if you prefer. I'd think that On this topic:
I find the exact opposite. Admittedly, I only have a color impairment, not other vision impairment, so I can't comment on how navigable the pages are for people who use screen readers and the like. However, here's my experience: For separate jobs within one workflow (I'm not talking about steps within a job), the status is immediately available and visible. See, for example, the whitespace checks, that appear on the web interface with a red X within 5 seconds if they fail. Yes, you don't get an email notification until the entire workflow is done -- I agree there, that separate workflows mean you get an email quicker. However, separate workflows make the web navigation harder: There is no longer one webpage containing all the checks. Each workflow shows up separately in the list of Actions (on the desktop browser pages) -- for one PR or commit, there will be multiple entries, and you just have to know how many entries to go look for. (On the mobile app, it's even worse; there are separate top-level tabs for each workflow, including tabs for any that ever existed in the history of the repo, even just inside a PR; and you have to click on each tab and then click on the particular commit/PR within that, to get to each report.) I'd much rather have one webpage/tab with all the jobs in one place; the status of every job is immediately visible, you just don't get a quicker email notification. |
That's pretty much the incremental workflow I use when tackling HLint linting. If the codebase has changed, I'll delete all of the "Warnings currently triggered by your code", rerun # Warnings currently triggered by your code
- ignore: {name: "Avoid lambda"} # 38 hints
- ignore: {name: "Avoid lambda using `infix`"} # 15 hints
...
- ignore: {name: "Use zipWithM"} # 1 hint
- ignore: {name: "Used otherwise as a pattern"} # 28 hintsI'll then pick an individual ignore line, delete it, run The whole process is pretty lightweight and quick. I feel like it is easier on reviewers to only tackle one suggested hint at a time, or a few together that are similar. Even then, I like keep commits for each hint separate. Those commits, with the initial baseline counts commit (and, if we're being thorough, a final counts commit), can be squashed after review and before merging. |
I've changed the configuration to the non-standard name you suggest,
|
@quark17, would it be good to run HLint on As well as ignoring linting rules in specific modules, HLint can be configured to ignore path globs, such as haskell/cabal/.hilint.yaml does with its |


Related to #589, adds an
.hlint.yamlconfiguration with counts of the suggestions that would be triggered were they not ignored. This way we could progressively tackle one or more individual HLint suggestions at a time.Also adds a GitHub action workflow to check the linting.