Haskell-language-server: Should we lint, -wall and format our code base?

Created on 22 Dec 2020  路  5Comments  路  Source: haskell/haskell-language-server

I have recently spent some time in the code base again.

I can't help noticing that I have several hlint and other warnings, as well as a variety of formatting styles. Format differences naturally occur with multiple contributors of course.

Given the growing size and number of contributors, I think it would be good to enforce an hlint config, as well as require compiles to pass -wall, or some agreed set of warnings. This could initially be done via a separate "allow-fail" CI build which we aim to bring into compliance overtime.

And perhaps we should agree to use a specific formatter, and format all the code with it.

discussion meta question

Most helpful comment

I can't help noticing that I have several hlint and other warnings, as well as a variety of formatting styles. Format differences naturally occur with multiple contributors of course.

And perhaps we should agree to use a specific formatter, and format all the code with it.

Even though I'm not a maintainer, but as a spare-time contributor, I strongly agree with this point!
While I tried to make some contributions to HLS, I have already broken the indent styles by accident for some times.
The changes are trivial in some cases so that one can manually re-order import list or adjusting indentation, but sometimes it becomes rather tedious to maintain formatting coherency in per-module manner.

As a contributor, I feel more comfortable if there is project-wide formatter configuration and we can just let HLS to invoke them automatically. That saves essentially unnecessary works both for contributors and reviewers, reducing noise from reviwing process, IMHO.

All 5 comments

I can't help noticing that I have several hlint and other warnings, as well as a variety of formatting styles. Format differences naturally occur with multiple contributors of course.

And perhaps we should agree to use a specific formatter, and format all the code with it.

Even though I'm not a maintainer, but as a spare-time contributor, I strongly agree with this point!
While I tried to make some contributions to HLS, I have already broken the indent styles by accident for some times.
The changes are trivial in some cases so that one can manually re-order import list or adjusting indentation, but sometimes it becomes rather tedious to maintain formatting coherency in per-module manner.

As a contributor, I feel more comfortable if there is project-wide formatter configuration and we can just let HLS to invoke them automatically. That saves essentially unnecessary works both for contributors and reviewers, reducing noise from reviwing process, IMHO.

Contentious question: which formatter?

To my mind it should be one without requiring much config, or used with the default config.

Contentious question: which formatter?

What about making a poll? 馃槃
I am personally fine with any of them, and even i am not too disturbed with the actual situation (although agree in it can save time for all of us). I've found more useful the more semantic oriented -Wall and hlint.

I think in terms of reducing config, ormolu would be a good choice.

Reformat the entire code base with whatever format is chosen, then re-run it on each PR before the unit tests. If there are changes they can be automatically committed and the build restarted. So any successful build is a fixed point of the formatter. I don't think it matters which format is chosen, just so long as the computer is the only one who has to actually think about it.

Wall and hlint sound good too.

Was this page helpful?
0 / 5 - 0 ratings