-
Notifications
You must be signed in to change notification settings - Fork 31
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
Make default output less noisy #81
Make default output less noisy #81
Conversation
PR is a draft because this is the remaining output after the changes:
So now you don't know what project was cleaned. |
The list of installed toolchains is shown for every project it sweeps, but I think it is always the same. So we should probably just show it once at the start. This is the function that loads the toolchains: cargo-sweep/src/fingerprint.rs Lines 373 to 374 in 75414ca
It's always constant, because it calls the |
68271d3
to
ccebf4b
Compare
Should be ready for review now, fixing the list of toolchains being outputted repeatedly will require a little bit of refactoring, so I prefer doing it in another PR. |
Sorry I had to force push again, |
I just fixed the clippy warnings in #80 (and made a couple other changes that should make the errors easier to read) - do you mind rebasing over master? Also, please revert the changes to the assertion message, like the error says they don't do what you expect in 2018 edition and I would prefer to switch the edition in a separate PR (edit: done #83). |
ccebf4b
to
af05edb
Compare
Oh ok, I'll do that, I was having a lot of trouble with the assertion message, so I force pushed like 5 times, let me fix it. |
af05edb
to
701561e
Compare
by logging the list of deleted files on the 'Debug' log level, requiring the user to provide the --verbose flag to see it previously, this list was logged to the 'Info' log level
701561e
to
48b4d8c
Compare
Do you mind adding a test showing the new output? Comparing |
48b4d8c
to
9120c29
Compare
now it requires a target directory to which cargo-sweep will try to perform the cleaning
dcf7008
to
d78a8eb
Compare
tests/integration.rs
Outdated
let pattern = unindent(&format!( | ||
r#"\[DEBUG\] cleaning: "/tmp/{regex_skip}" with remove_older_until_fits | ||
\[DEBUG\] size_to_remove: {regex_skip} | ||
\[DEBUG\] Sizing: "/tmp/{regex_skip}/debug" with total_disk_space_in_a_profile | ||
\[DEBUG\] Hashs by time: \[ | ||
\( | ||
{regex_skip}, | ||
"{regex_skip}", | ||
\), | ||
\] | ||
\[DEBUG\] cleaning: "/tmp/{regex_skip}/debug" with remove_not_built_with_in_a_profile | ||
\[DEBUG\] Successfully removed: "/tmp/{regex_skip}/debug/deps/libsample_project-{regex_skip}.rlib" | ||
\[DEBUG\] Successfully removed: "/tmp/{regex_skip}/debug/deps/libsample_project-{regex_skip}.rmeta" | ||
\[DEBUG\] Successfully removed: "/tmp/{regex_skip}/debug/deps/sample_project-{regex_skip}.d" | ||
\[DEBUG\] Successfully removed: "/tmp/{regex_skip}/debug/.fingerprint/sample-project-{regex_skip}" | ||
\[INFO\] Cleaned {regex_skip} from "/tmp/{regex_skip}""#, | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does work, but if the test fails, it doesn't give any tips on what changed, I'm not sure if it's a great approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, here's the output we are matching:
[DEBUG] cleaning: "/tmp/.tmpXhoLjT" with remove_older_until_fits
[DEBUG] size_to_remove: 46978
[DEBUG] Sizing: "/tmp/.tmpXhoLjT/debug" with total_disk_space_in_a_profile
[DEBUG] Hashs by time: [
(
13.926894ms,
"261b05c2354104eb",
),
]
[DEBUG] cleaning: "/tmp/.tmpXhoLjT/debug" with remove_not_built_with_in_a_profile
[DEBUG] Successfully removed: "/tmp/.tmpXhoLjT/debug/deps/libsample_project-261b05c2354104eb.rlib"
[DEBUG] Successfully removed: "/tmp/.tmpXhoLjT/debug/deps/libsample_project-261b05c2354104eb.rmeta"
[DEBUG] Successfully removed: "/tmp/.tmpXhoLjT/debug/deps/sample_project-261b05c2354104eb.d"
[DEBUG] Successfully removed: "/tmp/.tmpXhoLjT/debug/.fingerprint/sample-project-261b05c2354104eb"
[INFO] Cleaned 9.43 KiB from "/tmp/.tmpXhoLjT"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok; if you run the test with --nocapture
it will show the original output.
tests/integration.rs
Outdated
|
||
let output = std::str::from_utf8(&assert.get_output().stdout).unwrap(); | ||
|
||
let regex_skip = r#".+?"#; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can just be .*
instead of needing to make it optional; and at that point I think it would be simpler to inline it instead of using format
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! A regex Gotcha.
Fun fact: Inserting an ?
after a quantifier (*
, +
, ?
or {N..M}
) switches
to non-greedy matching, which can be good for performance as it decreases
excessive backtracking from the usual greedy eater.
(It's the same symbol to make stuff optional... why...)
Well, that's a tiny text to match so I'll switch to .+
anyways 👍.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Happy to merge this with the last nit fixed :)
5749886
to
5f6cf75
Compare
Now it's failing because of Windows paths
|
Fixed, if you want I can squash the last (one or two) commits. |
Thanks for sticking with this! |
Fixes #74.
cargo-sweep
logs every deleted file, this makes the outputvery noisy and hard to follow (outputs approximately a thousand
lines per cleaned project).
This PR changes the default output to omit deleted files, and
only show them with the
--verbose
flag.