-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add flag: non-standard-requirements #5402
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
Conversation
csmoe
commented
Apr 22, 2018
•
edited
Loading
edited
- Address Lint againt non semver-open dependencies #5340
- special case
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matklad (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
e049dbf
to
daf1ebd
Compare
@csmoe this looks great! Would you mind opening a PR against semver as well? We can only use published crates. I am not actually sure that is_semver_open is necessary the best API extension, @steveklabnik would know better! |
@matklad Here is the pub fn is_semver_open(&self) -> bool {
if self.predicates.is_empty() {
return true;
}
self.predicates.iter().all(|p| {
match p.op {
Ex | // `=`
Lt | // `<`
LtEq | // `<=`
Gt | // `>`
GtEq | // `>=`
Tilde | // `~`
Wildcard(_) => false, // `*`
Compatible => true, // deal with "1.0.0" or "^1.0.0"
}
})
}
These two statements seem to contradict each other. So as the comment writes above, I didn't address the first rule( Before PR to ...
match p.op {
...
Compatible => {
if is_^(op) {
return false; // `^` is non-semver-open
} else {
return true;
}
}
...
}
... |
Yeah, I've written something very confusing :-) I mean that specifying |
Probably... And I think a better name for "semver-open" should be invented, because |
@matklad Thank for your suggestions.
So I find that enum CompatibleOp {
Caret, // `^1.2.0`
Default_, // `1.2.0`
} More commits tomorrow. |
@matklad
|
@csmoe oh, I didn’t know about semver-parser at all! I think this actually makes things easier: we can use semver-parser directly. It exposes the internal structure of versions, so we don’t need any API changes and can implement all checks in Cargo! |
@matklad FWIW while I do agree we should tackle something like #5340 long-term I don't think we should start warning today, even for the epoch. The last discussion around this for publishing to crates.io (which ended up only disallowing |
☔ The latest upstream changes (presumably #5473) made this pull request unmergeable. Please resolve the merge conflicts. |
@csmoe sorry for letting this to fall through the cracks! The two things to do here I think 1) switch to semver parser from semver 2) feature-gate this functionality. For 2, you'll need to add a flag to cargo/src/cargo/core/features.rs Lines 277 to 311 in c51ed7b
|
@csmoe any luck figuring out the test failures and moving this to a gated feature? |
Ok I'm gonna close this due to inactivity, but feel fre of course to resubmit! |