Skip to content
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

Clippy on ci-flow with -D warnings #246

Closed
elpiel opened this issue Jun 3, 2019 · 9 comments
Closed

Clippy on ci-flow with -D warnings #246

elpiel opened this issue Jun 3, 2019 · 9 comments
Assignees
Milestone

Comments

@elpiel
Copy link
Contributor

elpiel commented Jun 3, 2019

Hello,
It's more of a question for discussion whether the clippy task should fail on any warnings. Maybe this can also be controlled with an env. variable?

E.g.
args = ["clippy", "--all-features", "--", "-D", "warnings"]

@sagiegurari
Copy link
Owner

sagiegurari commented Jun 3, 2019

I think that's really good idea.
with the help of the split function I could have a default empty env var and users could modify that env var to whatever args they want to add.

you can today just override that task, and set the args only.

@sagiegurari sagiegurari added this to the 0.19.5 milestone Jun 3, 2019
@elpiel
Copy link
Contributor Author

elpiel commented Jun 3, 2019

Yes, that's what I did, but for the CI flow I thought it's a good idea to actually fail the build on such occasions. And I wanted to hear your thoughts on that.

@sagiegurari
Copy link
Owner

I'm thinking of doing something like the following:

[env]
CARGO_MAKE_CLIPPY_ALL_FEATURES_WARN = "--all-features -- -D warnings"
CARGO_MAKE_CLIPPY_NO_ARGS = "--all-features -- -D warnings"
CARGO_MAKE_CLIPPY_ARGS = "${CARGO_MAKE_CLIPPY_NO_ARGS}"

[tasks.clippy]
description = "Runs clippy code linter."
category = "Test"
dependencies = [
    "install-clippy"
]
command = "cargo"
args = ["clippy", "@@split(CARGO_MAKE_CLIPPY_ARGS, )"]

this will basically mean that by default, clippy is invoked without any args like today.
but you could change to all features+warn by doing the following:

[env]
CARGO_MAKE_CLIPPY_ARGS = "${CARGO_MAKE_CLIPPY_ALL_FEATURES_WARN }"

in your makefile.
and if you wish to enable it for a specific profile only, you can do it as follows:

[env.ci]
CARGO_MAKE_CLIPPY_ARGS = "${CARGO_MAKE_CLIPPY_ALL_FEATURES_WARN }"

and run it

cargo make --profile ci

@elpiel
Copy link
Contributor Author

elpiel commented Jun 4, 2019

Sounds good to me. I will try to sit down today and fire a PR 😊

@sagiegurari
Copy link
Owner

actually this one i already developed (i took the example from what i did and tested).
but you could do a pr to the other issue you opened, but i would prefer there a bit better shell script solution if possible

@elpiel
Copy link
Contributor Author

elpiel commented Jun 5, 2019

@sagiegurari when can I expect this to be committed & released, so that I can check it and close this issue?

sagiegurari added a commit that referenced this issue Jun 5, 2019
@sagiegurari
Copy link
Owner

i actually pushed it to 0.19.5 branch 2 minutes ago.
so you can check it now if you install it from github directly

@elpiel
Copy link
Contributor Author

elpiel commented Jun 10, 2019

Tested it today. Works perfectly! Thanks!

@sagiegurari
Copy link
Owner

thanks for confirming!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants