-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Two new modes --all
and --stdin
for check-ignore
#4323
Conversation
Fix iterative#4321 Introduce new arguments --all for dvc check-ignore Add tests for dvc check-ignore --all
-all
and --stdin
for check-ignore--all
and --stdin
for check-ignore
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.
LGTM, one change request.
1. `--stdin` and targets can and only can have one 2. more tests
@karajan1001 |
Codecov Report
@@ Coverage Diff @@
## master #4323 +/- ##
==========================================
- Coverage 91.24% 91.19% -0.05%
==========================================
Files 177 177
Lines 12182 12209 +27
==========================================
+ Hits 11115 11134 +19
- Misses 1067 1075 +8
Continue to review full report at Codecov.
|
1. Add a new tests with mock stdin for interactive mode 2. Solve the problem of `assert "" in caplog.text` in tests always `True`.
@pared |
When you are using a mocker inside a test, patches and mocks are applied only to this test. So, if you are worried, whether it's possible to "leak" the mock to other tests - no, it should not happen.
I think it's fine to use this patch. |
Hi! Maybe you can address #4282 (review) and #4282 (review) here @karajan1001 ? Thanks! |
@jorgeorpinel Let's not do that. Let's not expand the scope of this PR, those changes are completely unrelated. |
I had considered doing so, but give up. BTW, doc of this PR needs to be reviewed as well. |
1. remove path_input and make _ask to a public method instead
Thank you @karajan1001 ! π There are some tiny inconsistencies with stuff like messages, but we'll adjust them along the way. It is great to have such a powerful tool in our toolbox! |
@karajan1001 is there a docs PR for this already? We haven't even merged the previous one π (see iterative/dvc.org#1629 (comment)) |
Not already, I'm waiting for this one. And it would be created soon. |
"Empty string is not a valid pathspec. Please use . " | ||
"instead if you meant to match all paths." |
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.
What is a pathspec?
Can users actually send an empty string (e.g. ''
)? Or does this happen when you don't send any args?
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.
pathspec
means the target to be checked- It is in an interactive mode where users can type string as the target, and this happened when users type send an empty string.
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.
It is in an interactive mode
So maybe don't say anything and just go to the next >
? Seems intuitive enough that way. I just tried it and noticed it crashes after this error msg (i.e. it stops the interactive mode).
UPDATE: On Windows at least, there's no >
chars in interactive mode, see iterative/dvc.org#1675 (review)
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.
p.s. when I send an empty string as target i.e. dvc check-ignore ''
it just checks it (never matches even if *
is a pattern in .dvcignore
) and this error isn't presented. Seems slightly inconsistent. I vote to just remove it altogether π
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.
Extracted to #4361
if self.args.quiet and self.args.details: | ||
raise DvcException("cannot use both `--details` and `--quiet`") |
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.
Maybe --quiet should just win here?
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.
Maybe --quiet should just win here?
Yes, it used to be --verbose
and --quiet
. They might cause some problems, and had been fixed in #4304.
And for --details
and --quiet
we can just let --quiet
win.
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.
Left some questions @karajan1001 βοΈ
We can discuss my other suggestions in iterative/dvc.org/pull/1675 and I'll apply them (probably in #4358).
* cmd: remove unnecessary commas in get and import * cmd: fix typo in add * cmd: remote copy edits per #1617 (comment) * guide: .dvcignore copy edit * cmd: init copy edits * clarify about dirs in import -o * cmd: review get -o desc * dvcignore: updates to guide and check-ignore ref. per #1629 (review) et al. * cmd: update check-ignore -n per iterative/dvc#4323 (comment) * cmd: fix get.import -o descriptions per #1673 (review) and #1673 (review) * cmd: copy edits to remote add/modify
* check_ignore: update help output per #4282 (review) and #4282 (review) * check-ignore: more output string updates per #4323 et al. * check-ignore: min text update to match iterative/dvc.org/pull/1673 Co-authored-by: Ruslan Kuprieiev <[email protected]>
Fix #4321
Introduce new arguments --all for dvc check-ignore
Add tests for dvc check-ignore --all
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. π