Skip to content

Fix table to refer to existing md files, add col for Configurable #988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
8a5bebb
Fix table to refer to existing md files, add col for Configurable
rkeithhill May 6, 2018
dbc5157
Remove deprecated rules, rename to match actual rule sans PS prefix
rkeithhill May 14, 2018
d6310ac
Add Pester tests for rule doc files, add back UseSingularNouns.md file
rkeithhill May 16, 2018
7c05763
Add Pester tests for verifying rule doc README.md file
rkeithhill May 16, 2018
df2fb11
Merge branch 'development' of https://github.com/PowerShell/PSScriptA…
bergmeister May 16, 2018
968bea7
fix typo in documentation folder, remove redundant ipmo call new test…
bergmeister May 17, 2018
9172766
Add rules that will be present in 1.17 and fix typo in md file name
bergmeister May 17, 2018
cf6d321
Merge branch 'development' of https://github.com/PowerShell/PSScriptA…
bergmeister May 17, 2018
0f51b79
remove redundant import of PSScriptAnalyzerTestHelper test helper mod…
bergmeister May 17, 2018
cfbd659
Fix doc tests for PS v4 and PS Core
rkeithhill May 19, 2018
5753492
Remove leftovers from deprecated rules AvoidUsingFilePath, AvoidUnini…
bergmeister May 19, 2018
34f7b53
Merge branch 'development' of https://github.com/PowerShell/PSScriptA…
bergmeister May 19, 2018
58a8aee
added remarks about rules not being available in certain powershell v…
bergmeister May 19, 2018
48f6be3
Add superscript/footnote on rules not available everywhere
rkeithhill May 19, 2018
7968653
Update test to strip off the optional superscript markdown
rkeithhill May 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Engine/Settings/PSGallery.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
'PSAvoidUsingConvertToSecureStringWithPlainText',
'PSUsePSCredentialType',
'PSAvoidUsingUserNameAndPasswordParams',
'PSAvoidUsingFilePath',
'PSDSC*'
)
}
3 changes: 1 addition & 2 deletions Engine/Settings/ScriptSecurity.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
'PSAvoidUsingComputerNameHardcoded',
'PSAvoidUsingConvertToSecureStringWithPlainText',
'PSUsePSCredentialType',
'PSAvoidUsingUserNameAndPasswordParams',
'PSAvoidUsingFilePath')
'PSAvoidUsingUserNameAndPasswordParams')
}
265 changes: 140 additions & 125 deletions PowerShellBestPractices.md

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,10 @@ Pester-based ScriptAnalyzer Tests are located in `path/to/PSScriptAnalyzer/Tests

* Ensure [Pester 4.3.1](https://www.powershellgallery.com/packages/Pester/4.3.1) is installed
* Copy `path/to/PSScriptAnalyzer/out/PSScriptAnalyzer` to a folder in `PSModulePath`
* Go the Tests folder in your local repository
* Run Engine Tests:
* In the root folder of your local repository, run:
``` PowerShell
cd /path/to/PSScriptAnalyzer/Tests/Engine
Invoke-Pester
```
* Run Tests for Built-in rules:
``` PowerShell
cd /path/to/PSScriptAnalyzer/Tests/Rules
Invoke-Pester
$testScripts = ".\Tests\Engine",".\Tests\Rules",".\Tests\Documentation"
Invoke-Pester -Script $testScripts
```

[Back to ToC](#table-of-contents)
Expand Down
5 changes: 3 additions & 2 deletions RuleDocumentation/AvoidGlobalAliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

## Description

Globally scoped aliases override existing aliases within the sessions with matching names. This name collision can cause difficult to debug issues for consumers of modules and scripts.

Globally scoped aliases override existing aliases within the sessions with matching names. This name collision can cause difficult to debug issues for consumers of modules and scripts.

To understand more about scoping, see ```Get-Help about_Scopes```.

**NOTE** This rule is not available in PowerShell version 3 and 4 due to the `StaticParameterBinder.BindCommand` API that the rule uses internally.

## How

Use other scope modifiers for new aliases.
Expand Down
48 changes: 0 additions & 48 deletions RuleDocumentation/AvoidTrapStatement.md

This file was deleted.

34 changes: 0 additions & 34 deletions RuleDocumentation/AvoidUninitializedVariable.md

This file was deleted.

47 changes: 0 additions & 47 deletions RuleDocumentation/AvoidUsingFilePath.md

This file was deleted.

63 changes: 63 additions & 0 deletions RuleDocumentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# PSScriptAnalyzer Rules

## Table of Contents

| Rule | Severity | Configurable |
|------|----------------------------------|--------------|
|[AlignAssignmentStatement](./AlignAssignmentStatement.md) | Warning | |
|[AvoidAssignmentToAutomaticVariable](./AvoidAssignmentToAutomaticVariable.md) | Warning | |
|[AvoidDefaultValueForMandatoryParameter](./AvoidDefaultValueForMandatoryParameter.md) | Warning | |
|[AvoidDefaultValueSwitchParameter](./AvoidDefaultValueSwitchParameter.md) | Warning | |
|[AvoidGlobalAliases<sup>*</sup>](./AvoidGlobalAliases.md) | Warning | |
|[AvoidGlobalFunctions](./AvoidGlobalFunctions.md) | Warning | |
|[AvoidGlobalVars](./AvoidGlobalVars.md) | Warning | |
|[AvoidInvokingEmptyMembers](./AvoidInvokingEmptyMembers.md) | Warning | |
|[AvoidNullOrEmptyHelpMessageAttribute](./AvoidNullOrEmptyHelpMessageAttribute.md) | Warning | |
|[AvoidShouldContinueWithoutForce](./AvoidShouldContinueWithoutForce.md) | Warning | |
|[AvoidUsingCmdletAliases](./AvoidUsingCmdletAliases.md) | Warning | Yes |
|[AvoidUsingComputerNameHardcoded](./AvoidUsingComputerNameHardcoded.md) | Error | |
|[AvoidUsingConvertToSecureStringWithPlainText](./AvoidUsingConvertToSecureStringWithPlainText.md) | Error | |
|[AvoidUsingDeprecatedManifestFields](./AvoidUsingDeprecatedManifestFields.md) | Warning | |
|[AvoidUsingEmptyCatchBlock](./AvoidUsingEmptyCatchBlock.md) | Warning | |
|[AvoidUsingInvokeExpression](./AvoidUsingInvokeExpression.md) | Warning | |
|[AvoidUsingPlainTextForPassword](./AvoidUsingPlainTextForPassword.md) | Warning | |
|[AvoidUsingPositionalParameters](./AvoidUsingPositionalParameters.md) | Warning | |
|[AvoidTrailingWhitespace](./AvoidTrailingWhitespace.md) | Warning | |
|[AvoidUsingUsernameAndPasswordParams](./AvoidUsingUsernameAndPasswordParams.md) | Error | |
|[AvoidUsingWMICmdlet](./AvoidUsingWMICmdlet.md) | Warning | |
|[AvoidUsingWriteHost](./AvoidUsingWriteHost.md) | Warning | |
|[DSCDscExamplesPresent](./DSCDscExamplesPresent.md) | Information | |
|[DSCDscTestsPresent](./DSCDscTestsPresent.md) | Information | |
|[DSCReturnCorrectTypesForDSCFunctions](./DSCReturnCorrectTypesForDSCFunctions.md) | Information | |
|[DSCStandardDSCFunctionsInResource](./DSCStandardDSCFunctionsInResource.md) | Error | |
|[DSCUseIdenticalMandatoryParametersForDSC](./DSCUseIdenticalMandatoryParametersForDSC.md) | Error | |
|[DSCUseIdenticalParametersForDSC](./DSCUseIdenticalParametersForDSC.md) | Error | |
|[DSCUseVerboseMessageInDSCResource](./DSCUseVerboseMessageInDSCResource.md) | Error | |
|[MisleadingBacktick](./MisleadingBacktick.md) | Warning | |
|[MissingModuleManifestField](./MissingModuleManifestField.md) | Warning | |
|[PossibleIncorrectComparisonWithNull](./PossibleIncorrectComparisonWithNull.md) | Warning | |
|[PossibleIncorrectUsageOfAssignmentOperator](./PossibleIncorrectUsageOfAssignmentOperator.md) | Warning | |
|[PossibleIncorrectUsageOfRedirectionOperator](./PossibleIncorrectUsageOfRedirectionOperator.md) | Warning | |
|[ProvideCommentHelp](./ProvideCommentHelp.md) | Information | Yes |
|[ReservedCmdletChar](./ReservedCmdletChar.md) | Error | |
|[ReservedParams](./ReservedParams.md) | Error | |
|[ShouldProcess](./ShouldProcess.md) | Error | |
|[UseApprovedVerbs](./UseApprovedVerbs.md) | Warning | |
|[UseBOMForUnicodeEncodedFile](./UseBOMForUnicodeEncodedFile.md) | Warning | |
|[UseCmdletCorrectly](./UseCmdletCorrectly.md) | Warning | |
|[UseDeclaredVarsMoreThanAssignments](./UseDeclaredVarsMoreThanAssignments.md) | Warning | |
|[UseLiteralInitializerForHashtable](./UseLiteralInitializerForHashtable.md) | Warning | |
|[UseOutputTypeCorrectly](./UseOutputTypeCorrectly.md) | Information | |
|[UsePSCredentialType](./UsePSCredentialType.md) | Warning | |
|[UseShouldProcessForStateChangingFunctions](./UseShouldProcessForStateChangingFunctions.md) | Warning | |
|[UseSingularNouns<sup>*</sup>](./UseSingularNouns.md) | Warning | |
|[UseSupportsShouldProcess](./UseSupportsShouldProcess.md) | Warning | |
|[UseToExportFieldsInManifest](./UseToExportFieldsInManifest.md) | Warning | |
|[UseCompatibleCmdlets](./UseCompatibleCmdlets.md) | Warning | Yes |
|[PlaceOpenBrace](./PlaceOpenBrace.md) | Warning | Yes |
|[PlaceCloseBrace](./PlaceCloseBrace.md) | Warning | Yes |
|[UseConsistentIndentation](./UseConsistentIndentation.md) | Warning | Yes |
|[UseConsistentWhitespace](./UseConsistentWhitespace.md) | Warning | Yes |
|[UseUTF8EncodingForHelpFile](./UseUTF8EncodingForHelpFile.md) | Warning | |

<sup>*</sup> Rule is not available on all PowerShell versions, editions and/or OS platforms. See the rule's documentation for details.
6 changes: 4 additions & 2 deletions RuleDocumentation/UseSingularNouns.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

PowerShell team best practices state cmdlets should use singular nouns and not plurals.

**NOTE** This rule is not available in PowerShell Core due to the PluralizationService API that the rule uses internally.

## How

Change plurals to singular.
Expand All @@ -17,7 +19,7 @@ Change plurals to singular.
``` PowerShell
function Get-Files
{
...
...
}
```

Expand All @@ -26,6 +28,6 @@ function Get-Files
``` PowerShell
function Get-File
{
...
...
}
```
112 changes: 2 additions & 110 deletions Rules/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading