Skip to content

Commit a58d099

Browse files
SteveL-MSFTSteve Lee (POWERSHELL HE/HIM) (from Dev Box)
authored andcommitted
fix copilot issues
1 parent 5677bb0 commit a58d099

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

dsc/src/subcommand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ pub fn validate_config(config: &Configuration, progress_format: ProgressFormat)
496496
let Some(type_name) = resource_block["type"].as_str() else {
497497
return Err(DscError::Validation(t!("subcommand.resourceTypeNotSpecified").to_string()));
498498
};
499-
resource_types.push(DiscoveryFilter::new(&type_name.to_lowercase(), resource_block["api_version"].as_str().map(std::string::ToString::to_string)));
499+
resource_types.push(DiscoveryFilter::new(&type_name, resource_block["api_version"].as_str().map(std::string::ToString::to_string)));
500500
}
501501
dsc.find_resources(&resource_types, progress_format);
502502

dsc/tests/dsc_resource_set.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Describe 'Invoke a resource set directly' {
1414
$out.afterState.version | Should -BeExactly '1.1.2'
1515
$out.changedProperties | Should -BeNullOrEmpty
1616
}
17-
}
17+
}

dsc/tests/dsc_resource_test.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ Describe 'Invoke a resource test directly' {
3333
$out.actualState.version | Should -BeExactly '1.1.2'
3434
$out.inDesiredState | Should -Be $true
3535
}
36-
}
36+
}

dsc_lib/src/discovery/command_discovery.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,12 @@ fn filter_resources(found_resources: &mut BTreeMap<String, Vec<DscResource>>, re
548548
}
549549
}
550550
if required_resources.values().all(|&v| v) {
551-
break;
551+
return;
552552
}
553553
}
554554
}
555555

556+
/// Inserts a resource into tree adding to vector if already exists
556557
fn insert_resource(resources: &mut BTreeMap<String, Vec<DscResource>>, resource: &DscResource) {
557558
if let Some(resource_versions) = resources.get_mut(&resource.type_name.to_lowercase()) {
558559
// compare the resource versions and insert newest to oldest using semver

dsc_lib/src/discovery/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,16 @@ impl Discovery {
158158
}
159159
}
160160

161+
/// Fix the semantic versioning requirements of a given version requirements string.
162+
/// The `semver` crate uses caret (meaning compatible) by default instead of exact if not specified
163+
///
164+
/// # Parameters
165+
/// * `version` - The version requirements string to fix.
166+
///
167+
/// # Returns
168+
/// The fixed version requirements string.
161169
#[must_use]
162170
pub fn fix_semver(version: &str) -> String {
163-
// The semver crate uses caret (meaning compatible) by default instead of exact if not specified
164171
// Check if is semver, then if the first character is a number, then we prefix with =
165172
if Version::parse(version).is_ok() && version.chars().next().is_some_and(|c| c.is_ascii_digit()) {
166173
return format!("={version}");

0 commit comments

Comments
 (0)