Skip to content

Commit 5e3fd00

Browse files
authored
Merge branch 'main' into sdw-w600137-refactor-script
2 parents 42cf350 + 8df439e commit 5e3fd00

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎ADOPTERS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Example entry:
1010

1111
This is a list of adopters of using PowerShell Script Analyzer in production or in their products (in alphabetical order):
1212

13+
* [MegaLinter](https://megalinter.io/), an open-source linter aggregator for CI, runs PSScriptAnalyzer out of the box to lint the PowerShell files of the repositories it analyzes
14+
(see the [PSScriptAnalyzer page](https://megalinter.io/latest/descriptors/powershell_powershell/) in its documentation).
1315
* Microsoft Windows Build: PSScriptAnalyzer is automatically run against PowerShell scripts when performing a build for Windows to maintain and improve the quality of code as it gets checked in.
1416
* [PowerShellEditorServices](https://github.com/powershell/powershelleditorservices) uses PowerShell Script Analyzer to provide real-time
1517
linting of PowerShell scripts for editors such as [VSCode](https://code.visualstudio.com/), [Neovim](https://neovim.io/), [IntelliJ](https://www.jetbrains.com/idea/), and others.

‎README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<img src="logo.png" width="180">
44

55
[![Build Status](https://dev.azure.com/powershell/psscriptanalyzer/_apis/build/status/psscriptanalyzer-ci?branchName=master)](https://dev.azure.com/powershell/psscriptanalyzer/_build/latest?definitionId=80&branchName=master)
6-
[![Join the chat at https://gitter.im/PowerShell/PSScriptAnalyzer](https://badges.gitter.im/PowerShell/PSScriptAnalyzer.svg)](https://gitter.im/PowerShell/PSScriptAnalyzer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
76

87
## Table of Contents
98

‎Rules/AlignAssignmentStatement.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ int targetColumn
650650
lhsExtent.EndColumnNumber,
651651
equalsExtent.StartColumnNumber,
652652
new string(' ', targetColumn - lhsExtent.EndColumnNumber),
653+
lhsExtent.File,
653654
string.Format(CultureInfo.CurrentCulture, Strings.AlignAssignmentStatementError)
654655
)
655656
};

‎Tests/Rules/AlignAssignmentStatement.tests.ps1‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,21 @@ Configuration C1 {
126126

127127
Context 'When Hashtable checking is enabled' {
128128

129+
It 'Should set correction file and description when analyzing a file' {
130+
$path = Join-Path -Path $TestDrive -ChildPath 'unaligned.ps1'
131+
Set-Content -LiteralPath $path -Value '@{"Key" = "Value"}'
132+
133+
$settings = New-AlignAssignmentSettings -CheckHashtable $true
134+
135+
$violations = Invoke-ScriptAnalyzer -Path $path -Settings $settings |
136+
Get-NonParseDiagnostics
137+
138+
$violations | Should -HaveCount 1
139+
$correction = $violations[0].SuggestedCorrections[0]
140+
$correction.File | Should -Be ([IO.Path]::GetFullPath($path))
141+
$correction.Description | Should -Be 'Assignment statements are not aligned'
142+
}
143+
129144
It 'Should not find violations in empty single-line hashtable' {
130145
$def = '@{}'
131146

0 commit comments

Comments
 (0)