haskell-mafia / mafia

Provides protection against cabal swindling, robbing, injuring or sabotaging people with chopsticks.
http://haskell-mafia.github.io/mafia/
BSD 3-Clause "New" or "Revised" License
135 stars 19 forks source link

Don't pass `-Werror` #205

Closed mitchellwrosen closed 6 years ago

mitchellwrosen commented 6 years ago

I was surprised to see my first ./mafia build fail due to -Werror.

I see in the source that ./mafia build includes -Werror (treat warnings as errors) by default, or else passes -w (disable all warnings) if you run ./mafia build -w.

Why not do neither of the above, which would allow pulling ghc-options from the .cabal file? If I'm not mistaken, currently there's no way to get mafia to use -Wall, which I've specified in my .cabal file.

Thanks!

erikd commented 6 years ago

Mafia is the default build tool inside Ambaita (where this repo was forked from) and our coding guidelines included something along the lines of "all code should build without warnings for all supported GHC versioons". The default that you would like to see changed if one that we at Ambiata see as a "sensible default". It was also one that was enforced in our CI infrastructure. The use of mafia build -w is really only something that we use during development and therefore, this is not something we (the haskell-mafia group) would like to see changed.

Fixing all warnings is good practice. For the very rare occasion that different versions of GHC give different warnings its possible to turn of a single specific warning using a language pragma.

As for ghc-options, our projects all included -Wall by default.

mitchellwrosen commented 6 years ago

The default that you would like to see changed if one that we at Ambiata see as a "sensible default". It was also one that was enforced in our CI infrastructure.

I can buy that it's a sensible default, no disagreement there.

The use of mafia build -w is really only something that we use during development and therefore, this is not something we (the haskell-mafia group) would like to see changed.

Hrm, unfortunately neither mafia build or mafia build -w seem to work for my development workflow, which it to see warnings fly by but still allow the build to succeed. However, this can easily be worked around by running, say, ghcid -c 'mafia repl' in another terminal.

It still does seem unnecessarily persnickety to me (mafia build, yes, I know I have an unused variable... mafia build -w, wait, what were those warnings again? I want to fix them...), but I realize this is an opinionated build tool specifically built by and for Ambiata, so I won't press the issue further :)

Thanks for the info!

thumphries commented 6 years ago

To this I would also add that the usual workflow for us is to iterate in GHCi with mafia repl or mafia quick. You have fine-grained control over GHCi and the way it reports warnings and errors, e.g. -fdefer-type-errors and -Wall without -Werror.

Mafia build is not a good dev feedback loop. It's slow and inflexible. mafia build is used to produce a binary for prod/ci or for late-stage testing, that's about it. It assumes you want to fix your warnings before release, or you are testing and just need a binary (-w).

Mafia is opinionated in this way but still generally useful outside Ambiata, at least until new-build gets a bit more polished.

On Jan 20, 2018, at 8:20 AM, Mitchell Rosen notifications@github.com wrote:

Closed #205.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.