Skip to content

Commit 06164d0

Browse files
committed
Add Copilot review suggestions
1 parent 269207f commit 06164d0

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Engine/Commands/TestScriptAnalyzerSettingsFileCommand.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,12 @@ private static bool IsValueCompatible(object value, Type targetType)
583583
return value is string s && int.TryParse(s, out _);
584584
}
585585

586-
// String property — almost anything is acceptable since ToString works.
586+
// String property — only accept actual strings so that non-string
587+
// values for constrained options (with PossibleValues) are caught by
588+
// the type check rather than silently skipping enum validation.
587589
if (targetType == typeof(string))
588590
{
589-
return true;
591+
return value is string;
590592
}
591593

592594
// Array property — accept arrays or a single element of the right kind.

docs/Cmdlets/New-ScriptAnalyzerSettingsFile.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ configuration defined by the given preset.
2626

2727
When **BaseOnPreset** is not provided, the generated file includes all current rules in the
2828
`IncludeRules` list and populates the `Rules` section with all configurable properties, set to their
29-
default values. Both modes also include `CustomRulePath`, `RecurseCustomRulePath`, and
30-
`IncludeDefaultRules` keys with descriptive comments so the file is immediately ready for
31-
customization.
29+
default values.
3230

3331
If a settings file already exists at the target path, the cmdlet emits a terminating error unless
3432
the **Force** parameter is specified - in which case it's overwritten.
@@ -41,7 +39,7 @@ the **Force** parameter is specified - in which case it's overwritten.
4139
New-ScriptAnalyzerSettingsFile
4240
```
4341

44-
Creates `PSScriptAnalyzerSettings.psd1` in the current working directory incluindg all rules and
42+
Creates `PSScriptAnalyzerSettings.psd1` in the current working directory including all rules and
4543
all configurable options set to their defaults.
4644

4745
### EXAMPLE 2 - Create a settings file based on a preset

0 commit comments

Comments
 (0)