Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

'check all' option is not working correctly #120

Closed
alkorang opened this issue Nov 25, 2017 · 6 comments · Fixed by #122
Closed

'check all' option is not working correctly #120

alkorang opened this issue Nov 25, 2017 · 6 comments · Fixed by #122

Comments

@alkorang
Copy link
Contributor

alkorang commented Nov 25, 2017

check all option is not working even if there is obvious syntatic errors in source code.

@alkorang alkorang changed the title "check all" option is not working correctly 'check all' option is not working correctly Nov 25, 2017
@arthurprs
Copy link
Contributor

I think the cargo check situation around tests is sad. I couldn't find a proper setting that checks src/ tests.

@alkorang
Copy link
Contributor Author

alkorang commented Nov 26, 2017

rust-lang/cargo#3431
It seems that there were a lot of changes in cargo check options.

I couldn't find a proper setting that checks src/ tests.

Yes, you're right. cargo check --all does not check tests in src.

@alkorang
Copy link
Contributor Author

alkorang commented Nov 26, 2017

I think default behavior of cargo check is without tests. If we want to check tests, then we need cargo test, which is currentlytest option.

It might be confusing because some people could think --all including --lib, --bin, --tests, and --docs, while the others think it would be --all-packages, including every sub-packages.

And it seems that cargo developers chose the second one: --all-packages.

From cargo check --help:

    --all                        Check all packages in the workspace

From cargo test --help:

    --all                        Test all packages in the workspace

So, the behavior for these options seems like this:
cargo check --all: check all packages in the workspace "without test codes"
cargo check --all --tests: check "tests/ directory in" all packages in the workspace
cargo test --all: test all packages in the workspace

We canoot run tests in src/ with cargo check because there is no such option.
Instead, we have to use carge test for it.

@arthurprs
Copy link
Contributor

arthurprs commented Nov 27, 2017

I just found out that recent cargo builds have the --profile test flag, which is what we want here. A good default for the linter could be cargo check --all-targets --profile test which really checks everything.

Source: rust-lang/cargo#4592

@alkorang
Copy link
Contributor Author

alkorang commented Nov 28, 2017

I tried cargo check --all-targets --profile test but it said there is no --profile flag. I'm using the latest version at the moment.

$ rustc --version
rustc 1.22.1 (05e2e1c41 2017-11-22)
$ cargo --version
cargo 0.23.0 (61fa02415 2017-11-22)
$ cargo check --all-targets --profile test
error: Unknown flag: '--profile'

Usage:
    cargo check [options]

Maybe it changed or there is a problem with it.

@arthurprs
Copy link
Contributor

It seems to be available in cargo 0.24

➜  sucredb git:(batch) ✗ cargo check --all-targets --profile test
   Compiling sucredb v0.1.0 (file:///home/arthurprs/dev/sucredb)
    Finished dev [unoptimized + debuginfo] target(s) in 7.49 secs
➜  sucredb git:(batch) ✗ cargo --version
cargo 0.24.0-nightly (abd137ad1 2017-11-12)
➜  sucredb git:(batch) ✗ rustc --version
rustc 1.23.0-nightly (fa26421f5 2017-11-15)
➜  sucredb git:(batch) ✗ 

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

Successfully merging a pull request may close this issue.

2 participants