Skip to content

Commit 0cf22a1

Browse files
author
Quoc Truong
committed
Change configuration to settings
1 parent 53bc3ff commit 0cf22a1

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

Engine/Commands/InvokeScriptAnalyzerCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ public SwitchParameter SuppressedOnly
174174
[Alias("Profile")]
175175
[Parameter(Mandatory = false)]
176176
[ValidateNotNull]
177-
public object Configuration
177+
public object Settings
178178
{
179-
get { return configuration; }
180-
set { configuration = value; }
179+
get { return settings; }
180+
set { settings = value; }
181181
}
182182

183-
private object configuration;
183+
private object settings;
184184

185185
private bool stopProcessing;
186186

@@ -196,7 +196,7 @@ protected override void BeginProcessing()
196196
string[] rulePaths = Helper.ProcessCustomRulePaths(customRulePath,
197197
this.SessionState, recurseCustomRulePath);
198198

199-
if (!ScriptAnalyzer.Instance.ParseProfile(this.configuration, this.SessionState.Path, this))
199+
if (!ScriptAnalyzer.Instance.ParseProfile(this.settings, this.SessionState.Path, this))
200200
{
201201
stopProcessing = true;
202202
return;

Engine/Strings.Designer.cs

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Engine/Strings.resx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,16 @@
193193
<value>Cannot find any DiagnosticRecord with the Rule Suppression ID {0}.</value>
194194
</data>
195195
<data name="WrongKey" xml:space="preserve">
196-
<value>{0} is not a valid key in the configuration hashtable: line {1} column {2} in file {3}. Valid keys are ExcludeRules, IncludeRules and Severity.</value>
196+
<value>{0} is not a valid key in the settings hashtable: line {1} column {2} in file {3}. Valid keys are ExcludeRules, IncludeRules and Severity.</value>
197197
</data>
198198
<data name="WrongKeyFormat" xml:space="preserve">
199-
<value>Key in the configuration hashtable should be a string: line {0} column {1} in file {2}</value>
199+
<value>Key in the settings hashtable should be a string: line {0} column {1} in file {2}</value>
200200
</data>
201201
<data name="WrongValueFormat" xml:space="preserve">
202-
<value>Value in the configuration hashtable should be a string or an array of strings: line {0} column {1} in file {2}</value>
202+
<value>Value in the settings hashtable should be a string or an array of strings: line {0} column {1} in file {2}</value>
203203
</data>
204204
<data name="InvalidProfile" xml:space="preserve">
205-
<value>Profile file '{0}' is invalid because it does not contain a hashtable.</value>
205+
<value>Settings file '{0}' is invalid because it does not contain a hashtable.</value>
206206
</data>
207207
<data name="ParseErrorFormatForScriptDefinition" xml:space="preserve">
208208
<value>Parse error in script definition: {0} at line {1} column {2}.</value>
@@ -217,30 +217,30 @@
217217
<value>Analyzing Script Definition.</value>
218218
</data>
219219
<data name="ConfigurationFileHasNoHashTable" xml:space="preserve">
220-
<value>ConfigurationFileHasNoHashTable</value>
220+
<value>SettingsFileHasNoHashTable</value>
221221
</data>
222222
<data name="ConfigurationFileNotFound" xml:space="preserve">
223-
<value>ConfigurationFileNotFound</value>
223+
<value>SettingsFileNotFound</value>
224224
</data>
225225
<data name="ConfigurationKeyNotAString" xml:space="preserve">
226-
<value>ConfigurationKeyNotAString</value>
226+
<value>SettingsKeyNotAString</value>
227227
</data>
228228
<data name="ConfigurationValueNotAString" xml:space="preserve">
229-
<value>ConfigurationValueNotAString</value>
229+
<value>SettingsValueNotAString</value>
230230
</data>
231231
<data name="ConfigurationValueWrongFormat" xml:space="preserve">
232-
<value>ConfigurationValueWrongFormat</value>
232+
<value>SettingsValueWrongFormat</value>
233233
</data>
234234
<data name="WrongConfigurationKey" xml:space="preserve">
235-
<value>WrongConfigurationKey</value>
235+
<value>WrongSettingsKey</value>
236236
</data>
237237
<data name="KeyNotString" xml:space="preserve">
238-
<value>Key {0} in the configuration is not a string.</value>
238+
<value>Key {0} in the settings is not a string.</value>
239239
</data>
240240
<data name="WrongKeyHashTable" xml:space="preserve">
241-
<value>{0} is not a valid key in the configuration hashtable. Valid keys are ExcludeRules, IncludeRules and Severity.</value>
241+
<value>{0} is not a valid key in the settings hashtable. Valid keys are ExcludeRules, IncludeRules and Severity.</value>
242242
</data>
243243
<data name="WrongValueHashTable" xml:space="preserve">
244-
<value>Value {0} for key {1} has the wrong data type. Value in the configuration hashtable should be a string or an array of strings.</value>
244+
<value>Value {0} for key {1} has the wrong data type. Value in the settings hashtable should be a string or an array of strings.</value>
245245
</data>
246246
</root>

Tests/Engine/GlobalSuppression.test.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Describe "GlobalSuppression" {
5555
}
5656

5757
It "Does not raise any violation for computername hard-coded using configuration hashtable" {
58-
$hashtableConfiguration = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Configuration @{"includerules" = @("PSAvoidUsingCmdletAliases", "PSUseOutputTypeCorrectly")} |
58+
$hashtableConfiguration = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Settings @{"includerules" = @("PSAvoidUsingCmdletAliases", "PSUseOutputTypeCorrectly")} |
5959
Where-Object { $_.RuleName -eq "PSAvoidUsingComputerNameHardcoded"}
6060
$hashtableConfiguration.Count | Should Be 0
6161
}
@@ -77,29 +77,29 @@ Describe "GlobalSuppression" {
7777
}
7878

7979
It "Does not raise any violation for use output type correctly with configuration hashtable" {
80-
$hashtableConfiguration = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Configuration @{"severity" = "warning"} |
80+
$hashtableConfiguration = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Settings @{"severity" = "warning"} |
8181
Where-Object {$_.RuleName -eq "PSUseOutputTypeCorrectly"}
8282
$hashtableConfiguration.Count | should be 0
8383
}
8484
}
8585

8686
Context "Error Case" {
8787
It "Raises Error for file not found" {
88-
$invokeWithError = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Configuration ".\ThisFileDoesNotExist.ps1" -ErrorAction SilentlyContinue
88+
$invokeWithError = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Settings ".\ThisFileDoesNotExist.ps1" -ErrorAction SilentlyContinue
8989
$invokeWithError.Count | should be 0
90-
$Error[0].FullyQualifiedErrorId | should match "ConfigurationFileNotFound,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
90+
$Error[0].FullyQualifiedErrorId | should match "SettingsFileNotFound,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
9191
}
9292

9393
It "Raises Error for file with no hash table" {
94-
$invokeWithError = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Configuration "$directory\GlobalSuppression.ps1" -ErrorAction SilentlyContinue
94+
$invokeWithError = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Settings "$directory\GlobalSuppression.ps1" -ErrorAction SilentlyContinue
9595
$invokeWithError.Count | should be 0
96-
$Error[0].FullyQualifiedErrorId | should match "ConfigurationFileHasNoHashTable,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
96+
$Error[0].FullyQualifiedErrorId | should match "SettingsFileHasNoHashTable,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
9797
}
9898

9999
It "Raises Error for wrong profile" {
100-
$invokeWithError = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Configuration "$directory\WrongProfile.ps1" -ErrorAction SilentlyContinue
100+
$invokeWithError = Invoke-ScriptAnalyzer "$directory\GlobalSuppression.ps1" -Settings "$directory\WrongProfile.ps1" -ErrorAction SilentlyContinue
101101
$invokeWithError.Count | should be 0
102-
$Error[0].FullyQualifiedErrorId | should match "WrongConfigurationKey,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
102+
$Error[0].FullyQualifiedErrorId | should match "WrongSettingsKey,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand"
103103
}
104104
}
105105
}

0 commit comments

Comments
 (0)