You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
-Werror being used always, not only on validate #9866
In 0876e18 there was a refactor of cabal projects which introduced the following "regression":
Previously, we would only compile with ghc-options: -Werror when using the cabal.project.validate{.libonly} projects.
After 0876e18, we always compile with ghc-options: -Werror.
I don't think in-tree builds should use -Werror. It is valuable as a validation tool when the MR has to be finished and be validated by CI, but I don't think that when iterating on a patch one should care about all warnings, and -Werror makes this unnecessarily painful.
I'd add "-Wwarn=some-error" in the local project to defer dealing with those.
That doesn't seem reasonable. Erroring on a warning in a development build is an exception, not the norm. Having to manually edit the cabal file to ignore warnings doesn't seem like a good developer experience.
I don't imagine this is hard to fix. cabal.project.release still exists, so it should suffice to move -Werror from project-cabal/ghc-options.config there.
Are you talking about warnings you are introducing?
I think, Rodrigo is talking about warning instances introduced by the developer, but not necessarily coming from new warning flags introduced by the developer.
Perhaps a flag (e.g. -fdev) possibly in a common import would make sense? Then it could also be used for any other options you'd only want during development.
Perhaps a flag (e.g. -fdev) possibly in a common import would make sense? Then it could also be used for any other options you'd only want during development.
I think it would be better not to introduce more configuration levers.
It sounds like Phil is worried that warnings get ignored. I'm not saying otherwise:
We can/should/already do validate CI with -Werror. So no commits with warnings get merged to master.
OTOH, we don't need -Werror while developing because it seriously harms iterating quickly on a patch.
This is solved by the mechanism we have used thus far of having a cabal.project.x for different occasions.
One such file is cabal.project.validate which is used in validate jobs. I've updated that one only to use -Werror, reverting the status quo of having -Werror in every project file.
I understand that you can turn specific errors back into warnings again, but that is beyond my point that -Werror is not a good default for development.
The change to use -Werror by default was not agreed upon by the cabal developers.
To make -Werror the default always there needs to be consensus among us and a clear proposal to introduce this change. However, the change slipped through inadvertently into master during the refactor of cabal projects 0876e18. Mistakes are fine, but we need to revert them if they are problematic.
I agree with Rodrigo that -Werror by default during development is cumbersome to work with. It is common workflow to write code which contains errors to begin with and then clean up all the errors when the patch is ready to submit. Please can we revert this change.
I think -Werror is not a good development default. The described workarounds are easy enough for experts, but newcomer contributors (which we would like to have in cabal) will have a hard time figuring them out. Adding them to a "getting started" page kind of adds noise, modifying sources just so you can develop just like you are used, especially in a project where "run the main" is often the default way to debug.
A -fdev flag has the same disadvantages imo. Not discoverable.
I think -Werror should be enabled in CI only, so we still never have warnings in HEAD, but a more approachable dev environment.
Reacted by Rodrigo Mesquita and Francesco Gazzetta
Also, the -Werror change seems orthogonal to the original PR, as it is not mentioned in the PR description, nor the related issues (though, it is prominently mentioned in the commits).
If we want to change this default, there should be an issue where we can discuss the motivation and consequences in more detail.
I have merged #9867 for now, as it restores the status-quo and multiple people have been unexpectedly bitten by the changes. Myself included :D
Activity
philderbeast commentedon Apr 4, 2024
I'd add "-Wwarn=some-error" in the local project to defer dealing with those.
alt-romes commentedon Apr 4, 2024
That doesn't seem reasonable. Erroring on a warning in a development build is an exception, not the norm. Having to manually edit the cabal file to ignore warnings doesn't seem like a good developer experience.
alt-romes commentedon Apr 4, 2024
I don't imagine this is hard to fix.
cabal.project.releasestill exists, so it should suffice to move-Werrorfromproject-cabal/ghc-options.configthere.philderbeast commentedon Apr 4, 2024
Are you talking about warnings you are introducing?
alt-romes commentedon Apr 4, 2024
I'm saying that
-Werrorcannot be used by default on all builds. Only onvalidatebuilds.Mikolaj commentedon Apr 4, 2024
I think, Rodrigo is talking about warning instances introduced by the developer, but not necessarily coming from new warning flags introduced by the developer.
philderbeast commentedon Apr 4, 2024
Sorry I'm going to drop out of this discussion for a bit, on the road in a snow storm!
Only use -Werror in validate
philderbeast commentedon Apr 6, 2024
Ignoring warnings is worse, isn't it?
It bothered me that
hackage-securitywas spamming our build logs with lots of warnings so I fixed those with haskell/hackage-security#306.I find cabal build output lengthy and its warning easy to miss. I don't mind fixing warnings.
geekosaur commentedon Apr 6, 2024
Perhaps a flag (e.g.
-fdev) possibly in a commonimportwould make sense? Then it could also be used for any other options you'd only want during development.alt-romes commentedon Apr 6, 2024
I think it would be better not to introduce more configuration levers.
It sounds like Phil is worried that warnings get ignored. I'm not saying otherwise:
-Werror. So no commits with warnings get merged to master.-Werrorwhile developing because it seriously harms iterating quickly on a patch.This is solved by the mechanism we have used thus far of having a
cabal.project.xfor different occasions.One such file is
cabal.project.validatewhich is used in validate jobs. I've updated that one only to use-Werror, reverting the status quo of having-Werrorin every project file.alt-romes commentedon Apr 8, 2024
This makes it really annoying to use
traceShowwhile developing because you get an error with-Werror...philderbeast commentedon Apr 10, 2024
@alt-romes I had a look at #9811. I did the same but with
traceShowIdand found these ways to silence the errors;cabal.project.local;-Wwarn=options;-Wwarnoption;alt-romes commentedon Apr 10, 2024
I understand that you can turn specific errors back into warnings again, but that is beyond my point that
-Werroris not a good default for development.The change to use
-Werrorby default was not agreed upon by the cabal developers.To make
-Werrorthe default always there needs to be consensus among us and a clear proposal to introduce this change. However, the change slipped through inadvertently into master during the refactor of cabal projects 0876e18. Mistakes are fine, but we need to revert them if they are problematic.mpickering commentedon Apr 11, 2024
I agree with Rodrigo that -Werror by default during development is cumbersome to work with. It is common workflow to write code which contains errors to begin with and then clean up all the errors when the patch is ready to submit. Please can we revert this change.
fendor commentedon Apr 11, 2024
I think
-Werroris not a good development default. The described workarounds are easy enough for experts, but newcomer contributors (which we would like to have in cabal) will have a hard time figuring them out. Adding them to a "getting started" page kind of adds noise, modifying sources just so you can develop just like you are used, especially in a project where "run the main" is often the default way to debug.A
-fdevflag has the same disadvantages imo. Not discoverable.I think
-Werrorshould be enabled in CI only, so we still never have warnings in HEAD, but a more approachable dev environment.fendor commentedon Apr 11, 2024
Also, the
-Werrorchange seems orthogonal to the original PR, as it is not mentioned in the PR description, nor the related issues (though, it is prominently mentioned in the commits).If we want to change this default, there should be an issue where we can discuss the motivation and consequences in more detail.
I have merged #9867 for now, as it restores the status-quo and multiple people have been unexpectedly bitten by the changes. Myself included :D
Only use -Werror in validate
Only use -Werror in validate
Only use -Werror in validate