MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / is_compatible

Function is_compatible

src/binary_installer/versions.rs:23–39  ·  view source on GitHub ↗

Check if an installed version is compatible with the expected version. Returns true if the installed version is greater than or equal to the expected version. Logs warnings for outdated or experimental versions.

(command: &str, installed: &Version, expected: &Version)

Source from the content-addressed store, hash-verified

21/// Returns true if the installed version is greater than or equal to the expected version.
22/// Logs warnings for outdated or experimental versions.
23pub(super) fn is_compatible(command: &str, installed: &Version, expected: &Version) -> bool {
24 match installed.cmp(expected) {
25 std::cmp::Ordering::Less => {
26 warn!(
27 "{command} is installed but the version is too old. expecting {expected} or higher but found installed: {installed}",
28 );
29 false
30 }
31 std::cmp::Ordering::Greater => {
32 warn!(
33 "Using experimental {command} version {installed}. The recommended version is {expected}",
34 );
35 true
36 }
37 std::cmp::Ordering::Equal => true,
38 }
39}
40#[cfg(test)]
41mod tests {
42 use super::*;

Callers 1

is_command_installedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected