Skip to content

[pull] master from PowerShell:master #13

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

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
85ad15b
Update minimum PowerShell Core version to 7.2.11 as 7.0 is now EOL (#…
bergmeister Sep 11, 2023
bd79460
Remove dead code and simplify (#1856)
bergmeister Sep 11, 2023
2e77c2a
PSReservedParams - link about_CommonParameters (#1908)
petervandivier Sep 11, 2023
40be593
Enable suppression of PSAvoidAssignmentToAutomaticVariable for specif…
fflaten Sep 17, 2023
772997f
Upgrade to use .NET 6 (#1873)
bergmeister Sep 17, 2023
af02e80
Add ErrorView to SpecialVars.cs (#1865)
ewisniew0 Sep 17, 2023
847b146
Generate strongly typed resources as part of build (#1855)
bergmeister Jan 16, 2024
45edb8d
Allow suppression of PSUseSingularNouns for specific function (#1903)
fflaten Jan 16, 2024
e22c65f
Adding ToString() methods to [CorrectionExtent] and [DiagnosticRecord…
StartAutomating Jan 16, 2024
59190fe
Add PSNativeCommandUseErrorActionPreference preference variable (#1954)
aelij Jan 16, 2024
9314e69
Prevent NullReferenceException for null analysis type. (#1949)
hubuk Jan 16, 2024
da64672
Convert UseSingularNouns to configurable rule and add Windows to allo…
MJVL Jan 18, 2024
2245064
Bump Newtonsoft.Json to 13.0.3 (#1866)
dependabot[bot] Jan 18, 2024
cc2f9b7
Use latest .NET 6.0 SDK patch version and update devcontainer to use …
bergmeister Jan 18, 2024
1e79ca3
Bump Microsoft.Management.Infrastructure from 1.0.0 to 3.0.0 for Powe…
dependabot[bot] Jan 18, 2024
5c32f55
Add common parameter ProgressAction (added in PS 7.4) to help test ex…
bergmeister Feb 1, 2024
df3551e
AvoidUsingPositionalParameter: Check if command has parameters to avo…
bergmeister Feb 13, 2024
9d57bad
Bump version from 1.21.0 to 1.22.0 (#1965)
bergmeister Feb 13, 2024
f15cdbf
Remove Appveyor badge (#1962)
bergmeister Feb 13, 2024
6cb66c1
Do not hard code common parameters in module help test any more (#1963)
bergmeister Feb 13, 2024
c06e005
PSReviewUnusedParameter: Add CommandsToTraverse option (#1921)
FriedrichWeinmann Feb 13, 2024
c085ee3
Add AvoidUsingAllowUnencryptedAuthentication (#1857)
MJVL Feb 13, 2024
b4365ad
Adding OneBranch pipeline YAML config file for OSS_Microsoft_PSSA-Off…
adityapatwardhan Mar 13, 2024
03b655c
Update format and grammar of AvoidUsingAllowUnencryptedAuthentication…
sdwheeler Mar 13, 2024
62a14c5
Move to OneBranch Signing and SBOM generation (#1982)
TravisEz13 Mar 14, 2024
a0365a5
Sync rule docs changes (#1985)
sdwheeler Mar 26, 2024
a754b95
Sync docs changes from MicrosoftDocs/PowerShell-Docs-Modules#213 (#1987)
sdwheeler Mar 27, 2024
e1dc126
Update CHANGELOG for 1.22.0 release (#1990)
sdwheeler Apr 25, 2024
ae898e7
Update Code of Conduct and Security Policy (#2002)
andyleejordan Jun 12, 2024
b5fec0a
Update default type definition of [Microsoft.Windows.PowerShell.Scrip…
liamjpeters Jul 16, 2024
d1a1bcb
PSUseConsistentWhitespace: Handle redirect operators which are not in…
liamjpeters Jul 16, 2024
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
Prev Previous commit
Next Next commit
Add ErrorView to SpecialVars.cs (PowerShell#1865)
* add ErrorView to SpecialVars and create test

* Changed type of ErrorView
  • Loading branch information
ewisniew0 authored Sep 17, 2023
commit af02e801de8d4700e0f9c9aea08e1ce8d22a2443
5 changes: 4 additions & 1 deletion Engine/SpecialVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ static SpecialVars()
internal const string ConfirmPreference = "ConfirmPreference";
internal const string ProgressPreference = "ProgressPreference";
internal const string InformationPreference = "InformationPreference";
internal const string ErrorView = "ErrorView";

internal static readonly string[] PreferenceVariables = new string[]
{
Expand All @@ -101,7 +102,8 @@ static SpecialVars()
WarningPreference,
ConfirmPreference,
ProgressPreference,
InformationPreference
InformationPreference,
ErrorView
};

internal static readonly Type[] PreferenceVariableTypes = new Type[]
Expand All @@ -114,6 +116,7 @@ static SpecialVars()
/* ConfirmPreference */ typeof(ConfirmImpact),
/* ProgressPreference */ typeof(Enum),
/* InformationPreference */ typeof(ActionPreference),
/* ErrorView */ typeof(Enum), //ErrorView type not available on PS3
};

internal enum AutomaticVariable
Expand Down
5 changes: 5 additions & 0 deletions Tests/Rules/UseDeclaredVarsMoreThanAssignments.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ function MyFunc2() {
}

Context "When there are no violations" {
It "No warning is issued for assignment without use of preference variable ErrorView" {
$results = Invoke-ScriptAnalyzer -ScriptDefinition '$ErrorView = NormalView'
$results.Count | Should -Be 0
}

It "returns no violations" {
$noViolations.Count | Should -Be 0
}
Expand Down