Skip to content

Commit 92d0167

Browse files
author
Kapil Borle
committed
Rename UseWhitespace rule to UseConsistentWhitespace
1 parent 9e16982 commit 92d0167

File tree

5 files changed

+24
-23
lines changed

5 files changed

+24
-23
lines changed

RuleDocumentation/UseWhitespace.md renamed to RuleDocumentation/UseConsistentWhitespace.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# UseWhitespace
1+
# UseConsistentWhitespace
22
**Severity Level: Warning**
33

44
## Description
@@ -9,13 +9,14 @@ This rule enforces consistent brace, parenthesis, binary operator, assignment op
99
## Configuration
1010
```powershell
1111
Rules = @{
12-
PSUseWhitespace = @{
12+
PSUseConsistentWhitespace = @{
1313
Enable = $true
1414
CheckOpenBrace = $true
1515
CheckOpenParen = $true
1616
CheckOperator = $true
1717
CheckSeparator = $true
1818
}
19+
}
1920
```
2021

2122
### Parameters

Rules/ScriptAnalyzerBuiltinRules.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<Compile Include="PlaceOpenBrace.cs" />
121121
<Compile Include="PlaceCloseBrace.cs" />
122122
<Compile Include="UseConsistentIndentation.cs" />
123-
<Compile Include="UseWhitespace.cs" />
123+
<Compile Include="UseConsistentWhitespace.cs" />
124124
</ItemGroup>
125125
<ItemGroup>
126126
<ProjectReference Include="..\Engine\ScriptAnalyzerEngine.csproj">

Rules/Strings.resx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -915,28 +915,28 @@
915915
<data name="UseConsistentIndentationError" xml:space="preserve">
916916
<value>Indentation not consistent</value>
917917
</data>
918-
<data name="UseWhitespaceName" xml:space="preserve">
919-
<value>UseWhitespace</value>
918+
<data name="UseConsistentWhitespaceName" xml:space="preserve">
919+
<value>UseConsistentWhitespace</value>
920920
</data>
921-
<data name="UseWhitespaceCommonName" xml:space="preserve">
921+
<data name="UseConsistentWhitespaceCommonName" xml:space="preserve">
922922
<value>Use whitespaces</value>
923923
</data>
924-
<data name="UseWhitespaceDescription" xml:space="preserve">
924+
<data name="UseConsistentWhitespaceDescription" xml:space="preserve">
925925
<value>Check for whitespace between keyword and open paren/curly, around assigment operator ('='), around arithmetic operators and after separators (',' and ';')</value>
926926
</data>
927-
<data name="UseWhitespaceErrorBeforeBrace" xml:space="preserve">
927+
<data name="UseConsistentWhitespaceErrorBeforeBrace" xml:space="preserve">
928928
<value>Use space before open brace.</value>
929929
</data>
930-
<data name="UseWhitespaceErrorBeforeParen" xml:space="preserve">
930+
<data name="UseConsistentWhitespaceErrorBeforeParen" xml:space="preserve">
931931
<value>Use space before open parenthesis.</value>
932932
</data>
933-
<data name="UseWhitespaceErrorOperator" xml:space="preserve">
933+
<data name="UseConsistentWhitespaceErrorOperator" xml:space="preserve">
934934
<value>Use space before and after binary and assignment operators.</value>
935935
</data>
936-
<data name="UseWhitespaceErrorSeparatorComma" xml:space="preserve">
936+
<data name="UseConsistentWhitespaceErrorSeparatorComma" xml:space="preserve">
937937
<value>Use space after a comma.</value>
938938
</data>
939-
<data name="UseWhitespaceErrorSeparatorSemi" xml:space="preserve">
939+
<data name="UseConsistentWhitespaceErrorSeparatorSemi" xml:space="preserve">
940940
<value>Use space after a semicolon.</value>
941941
</data>
942942
</root>

Rules/UseWhitespace.cs renamed to Rules/UseConsistentWhitespace.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
2727
#if !CORECLR
2828
[Export(typeof(IScriptRule))]
2929
#endif
30-
public class UseWhitespace : ConfigurableRule
30+
public class UseConsistentWhitespace : ConfigurableRule
3131
{
3232
private enum ErrorKind { Brace, Paren, Operator, SeparatorComma, SeparatorSemi };
3333
private const int whiteSpaceSize = 1;
@@ -100,15 +100,15 @@ private string GetError(ErrorKind kind)
100100
switch (kind)
101101
{
102102
case ErrorKind.Brace:
103-
return string.Format(CultureInfo.CurrentCulture, Strings.UseWhitespaceErrorBeforeBrace);
103+
return string.Format(CultureInfo.CurrentCulture, Strings.UseConsistentWhitespaceErrorBeforeBrace);
104104
case ErrorKind.Operator:
105-
return string.Format(CultureInfo.CurrentCulture, Strings.UseWhitespaceErrorOperator);
105+
return string.Format(CultureInfo.CurrentCulture, Strings.UseConsistentWhitespaceErrorOperator);
106106
case ErrorKind.SeparatorComma:
107-
return string.Format(CultureInfo.CurrentCulture, Strings.UseWhitespaceErrorSeparatorComma);
107+
return string.Format(CultureInfo.CurrentCulture, Strings.UseConsistentWhitespaceErrorSeparatorComma);
108108
case ErrorKind.SeparatorSemi:
109-
return string.Format(CultureInfo.CurrentCulture, Strings.UseWhitespaceErrorSeparatorSemi);
109+
return string.Format(CultureInfo.CurrentCulture, Strings.UseConsistentWhitespaceErrorSeparatorSemi);
110110
default:
111-
return string.Format(CultureInfo.CurrentCulture, Strings.UseWhitespaceErrorBeforeParen);
111+
return string.Format(CultureInfo.CurrentCulture, Strings.UseConsistentWhitespaceErrorBeforeParen);
112112
}
113113
}
114114

@@ -321,15 +321,15 @@ private bool IsPreviousTokenOnSameLine(LinkedListNode<Token> lparen)
321321
/// </summary>
322322
public override string GetCommonName()
323323
{
324-
return string.Format(CultureInfo.CurrentCulture, Strings.UseWhitespaceCommonName);
324+
return string.Format(CultureInfo.CurrentCulture, Strings.UseConsistentWhitespaceCommonName);
325325
}
326326

327327
/// <summary>
328328
/// Retrieves the description of this rule.
329329
/// </summary>
330330
public override string GetDescription()
331331
{
332-
return string.Format(CultureInfo.CurrentCulture, Strings.UseWhitespaceDescription);
332+
return string.Format(CultureInfo.CurrentCulture, Strings.UseConsistentWhitespaceDescription);
333333
}
334334

335335
/// <summary>
@@ -341,7 +341,7 @@ public override string GetName()
341341
CultureInfo.CurrentCulture,
342342
Strings.NameSpaceFormat,
343343
GetSourceName(),
344-
Strings.UseWhitespaceName);
344+
Strings.UseConsistentWhitespaceName);
345345
}
346346

347347
/// <summary>

Tests/Rules/UseWhitespace.tests.ps1 renamed to Tests/Rules/UseConsistentWhitespace.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $testRootDirectory = Split-Path -Parent $directory
44
Import-Module PSScriptAnalyzer
55
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
66

7-
$ruleName = "PSUseWhitespace"
7+
$ruleName = "PSUseConsistentWhitespace"
88
$ruleConfiguration = @{
99
Enable = $true
1010
CheckOpenBrace = $false
@@ -16,7 +16,7 @@ $ruleConfiguration = @{
1616
$settings = @{
1717
IncludeRules = @($ruleName)
1818
Rules = @{
19-
PSUseWhitespace = $ruleConfiguration
19+
PSUseConsistentWhitespace = $ruleConfiguration
2020
}
2121
}
2222

0 commit comments

Comments
 (0)