Releases: PowerShell/PSScriptAnalyzer
Release list
1.25.0
What's Changed
- Add configuration instructions for UseCorrectCasing (again) by Sean Wheeler (@sdwheeler) in #2090
- Fix for PSUseConsistantWhiteSpace when using statement is present by AlexandraDorey-Magnet (@AlexandraDorey) in #2091
- Exclude PSNativeCommandArgumentPassing variable by Christoph Bergmeister (@bergmeister) in #2093
- Update version check in PSScriptAnalyzer.psm1 to align with SMA version for PowerShell 7 by Christoph Bergmeister (@bergmeister) in #2107
- Change CommandInfo lookup for commands in the form
module\cmdletNameby Liam Peters (@liamjpeters) in #2125 - PSAvoidDefaultValueForMandatoryParameter: Fix param block and parameter set handling by Liam Peters (@liamjpeters) in #2121
- Add AvoidReservedWordsAsFunctionNames Rule by Liam Peters (@liamjpeters) in #2128
- Update .NET SDK, PowerShell SDK, Newtonsoft.Json and codeowners by Andy Jordan (@andyleejordan) in #2143
- Preserve braced member access in
UseConsistentWhitespaceby Liam Peters (@liamjpeters) in #2140 - Update docs and diagnostic message for UseCorrectCasing by Liam Peters (@liamjpeters) in #2138
- Fix SuppressMessage CustomRule by Gilbert Sanchez (@HeyItsGilbert) in #2142
- Sync rules docs from docs repo by Sean Wheeler (@sdwheeler) in #2144
- Allow contributors to run CI manually by Christoph Bergmeister (@bergmeister) in #2153
- Remove Conditional Compilation and Runtime Checks for v3 or v4 by Liam Peters (@liamjpeters) in #2150
- Add UseConsistentParametersKind rule by Denis Melnikov (@Haimasker) in #2149
- Fix typos in resource strings and associated C# references by Henrique Azevedo (@casuffitsharp) in #2163
- Optimise LINQ queries by Christoph Bergmeister (@bergmeister) in #2160
- AlignAssignmentStatement overhaul to fix issues and include handing of Enums. by Liam Peters (@liamjpeters) in #2132
- Dynamically count expected rules in GetScriptAnalyzerRule test by Andy Jordan (@andyleejordan) in #2167
- Add UseConsistentParameterSetName Rule by Liam Peters (@liamjpeters) in #2124
- feat(tests): added closing bracket test for formatting presets by Olav Rønnestad Birkeland (@o-l-a-v) in #2161
- Add UseSingleValueFromPipelineParameter Rule by Liam Peters (@liamjpeters) in #2119
- Added user-friendly installation instructions by Adam Erickson (@admercs) in #2141
- Update .NET SDK, PowerShell SDK dependencies by @Copilot in #2168
- Add Optional PSUseConstrainedLanguageMode rule by Josh Corrick (@joshcorr) in #2165
- v1.25.0: Thanks to all the new contributors! by Andy Jordan (@andyleejordan) in #2169
New Contributors
- AlexandraDorey-Magnet (@AlexandraDorey) made their first contribution in #2091
- Gilbert Sanchez (@HeyItsGilbert) made their first contribution in #2142
- Denis Melnikov (@Haimasker) made their first contribution in #2149
- Henrique Azevedo (@casuffitsharp) made their first contribution in #2163
- Olav Rønnestad Birkeland (@o-l-a-v) made their first contribution in #2161
- Adam Erickson (@admercs) made their first contribution in #2141
- @Copilot made their first contribution in #2168
- Josh Corrick (@joshcorr) made their first contribution in #2165
Full Changelog: 1.24.0...1.25.0
1.24.0
What's Changed
Breaking Changes
Minimum required PowerShell version raised from 3 to 5.1
- Drop v3 and v4 support from build by Andy Jordan (@andyleejordan) in #2081
New Features
- Add new options (enabled by default) to formatting rule
UseCorrectCasingto also correct operators, keywords and commands - Add UseConsistentCasing by Joel Bennett (@Jaykul) in #1704
Enhancements
- PSAlignAssignmentStatement: Ignore hashtables with a single key-value pair by Liam Peters (@liamjpeters) in #1986
- Use
RequiredResourcehashtable to specify PowerShell module versions by Andy Jordan (@andyleejordan) in #2053 - Set exit code of
Invoke-ScriptAnalyzer -EnableExitto total number of diagnostics (#2054) by Matěj Kafka (@MatejKafka) in #2055 - PSAvoidAssignmentToAutomaticVariable: Ignore when a Parameter has an Attribute that contains a Variable expression by Liam Peters (@liamjpeters) in #1988
- Trim unnecessary trailing spaces from string resources in Strings.resx by Xavier Plantefève (@XPlantefeve) in #1972
- Do not print summary repeatedly for each logger by Matěj Kafka (@MatejKafka) in #2058
- Make Settings type detection more robust by Tadas Medišauskas (@Tadas) in #1967
- Add foreach Assignment to AvoidAssignmentToAutomaticVariable by AJ Raymond (@poshAJ) in #2021
- Invoke-ScriptAnalyzer: Stream diagnostics instead of batching by Matěj Kafka (@MatejKafka) in #2062
- Invoke-ScriptAnalyzer: Print summary only once per invocation by Matěj Kafka (@MatejKafka) in #2063
- Invoke-ScriptAnalyzer: Include parse errors in reported error count by Matěj Kafka (@MatejKafka) in #2069
- Add exception message for missing rules by Tadas Medišauskas (@Tadas) in #1968
Bug Fixes
- Update links in module manifest by Martin Costello (@martincostello) in #2034
- Fix incorrect
-ReportSummaryPester test grouping by Matěj Kafka (@MatejKafka) in #2057 - Fixed erroneous PSUseDeclaredVarsMoreThanAssignments for some globals variables by John Douglas Leitch (@John-Leitch) in #2013
- PSReservedParams: Make severity Error instead of Warning by Liam Peters (@liamjpeters) in #1989
- PSUseConsistentIndentation: Check indentation of lines where first token is a LParen not followed by comment or new line by Liam Peters (@liamjpeters) in #1995
- PSUseConsistentWhitespace: Correctly fix whitespace between command parameters when parameter value spans multiple lines by Liam Peters (@liamjpeters) in #2064
- PSAvoidTrailingWhitespace: Rule not applied when using formatter + single character lines with trailing whitespace are truncated by Liam Peters (@liamjpeters) in #1993
- PSUseConsistentWhitespace: Ignore whitespace between separator and comment by Liam Peters (@liamjpeters) in #2065
- PSReviewUnusedParameter false positive for ValueFromPipeline by Liam Peters (@liamjpeters) in #2072
- Change severity of UseCorrectCasing to be Information by Christoph Bergmeister (@bergmeister) in #2082
Process Changes
- Copy more files to module root by Andy Jordan (@andyleejordan) in #2037
- Upgrade to .NET 8 since .NET 6 is past EOL by Andy Jordan (@andyleejordan) in #2073
- Use -NoProfile when invoking pwsh in Pester tests by Matěj Kafka (@MatejKafka) in #2061
- Add GitHub Actions Ubuntu's dotnet path by Andy Jordan (@andyleejordan) in #2080
- Update README.md with recent upgrade to .NET 8 by Christoph Bergmeister (@bergmeister) in #2076
- Update CHANGELOG.MD with 1.23.0 release notes by Christoph Bergmeister (@bergmeister) in #2078
- Bring back Codespaces by Christoph Bergmeister (@bergmeister) in #2077
- Update SMA version to 7.4.7 by Christoph Bergmeister (@bergmeister) in #2075
- Test PowerShell Preview in CI by Andy Jordan (@andyleejordan) in #2070
- Backport MSDocs changes by Christoph Bergmeister (@bergmeister) in #2085
- Document new optional parameters added to UseCorrectCasing by Christoph Bergmeister (@bergmeister) in #2086
New Contributors
- Martin Costello (@martincostello) made their first contribution in #2034
- Matěj Kafka (@MatejKafka) made their first contribution in #2055
- Xavier Plantefève (@XPlantefeve) made their first contribution in #1972
- John Douglas Leitch (@John-Leitch) made their first contribution in #2013
- Tadas Medišauskas (@Tadas) made their first contribution in #1967
- AJ Raymond (@poshAJ) made their first contribution in #2021
- Joel Bennett (@Jaykul) made their first contribution in #1704
Full Changelog: 1.23.0...1.24.0
1.23.0
What's Changed
- Adding OneBranch pipeline YAML config file for OSS_Microsoft_PSSA-Official by Aditya Patwardhan (@adityapatwardhan) in #1981
- Update format and grammar of AvoidUsingAllowUnencryptedAuthentication by Sean Wheeler (@sdwheeler) in #1974
- Move to OneBranch Signing and SBOM generation by Travis Plunk (@TravisEz13) in #1982
- Sync rule docs changes by Sean Wheeler (@sdwheeler) in #1985
- Sync docs changes from MicrosoftDocs/PowerShell-Docs-Modules#213 by Sean Wheeler (@sdwheeler) in #1987
- Update CHANGELOG for 1.22.0 release by Sean Wheeler (@sdwheeler) in #1990
- Update Code of Conduct by Andy Jordan (@andyleejordan) in #2002
- Update default type definition of
RuleInfoby Liam Peters (@liamjpeters) in #2011 - PSUseConsistentWhitespace: Handle redirect operators which are not in stream order by Liam Peters (@liamjpeters) in #2001
- Setup GitHub Actions CI by Andy Jordan (@andyleejordan) in #2018
- Setup new OneBranch pipeline by Andy Jordan (@andyleejordan) in #2027
- Bump SMA version by Andy Jordan (@andyleejordan) in #2028
- Package updates by Andy Jordan (@andyleejordan) in #2030
- v1.23.0: Update version for new release by Andy Jordan (@andyleejordan) in #2032
- Migrate release pipeline to DeployBox by Andy Jordan (@andyleejordan) in #2033
New Contributors
- Aditya Patwardhan (@adityapatwardhan) made their first contribution in #1981
Full Changelog: 1.22.0...1.23.0
PSScriptAnalyzer v1.22.0
Minimum required version when using PowerShell 7 is now 7.2.11.
New Rule
- Add AvoidUsingAllowUnencryptedAuthentication by Michael Van Leeuwen (@MJVL) in #1857
- Add the AvoidExclaimOperator rule to warn about the use of the ! negation operator. Fixes #1826 by Liam Peters (@liamjpeters) in #1922
Enhancements
- Enable suppression of PSAvoidAssignmentToAutomaticVariable for specific variable or parameter by Frode Flaten (@fflaten) in #1896
- Upgrade to use .NET 6 since PowerShell 7.0 is now out out of support by Christoph Bergmeister (@bergmeister) in #1873
- Convert UseSingularNouns to configurable rule and add Windows to allowlist by Michael Van Leeuwen (@MJVL) in #1858
- Add ErrorView to SpecialVars.cs by ewisniew0 in #1865
- Allow suppression of PSUseSingularNouns for specific function by Frode Flaten (@fflaten) in #1903
- Adding ToString() methods to [CorrectionExtent] and [DiagnosticRecord] by James Brundage (@StartAutomating) in #1946
- Add PSNativeCommandUseErrorActionPreference preference variable by Eli Arbel (@aelij) in #1954
- AvoidUsingPositionalParameter: Check if command has parameters to avoid having az in default CommandAllowList by Christoph Bergmeister (@bergmeister) in #1850
- PSReviewUnusedParameter: Add CommandsToTraverse option by Friedrich Weinmann (@FriedrichWeinmann) in #1921
Fixes
- Prevent NullReferenceException for null analysis type. by Hubert Bukowski (@hubuk) in #1949
Build & Test, Documentation and Maintenance
- UseApprovedVerbs.md: Backport minor change of PR 104 in PowerShell-Docs-Modules by Christoph Bergmeister (@bergmeister) in #1849
- Improve Pester bootstrap logic for CI by Christoph Bergmeister (@bergmeister) in #1853
- Bump .NET SDK from 3.1.419 to 3.1.424 by Christoph Bergmeister (@bergmeister) in #1852
- AvoidLongLines: Make internal function DiagnosticSeverity private by Christoph Bergmeister (@bergmeister) in #1851
- SupportsShouldProcess.md: Fix Typo - MicrosoftDocs backport of PR 121 there by Sean Wheeler (@sdwheeler) in #1869
- Minor test fix for UseCorrectCasing rule by Ryan Yates (@kilasuit) in #1885
- Make Invoke-Formatter test case assertion fail in case of incorrect casing by Oleksandr Redko (@alexandear) in #1888
- Fix
AvoidUsingDoubleQuotesForConstantStringinformation in overview README by Mikey Lombardi (He/Him) (@michaeltlombardi) in #1883 - Update dependabot reviewers to remove Rob by Frode Flaten (@fflaten) in #1897
- Fix typo in AvoidUsingPlainTextForPassword error message: 'to' being repeated two times by ALi.w (@ALiwoto) in #1902
- CI: Use new Ubuntu 22.04 image and remove deprecated Ubuntu 18.04 by Christoph Bergmeister (@bergmeister) in #1847
- Change double quotes to single where possible by Sean Wheeler (@sdwheeler) in #1911
- Backport MicrosoftDocs PR 143 by Sean Wheeler (@sdwheeler) in #1910
- Fix typos in rules documentation by Sean Wheeler (@sdwheeler) in #1913
- add demand for compliance job by Travis Plunk (@TravisEz13) in #1920
- FabricBot: Onboarding to GitOps.ResourceManagement because of FabricBot decommissioning by @microsoft-github-policy-service in #1925
- Sync changes from Docs repository by Sean Wheeler (@sdwheeler) in #1929
- Developer documentation fix and message fix of PossibleIncorrectUsageOfRedirectionOperatorDescription by Joel Tipke (@JoelTipke) in #1928
- Documentation corrections for AvoidUsingPositionalParameters by @ImportTaste in #1917
- Update minimum PowerShell Core version to 7.2.11 as 7.0 is now EOL by Christoph Bergmeister (@bergmeister) in #1872
- Remove dead code and simplify by Christoph Bergmeister (@bergmeister) in #1856
- PSReservedParams - link about_CommonParameters by Peter Vandivier (@petervandivier) in #1908
- Generate strongly typed resources as part of build by Christoph Bergmeister (@bergmeister) in #1855
- Bump Newtonsoft.Json to 13.0.3 by Dependabot (@dependabot) in #1866
- Use latest .NET 6.0 SDK patch version and update devcontainer to use .NET 6 as well by Christoph Bergmeister (@bergmeister) in #1955
- Bump Microsoft.Management.Infrastructure from 1.0.0 to 3.0.0 for PowerShell 7 only by Dependabot (@dependabot) in #1947
- Bump version from 1.21.0 to 1.22.0 by Christoph Bergmeister (@bergmeister) in #1965
- Remove Appveyor badge from main README by Christoph Bergmeister (@bergmeister) in #1962
- Do not hard code common parameters in module help test any more by Christoph Bergmeister (@bergmeister) in #1963
New Contributors
- Frode Flaten (@fflaten) made their first contribution in #1897
- ALi.w (@ALiwoto) made their first contribution in #1902
- @microsoft-github-policy-service made their first contribution in #1925
- Joel Tipke (@JoelTipke) made their first contribution in #1928
- @ImportTaste made their first contribution in #1917
- Liam Peters (@liamjpeters) made their first contribution in #1922
- Peter Vandivier (@petervandivier) made their first contribution in #1908
- ewisniew0 made their first contribution in #1865
- James Brundage (@StartAutomating) made their first contribution in #1946
- Eli Arbel (@aelij) made their first contribution in #1954
- Friedrich Weinmann (@FriedrichWeinmann) made their first contribution in #1921
Full Changelog: 1.21.0...1.22.0
PSScriptAnalyzer v1.21.0
1.21.0 - 2022-09-14
New Rule
- Add AvoidMultipleTypeAttributes rule (#1705) (thanks hankyi95)
- Add the AvoidSemicolonsAsLineTerminators rule to warn about lines ending with a semicolon. Fix (#824) (#1806) (thanks Aliaksei (@tempora-mutantur))
- Add AvoidUsingBrokenHashAlgorithms (#1787) (thanks Michael Van Leeuwen (@MJVL))
Enhancements
- Also return suggestion to use PSCredential for AvoidUsingPlainTextForPassword rule (#1782) (by Christoph Bergmeister (@bergmeister))
- Invoke-Formatter: Accept input from pipeline (#1763) (by Christoph Bergmeister (@bergmeister))
- PSAvoidUsingPositionalParameters: Do not warn on AZ CLI (#1846) (by Christoph Bergmeister (@bergmeister))
- PSAvoidUsingPositionalParameters: Do not warn on AZ CLI (#1846) (by Christoph Bergmeister (@bergmeister))
Fixes
- Fix PSUseConsistentIndentation.PipelineIndentation.None to not remove code when the previous line ended with a pipe (#1746) (by Christoph Bergmeister (@bergmeister))
- Skip OpenBrace check when preceded by Dot token (#1750) (by Christoph Bergmeister (@bergmeister))
- Fix NRE (NullReferenceException) when custom rules omit optional properties in diagnostics (#1715) (by Rob Holt (@rjmholt))
Build, Documentation and Maintenance
- Tweak documentation for AvoidUsingBrokenHashAlgorithms (#1829) (thanks Mikey Lombardi (He/Him) (@michaeltlombardi))
- Set MaxDepth in JsonSerializerSettings for more secure handling of exceptional conditions in Newtonsoft.Json (#1824) (by Christoph Bergmeister (@bergmeister))
- Use latest Newtonsoft.Json version for Windows PowerShell builds and not exclude it any more in Dependabot (#1825) (by Christoph Bergmeister (@bergmeister))
- Correct pipeline acceptance docs for Invoke-Formatter.md (#1833) (by Christoph Bergmeister (@bergmeister))
- Sync remaining docs changes from Microsoft docs (#1835) (by Christoph Bergmeister (@bergmeister))
- Reformat note block (#1837) (by Sean Wheeler (@sdwheeler))
- Update AvoidMultipleTypeAttributes.md with example that has runtime error (#1831) (by Christoph Bergmeister (@bergmeister))
- Fix minimum PowerShell version to be 7.0.11 instead of 7.1.7 (#1830) (by Christoph Bergmeister (@bergmeister))
- Add
.github/fabricbot.json(#1812) - Sync changes from docs repo (#1814) (by Sean Wheeler (@sdwheeler))
- Fix name of PowerShell 5.1 test stage in CI (#1820) (by Christoph Bergmeister (@bergmeister))
- CI: Retry test tasks in cas1e of failure to reduce sporadic failures (#1770)
- Upgrade from net452 to net462 for Windows PowerShell (#1789)
- Move issue template config into folder (#1804) (thanks Mikey Lombardi (He/Him) (@michaeltlombardi))
- Bump version from 1.20.0 to 1.21.0 (#1796) (by Christoph Bergmeister (@bergmeister))
- Bump .NET SDK and SMA patch version (#1795) (by Christoph Bergmeister (@bergmeister))
- Be sure not to clobber existing files when installing dotnet. (#1788) (by James Truher (@JamesWTruher))
- Add link to issues chooser for reporting docs issues (#1794) (by Sean Wheeler (@sdwheeler))
- Update README and delete docs that were migrated (#1790) (by Sean Wheeler (@sdwheeler))
- Fix errors in ShouldProcess rule document (#1766) (thanks Masaru Iritani (@masaru-iritani))
- Replicate changes from docs repo (#1781) (by Sean Wheeler (@sdwheeler))
- Update Windows CI images as windows-2016 has been deprecated (#1784) (by Christoph Bergmeister (@bergmeister))
- Use latest mac image rather than a specific version. (#1777) (by James Truher (@JamesWTruher))
- Add docs migration notice & fix formatting (#1779) (by Sean Wheeler (@sdwheeler))
- use compliant build environment for release build. (#1776) (by James Truher (@JamesWTruher))
- Enable SBOM creation for script analyzer (#1762) (by James Truher (@JamesWTruher))
- Fix links to work on GitHub (#1738) (by Andy Jordan (@andschwa))
- Update AvoidUsingWMICmdlet.md (#1737) (thanks Cosmin (@C0smin))
- Fix broken doc link in README (#1735) (thanks Andrew Rathbun (@AndrewRathbun))
- Add metadata to docs (#1731) (by Sean Wheeler (@sdwheeler))
- Remove Ubuntu 16.04 from test matrix (#1733) (by Rob Holt (@rjmholt))
- Use PowerShell1ES pool for official build (#1719) (by James Truher (@JamesWTruher))
- Update cmdlet docs for 1.20.0 (#1726) (by Sean Wheeler (@sdwheeler))
- Fixes #1720 - move rule docs and update tests (#1724) (by Sean Wheeler (@sdwheeler))
- Update rule docs (#1711) (by Sean Wheeler (@sdwheeler))
PSScriptAnalyzer v1.20.0
1.20.0 - 2021-08-20
Fixes
- Replace unhelpful warning around
processaliasingGet-Processwith warning about misused syntax (#1638) (by Christoph Bergmeister (@bergmeister)) - Fix
FunctionInfofallback AST attribute analysis for UseShouldProcessCorrectly (#1659) (thanks Hubert Bukowski (@hubuk)) - Do not increase indentation after a left parenthesis if the previous token is a newline and the next token is not a newline (#1469) (by Christoph Bergmeister (@bergmeister))
- UseConsistentWhitespace - CheckOpenBrace setting: Do not warn when being preceded by open parenthesis (#1633) (by Christoph Bergmeister (@bergmeister))
New Rule
- Make UseSingularNouns rule work in PowerShell 7 (#1627) (by Christoph Bergmeister (@bergmeister))
- UseConsistentWhitespace: Create option to ignore assignment operator inside hashtable (#1566) (thanks Joel Davies (@daviesj))
Miscellaneous
- Implement -IncludeSuppressions parameter (#1701) (by Rob Holt (@rjmholt))
- Combine multiple suppressions applied to the same diagnostic (#1699) (by Rob Holt (@rjmholt))
- Use dependabot to keep dependencies up to date (#1664) (by Rob Holt (@rjmholt))
- Add reviewers and explicit dependency exclusions to dependabot (#1676) (by Rob Holt (@rjmholt))
- Remove explicit registries in dependabot (#1671) (by Rob Holt (@rjmholt))
Documentation
- Link to PSScriptAnalyzer rule documentation from the README (#1642) (thanks Ben Bodenmiller (@bbodenmiller))
- Add HelpInfoUri to module manifest (#1651) (by Sean Wheeler (@sdwheeler))
- Add documentation around CustomRulePath in Settings file to README.md (#1636) (thanks Johan Ljunggren (@johlju))
- Use allowlist and blocklist terminology, supply alternate configuration key for PSAvoidUsingCmdletAliases (#1604) (by Christoph Bergmeister (@bergmeister))
- Fix suppression example errors in README (#1593) (by Rob Holt (@rjmholt))
- Fix AvoidLongLines documentation example (#1554) (thanks Florian Heberl (@floh96))
- Remove broken waffle.io links from readme.md (#1558) (thanks Coby Caldwell (@clcaldwell))
- Fix typo in AvoidUsingCmdletAliases documentation (#1590) (thanks Ruben Gonzalez (@rubengonzalez-dev))
Testing
- Fix compatibility rule tests (#1697) (by Rob Holt (@rjmholt))
- Fix missing space in AvoidPositionalParameter test asset (#1573) (by James Truher (@JamesWTruher))
Development/Build Improvements
- Fix build module tests (#1654) (thanks Coby Caldwell (@clcaldwell))
- Move to new signing process for release build and prep for 1.20.0 (#1625) (by James Truher (@JamesWTruher))
- Handle cases where the signature generator fails (#1661) (by James Truher (@JamesWTruher))
- Update .NET SDK to 3.1.408 (#1630) (by Christoph Bergmeister (@bergmeister))
- Simplify devcontainer setup and resolve git line ending conflicts (#1637) (by Christoph Bergmeister (@bergmeister))
- Speedup CI by bootstrapping PowerShell module installations in background and in parallel, whilst the .NET SDK is being installed (#1634) (by Christoph Bergmeister (@bergmeister))
- Upgrade release Dockerfile from Ubuntu 16.04 to 20.04 (#1631) (by Christoph Bergmeister (@bergmeister))
- Remove old powershell-core NuGet feed, which sometimes causes build failures (#1632) (by Christoph Bergmeister (@bergmeister))
- Remove reference to myget.org as a package resource (#1640) (by James Truher (@JamesWTruher))
- Add Ubuntu 20.04 to build matrix (#1628) (by Christoph Bergmeister (@bergmeister))
- Remove conditional compilation for PSv6/netstandard2.0 for Engine and Rules projects (#1600) (by Christoph Bergmeister (@bergmeister))
- Upgrade Microsoft.CSharp, Microsoft.Win32.Registry and System.Reflection.TypeExtensions from 4.5.0 to 4.7.0 (#1599) (by Christoph Bergmeister (@bergmeister))
- Use PowerShell preview extension for Github Codespaces (#1596) (by Christoph Bergmeister (@bergmeister))
- Update SMA reference for netcoreapp3.1 to from 7.0.0 to 7.0.3 (#1597) (by Christoph Bergmeister (@bergmeister))
- 🧹 Make usage of Microsoft.Management.Infrastructure consistent and reference it only once in CrossCompatibility project (#1601) (by Christoph Bergmeister (@bergmeister))
- Update launch.json (#1603) (by Christoph Bergmeister (@bergmeister))
- Make CI fail if tests fail and fix failing tests by making them Pester v5 compatible (#1553) (coauthored by Christoph Bergmeister (@bergmeister))
PSScriptAnalyzer v1.19.1
Fixes
UseCorrectCasing: Do not use CommandInfoCache when CommandInfoParameters property throws due to runspace affinity problem of PowerShell engine (#1523) (by Christoph Bergmeister (@bergmeister))ReviewUnusedParameter: Do not trigger when MyInvocation.BoundParameters or PSCmdlet.MyInvocation.BoundParameters is used (#1520) (Thanks Manigandan Jegannathan (@jegannathanmaniganadan)!)PipelineIndentationStyle.None: Fix bug that caused incorrect formatting in hashtables (#1497) (by Christoph Bergmeister (@bergmeister))UseUsingScopeModifierInNewRunspaces: Fix ArgumentException when the same variable name is used in 2 different sessions. (#1493) (by Christoph Bergmeister (@bergmeister))UseConsistentWhitespace- Check previous token only if it starts on the same line (#1491) (by Christoph Bergmeister (@bergmeister))
- Fix CheckParameter bug when using interpolated string (#1498) (by Christoph Bergmeister (@bergmeister))
New Rule
- New rule (disabled by default): AvoidUsingDoubleQuotesForConstantString (#1470) (by Christoph Bergmeister (@bergmeister))
Miscellaneous
- Set Assembly version attribute (#1549) (by James Truher (@JamesWTruher))
Documentation
- Remove references to Windows in Introduction of Readme.md (#1509) (Thanks Frederik Hjorslev (@hjorslev)!)
Testing
- Pester v5 (#1444) (by Christoph Bergmeister (@bergmeister))
Development improvements
- Include PDB files in Debug build (#1535) (by Christoph Bergmeister (@bergmeister))
- Add more useful launch configurations (#1499) (by Christoph Bergmeister (@bergmeister))
- Make .Net Core version in Docker image of .devcontainer match the one in global.json (#1494) (by Christoph Bergmeister (@bergmeister))
PSScriptAnalyzer v1.19.0
New Rules
- UseUsingScopeModifierInNewRunspaces (#1419) (thanks Jos Koelewijn (@Jawz84)!)
- ReviewUnusedParameter (#1382) (thanks Matt McNabb (@mattmcnabb)!)
- AvoidOverwritingBuiltInCmdlets (#1348) (thanks Thomas Rayner (@thomasrayner)!)
- UseProcessBlockForPipelineCommand (#1373) (thanks Matt McNabb (@mattmcnabb)!)
- AvoidLongLines (#1329) (thanks Thomas Rayner (@thomasrayner)!)
Rule Enhancements
- Add more automatic variables to PSAvoidAssignmentToAutomaticVariables that are not read-only but should still not be assigned to in most cases (#1394) (by Christoph Bergmeister (@bergmeister))
Compatibility Rules
- Make CompatibilityCollector able to parse a single version String #1446 (by Christoph Bergmeister (@bergmeister))
- Update compatibility profiles for PowerShell 7 (#1429) (by Rob Holt (@rjmholt))
- Ps7 syntax (#1426) (by Rob Holt (@rjmholt))
- Fix ps3 syntax check (#1395) (by Rob Holt (@rjmholt))
- Add PS 7 to UseCompatibleSyntax (#1331) (by Rob Holt (@rjmholt))
- Fix UseCompatibleSyntax configuration doc (e37daeb) (by Rob Holt (@rjmholt))
- Update UseCompatibleTypes docs with more info (42f5e58) (by Rob Holt (@rjmholt))
- UseCompatibleCommands doc improvements (7874b55) (by Rob Holt (@rjmholt))
- Update AzF profile to be useful (#1341) (by Rob Holt (@rjmholt))
Formatter
- UseCorrectCasing
- Correct casing of parameters as well in PSUseCorrectCasing formatter rule (#1391) (by Christoph Bergmeister (@bergmeister))
- Fix temporarily introduced bug (PR #1391) for UseCorrectCasing (#1408) (by Christoph Bergmeister (@bergmeister))
- UseConsistentIndentation
- When non-default options are used, cater for the case of a comment between pipe and newline (#1463)
- Add PipelineIndentationStyle.None option for scenarios where indentation is custom, inconsistent or the user does not like any of the 3 pipeline indentation styles (#1399) (by Christoph Bergmeister (@bergmeister))
- Fix complex case when PipelineIndentation is not set to default (NoIndentation) (#1359) (by Christoph Bergmeister (@bergmeister))
- UseConsistentWhitespace
- Split CheckPipe feature of trimming redundant whitespace out into option CheckPipeForRedundantWhiteSpace (#1413) (by Christoph Bergmeister (@bergmeister))
- Set default of CheckParameter configuration setting to false to ensure that setting won't be enabled by default if an old version of the VS-Code extension uses a new version of - PSScriptAnalyzer (1.19) (#1411) (by Christoph Bergmeister (@bergmeister))
- Remove redundant whitespace between parameters with new option (disabled by default) in UseConsistentWhitespace (#1392) (by Christoph Bergmeister (@bergmeister))
- Ignore empty hashtable for CheckInnerBrace configuration (#1349) (by Christoph Bergmeister (@bergmeister))
Performance
The Formatter can now be multiple times faster depending on the use case and especially scaling problems were addressed that showed when analyzing large scripts with thousands of lines (a 3000 line test script was used in the below performance figures). Optimisations were to
- Eliminate initialization overhead, which can lead to a reduced time of up to 50%
- Optimize operations in rules to make them scale better, another improvement of around 50%
- The formatter used to re-parse the script in between every rule run but this is skipped now if the previous rule did not emit a
DiagnosticRecordas it means the script text hasn't changed and doesn't need updating. Therefore formatting will be faster on scripts that need no to little changes.
A small improvement was made to a script analysis rule as well but the gain is offset by the addition of the new rules in this release.
The PRs for those improvements are:
- Eliminate Regex overhead in AvoidTrailingWhitespace -> Speedup of 5% (PowerShell 5.1) or 2.5 % (PowerShell 7.1-preview.2) (#1465) (by Christoph Bergmeister (@bergmeister))
- Formatter: Recycle parsed AST and tokens in between rule invocations when no correction was applied to improve performance (#1462) (by Christoph Bergmeister (@bergmeister))
- Improve performance of UseConsistentIndentation even more > another 10% speedup for formatter (#1461) (by Christoph Bergmeister (@bergmeister))
- Improve performance of UseConsistentIndentation -> 35% speedup for formatter (#1458) (by Christoph Bergmeister (@bergmeister))
- Lazy initialisation of LinkedList in TokenOperations constructor -> 7% performance gain for formatter (#1453) (by Christoph Bergmeister (@bergmeister))
- Invoke-Formatter: Skip VariableAnalysis, which is not needed to yield a 50% performance improvement (#1451) (by Christoph Bergmeister (@bergmeister))
Fixes
- Fix edge case of PSUseConsistentIndentation for non-default value (IncreaseIndentationForFirstPipeline/IncreaseIndentationAfterEveryPipeline) (#1423) (by Christoph Bergmeister (@bergmeister))
- Fix rule suppression ID in compat rules (#1432) (by Rob Holt (@rjmholt))
- Changes to build analyzer for PS7 and PS6 and ship in separate directories and bump version to 1.19.0 (#1425) (by James Truher (@JamesWTruher))
- Use AST to determine SupportsShouldProcess when an error is thrown (#1397) (by Rob Holt (@rjmholt))
- Fix false positive of AvoidAlias rule for implicit aliasing of Get- commands for the CommandType ExternalScript (#1386) (by Christoph Bergmeister (@bergmeister))
Build/Tests/Maintenance
- Changelog for 1.19.0 (#1448) (by Christoph Bergmeister (@bergmeister))
- Use separate test.yaml files files since param passing of pwsh still doesn't seem to fully work correctly #1466 (by Christoph Bergmeister (@bergmeister))
- New build scripts for release pipeline (#1442) (by James Truher (@JamesWTruher))
- Make sure that tests always get uploaded, due to too much YAML indentation, condition was not applied (#1455) (by Christoph Bergmeister (@bergmeister))
- Cleanup csproj files: Remove code duplication for Configuration and entries in Rules project, since it depends on Engine project (#1450) (by Christoph Bergmeister (@bergmeister))
- Build: Use logging command as a temporary workaround due to billing bug preventing upload of pipeline artefacts (#1464) (by Christoph Bergmeister (@bergmeister))
- Use bracket syntax for passing yaml parameter (#1449) (by Christoph Bergmeister (@bergmeister))
- Update Newtonsoft.Json from 12.0.2 to 12.0.3 in Compatibility project as well (#1447) (by Christoph Bergmeister (@bergmeister))
- Replace usage of $MyInvocation.MyCommand.Path with $PSScriptRoot and cleanup tests as a preparation for Pester v5 (#1438) (by Christoph Bergmeister (@bergmeister))
- Compatibility tests: Use correct genericVerCases test case and remove invalid test case (#1440) (by Christoph Bergmeister (@bergmeister))
- Add out folder to .gitignore (#1443) (by Christoph Bergmeister (@bergmeister))
- Pin major version of Pester to 4 and upgrade Pester version for WMF4 build (#1433) (by Christoph Bergmeister (@bergmeister))
- ms-vscode.csharp to ms-dotnettools.csharp (#1424) (thanks Mattias Karlsson (@devlead)!)
- Upgrade .net sdk to latest path (#1421) (by Christoph Bergmeister (@bergmeister))
- Fix #1417 modulehelp false positives (#1418) (thanks Jos Koelewijn (@Jawz84)!)
- Increase macOs CI coverage to include both 10.14 and 10.15 as 10.15 has recently been added to Azure DevOps hosted agents (#1412) (by Christoph Bergmeister (@bergmeister))
- Fix vmImage entries in build to match description (#1409) (by Christoph Bergmeister (@bergmeister))
- Update .Net Core SDK from 3.1.100 to latest patch 3.1.101 (#1405) (by Christoph Bergmeister (@bergmeister))
- Multi-stage pipelines (to split build->test) (#1404) (by Christoph Bergmeister (@bergmeister))
- Use vmImage in yaml and merge build definitions into 1 by using jobs. Disable all AppVeyor images except for WMF4. Disable flaky UseCompatibleCommand tests on Ubuntu in CI (#1403) (by Christoph Bergmeister (@bergmeister))
- Azure pipelines migration (#1267) (by Christoph Bergmeister (@bergmeister))
- Add DevContainer support (#1286) (by Christoph Bergmeister (@bergmeister))
- Increase maximum runspace pool size in flaky test (#1358) (by Christoph Bergmeister (@bergmeister))
- Use latest version of PlatyPS in AppVeyor (#1390) (by Christoph Bergmeister (@bergmeister))
- .Net core sdk 3.1 (#1388) (by Christoph Bergmeister (@bergmeister))
- Use Where-Object instead of alias in buildmodule.tests.ps1 (#1360) (thanks PRASOON KARUNAN V (@kvprasoon)!)
- Remove legacy methods (#1387) (by Christoph Bergmeister (@bergmeister))
- Upgrade .Net Core SDK version to a newer version that is also available in Visual Studio Online environment (#1377) (by Christoph Bergmeister (@bergmeister))
- Update Newtonsoft.Json from 12.0.1 to 12.02 (latest version), which increases the minimum PS Core version from 6.2.0 to 6.2.1 (#1357) (by Christoph Bergmeister (@bergmeister))
- Harden dotnet --version handling (#1367) (by James Truher (@JamesWTruher))
- Fix configuration for PS v5 and v6 builds to be Debug/Release as it used to be to allow for actual debug builds (#1356) (by Christoph Bergmeister (@bergmeister))
- Disable bad tests on Linux for now (#1365) (by Rob Holt (@rjmholt))
- Fix Ubuntu build and runspace test (#1340) (by Christoph Bergmeister (@bergmeister))
Documentation
- Update Readme with minimum PowerShell Core version being 6.2 (#1457) (by Christoph Bergmeister (@bergmeister))
- Change term to satisfy policheck requirements #1445 (by James Truher (@JamesWTruher))
- Update adopters file with entry for Microsoft internal teams (#1398) (thanks pperrier27!)
- Add ADOPTERS.md (#1380) (by Steve Lee (@SteveL-MSFT))
- Update SuppressMessageAttribute docs link and use single quotes for examples (#1389) (by Christoph Bergmeister (@bergmeister))
- Update ShouldProcess.md (#1383) (thanks Baard Hermansen (@baardhermansen)!)
- Fix typo in example (#1379) (thanks Farwaykorse!)
- Update Hyperlink for Approved Verbs (#1374) (thanks Chase Wright (@MysticRyuujin)!)
PSScriptAnalyzer v1.18.3
This release adds one more important fix, which prevents a leak of runspaces when repeatedly invoking the PSScriptAnalyzer cmdlets. Furthermore it ups the minimum version of PowerShell Core to 6.2.0 due to 6.1 reaching its end of life this month.
- Change CommandInfoCache to implement IDisposable and clean up the runspace pool (#1335) (by James Truher (@JamesWTruher))
- Update Newtonsoft json to 12.0.1 due to PowerShell 6.1 going out of support (#1336) (by Christoph Bergmeister (@bergmeister))
PSScriptAnalyzer v1.18.2
This release mainly brings fixes and enhancements that are especially useful when being consumed by PowerShellEditorServices.
The benefit to the user will be some enhancements and fixes in the formatter, especially around multiline commands. In addition to that, error messages emitted when using invalid syntax in the setting file are now much more meaningful and actionable.
Fixes
-
Compatibility Analysis
- Fix profile collection on non-Windows, add PS 7 profiles (#1260) (by Rob Holt (@rjmholt))
-
Formatter
- Fix PSCloseBrace rule to not wrongly flag closing brace of one-line hashtable, which lead to incorrect formatting (#1309) (by Christoph Bergmeister (@bergmeister))
- PipelineIndentationStyle (when not being set to NoIndentation)
- PipelineIndentationStyle: Fix edge case where pipeline was incorrectly detected to span multiple lines due to backticks in the command leading up to the pipeline (#1312) (by Christoph Bergmeister (@bergmeister))
- Fix edge case when PipelineIndentationStyle is not set to NoIndentation (pipeline operator spanning only one line but PipelineAst spanning multiple lines) (#1261) (by Christoph Bergmeister (@bergmeister))
- Allow formatter to optionally correct aliases (#1277) (by Christoph Bergmeister (@bergmeister))
-
Engine
- Work around runspacepool deadlock (#1316) (by Rob Holt (@rjmholt))
Enhancements
- Formatter
- Fix Indentation of multiline command with backticks after comment line (#1318) (by Christoph Bergmeister (@bergmeister))
- Code Analysis:
- Enhance UseDeclaredVarsMoreThanAssignments to detect also take into account the usage of Get-Variable with an array of variables and usage of named - parameter -Name (#1310) (by Christoph Bergmeister (@bergmeister))
- Settings files
- Actionable errors from incorrect settings files (#1263) (thanks travis-c-lagrone!)
- Update engine resource string 'WrongKeyHashTable' to include all valid settings hashtable keys (#1273) (thanks travis-c-lagrone!)
- Add icon and add reference in readme and manifest (#1291) (by Christoph Bergmeister (@bergmeister), thanks Adil Leghari (@adilio) for creating the logo!)
Documentation
- Update readme with changes to default branch being master now (#1265) (by Christoph Bergmeister (@bergmeister))
- UseApprovedVerbs.md: Improving Documentation (#1294) (Thanks Keith Banner (@Banner-Keith)!)
- Update documentation for parameter "Settings" of command "Invoke-ScriptAnalyzer" to include the key "RecurseCustomRulesPath" - (#1272) (thanks travis-c-lagrone!)
Build
- Don't sign the compatability collector catalog so that PSScriptAnalyzer can ship with a catalog file again (#1328) (by James Truher (@JamesWTruher))
- Fix Ubuntu Appveyor build (#1320) (by Christoph Bergmeister (@bergmeister), thanks James Truher (@JamesWTruher) for the initial investigation)