Skip to content

Commit

Permalink
feat(core): ignore missing snapTo dependencies by default
Browse files Browse the repository at this point in the history
Closes #173
  • Loading branch information
JamieMason committed Feb 5, 2025
1 parent a5a997a commit c1472bf
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
7 changes: 7 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ impl Context {
for instance in self.instances.iter() {
match *instance.state.borrow() {
InstanceState::Valid(_) => continue,
InstanceState::Suspect(_) => {
if self.config.rcfile.strict {
std::process::exit(1);
} else {
continue;
}
}
_ => std::process::exit(1),
}
}
Expand Down
1 change: 1 addition & 0 deletions src/effects/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub fn run(ctx: Context) -> Context {
},
InstanceState::Suspect(variant) => match variant {
SuspectInstance::RefuseToBanLocal
| SuspectInstance::DependsOnMissingSnapTarget
| SuspectInstance::RefuseToPinLocal
| SuspectInstance::RefuseToSnapLocal
| SuspectInstance::InvalidLocalVersion => {
Expand Down
12 changes: 6 additions & 6 deletions src/effects/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ impl Ui<'_> {
UnfixableInstance::SameRangeMismatch => {
info!("{count} {icon} {name} {state_links}");
}
UnfixableInstance::DependsOnMissingSnapTarget => {
info!("{count} {icon} {name} {state_links}");
}
}
}
InvalidInstance::Conflict(variant) => {
Expand Down Expand Up @@ -201,6 +198,9 @@ impl Ui<'_> {
InstanceState::Suspect(variant) => {
let icon = self.warn_icon();
match variant {
SuspectInstance::DependsOnMissingSnapTarget => {
info!("{count} {icon} {name} {state_links}");
}
SuspectInstance::RefuseToBanLocal => {
info!("{count} {icon} {name} {state_links}");
}
Expand Down Expand Up @@ -332,9 +332,6 @@ impl Ui<'_> {
UnfixableInstance::SameRangeMismatch => {
info!(" {icon} {actual} {location} {state_link}");
}
UnfixableInstance::DependsOnMissingSnapTarget => {
info!(" {icon} {actual} {location} {state_link}");
}
},
InvalidInstance::Conflict(variant) => match variant {
SemverGroupAndVersionConflict::MatchConflictsWithHighestOrLowestSemver => {
Expand All @@ -361,6 +358,9 @@ impl Ui<'_> {
InstanceState::Suspect(variant) => {
let icon = self.warn_icon();
match variant {
SuspectInstance::DependsOnMissingSnapTarget => {
info!(" {icon} {actual} {location} {state_link}");
}
SuspectInstance::RefuseToBanLocal => {
info!(" {icon} {actual} {location} {state_link}");
}
Expand Down
10 changes: 5 additions & 5 deletions src/instance_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ pub enum UnfixableInstance {
/// - ? Instance has no semver group
/// - ? We can't know what range the user wants and have to ask them
SameRangeMismatch,
/// - ✓ Instance is in a snapped to version group
/// - ✘ An instance of the same dependency was not found in any of the snapped
/// to packages
/// - ✘ This is a misconfiguration resulting in this instance being orphaned
DependsOnMissingSnapTarget,
}

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
Expand Down Expand Up @@ -238,4 +233,9 @@ pub enum SuspectInstance {
/// - ! Local Instance has no version property
/// - ! Not an error on its own unless an instance of it mismatches
InvalidLocalVersion,
/// - ✓ Instance is in a snapped to version group
/// - ✘ An instance of the same dependency was not found in any of the snapped
/// to packages
/// - ! This is a misconfiguration resulting in this instance being orphaned
DependsOnMissingSnapTarget,
}
2 changes: 1 addition & 1 deletion src/visit_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ pub fn visit_packages(ctx: Context) -> Context {
} else {
debug!(" no target version was found");
dependency.instances.borrow().iter().for_each(|instance| {
instance.mark_unfixable(DependsOnMissingSnapTarget);
instance.mark_suspect(DependsOnMissingSnapTarget);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/visit_packages_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,7 @@ fn instance_cannot_find_a_snapped_to_version() {
overridden: None,
},
ExpectedInstance {
state: InstanceState::unfixable(DependsOnMissingSnapTarget),
state: InstanceState::suspect(DependsOnMissingSnapTarget),
dependency_name: "foo",
id: "foo in /dependencies of follower",
actual: "1.0.0",
Expand Down

0 comments on commit c1472bf

Please sign in to comment.