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
Lint code in PRs and when committing to master #6790
Conversation
This is a bit of an experiment. I have generally had good experiences using linters in this way in other projects. But there is always the danger that it gets in the way more than it helps. |
Yeah, I'm not sure. I normally don't always apply hlint's suggestions, so I'm not sure I'd want to make it a requirement for commits. Sometimes I find that some parentheses that aren't strictly necessary are helpful to make the code more readable by humans, for example. |
That's very true. The PR disables multiple hints because they would have made things worse (IMHO). I am using automatic linting checks in hslua; so far the experience has been good. However, my feeling is that unnecessary warnings happen more often than in other languages. Maybe this would get annoying quickly when used in a project of pandoc's size. I haven't tried it yet, but maybe the hint-man bot could be a good alternative. |
Not sure if this has already been discussed, but we could also go full blown with https://github.com/tweag/ormolu |
Ormolu and similar tools are great in a company environment IMHO. I wouldn't want to use them in pandoc though. |
Let's try it. If the automatic lint action gets to be a pain, we can disable it. But even if we do, these changes to hlint config and to the code are useful. |
@tarleb I'm confused about how this works! (Background: I was trying to add a matching lint step to my pre-push procedure.)
where
So, we download a script and run it, and the script says to download itself and pipe itself to hlint? What is going on here? |
I took that line from the hlint docs' CI section. Following all URL redirects and indirections, I end up at https://raw.githubusercontent.com/ndmitchell/neil/master/misc/run.sh, which downloads hlint from its GitHub release page. This does seem overly convoluted.
That's weird, I'm not getting any warnings right now. I don't know what's going on there. |
FWIW, I'm running hlint 3.2. |
My pre-commit hook is #!/bin/sh
git diff --cached --name-only | grep '.hs$' | xargs hlint --hint .hlint.yaml |
I've got an older hlint, that may be the issue. |
Upgraded hlint. That did it. Thanks for the pre-commit hook. |
This adds a new GitHub Actions workflow which checks the code with HLint for all PRs and commits to master. Most linter annotations in the code are resolved; the remaining warnings are disabled via configs.