-
Notifications
You must be signed in to change notification settings - Fork 33
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
Why not to set rustflags empty by default? #48
Comments
In the effort to promote sensible defaults, I feel that the positive impact of -Dwarnings far outweighs the negative given how easy it is to disable. CI is more often than not the place where you want to block contributions until code quality improvements have been made. |
GitHub has decided on using two states for their CI results (pass/fail), but in Rust we have three (clean/warnings/errors), so something needs to be done. Personally, I see the risk of bit rot and hidden issues. Rust errors are quite good, with a low amount of false positives. As such they should be acted upon. Without denying warnings in CI, they will be hidden behind green pass mark for CI.
Is it a significant difference if one or multiple pipelines fail? After all, the result is a failed CI run and a red cross in either case. A separate warnings check also consumes extra CI resources, but you can do this with this action if you so want.
Yes, if you have a more demanding setup the defaults of this action might not work for you. I am fine with this action making some opinionated decisions. |
Got your point. Good to hear from you! |
Haven't you considered to add an argument to action named like "fail-on-warning", that will be true by default. Being |
@qalisander the difficult part is "append … to default rustflags". This action has no way of knowing what your rustflags are going to be, because it doesn't have access to the repositories you're going to build. And the |
By By the end it should look like this for
Instead of:
And when you want to set a flag explicitly and fail on warning it can look like this:
Instead of this:
Not ideal though, but possibly better DevEx. |
|
I think the problem is that by default the compiler flags are overridden. It's not like Thankfully you can work around this by setting the It took me a while to figure out that this was the source of my project not building with position-independent relocations in CI, which breaks the code when it's used. If you're opinionated about warnings being failures by default (I agree that makes a lot of sense for CI!) then maybe it can be appended instead of wiping out any other flags you have set. |
Unfortunately, cargo does not really offer any way to have RUSTFLAGs being appended. There is an old issue about it: rust-lang/cargo#5376. [target.'cfg(all())']
rustflags = ["--cfg", "tokio_unstable"] I saw that While I want to keep the
|
Note that for this to be reliable you would need to search both possible filenames ( |
Awesome gh action! But one thing could be better as I feel.
The default behavior in complex pipelines can easy turn every pipeline into red.
At first glance it seems, that natural disaster happened. While in reality just a single warning appeared.
Isn't it better to have a single pipeline dedicated to a warning analysis? And have just a single use of
rustflags
property in this case. When that specific pipeline fails it is quite clear what happened.IMHO default
-D warnings
overriding behavior of flags fromconfig.toml
looks quite tricky for new users.The text was updated successfully, but these errors were encountered: