PowerShell / PowerShell/PSScriptAnalyzer

Indentation inconsistent when using more than 1 line continuation

Aperta
#1,184 4 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area - Formatter Up-for-Grabs
Lingua principale
C#
Stelle
2.2k
Fork
414
Merge medio
13h 1m
PR unite (30g)
2

Descrizione

Before submitting a bug report:

  • Make sure you are able to repro it on the latest released version
  • Perform a quick search for existing issues to check if this bug has already been reported

Steps to reproduce

Execute the following script & compare the formatted output to the input (as defined by the variable $scriptDefinition)

$scriptDefinition = @'
$all_links = `
    [array](Get-ChildItem -Path ([Environment]::GetFolderPath('StartMenu')) -Recurse -Include '*.lnk') + `
    (Get-ChildItem -Path ([Environment]::GetFolderPath('CommonStartMenu')) -Recurse -Include '*.lnk')
'@

Invoke-Formatter -ScriptDefinition $scriptDefinition

Expected behavior

The output of the call to Invoke-Formatter should be the same as the input.

Actual behavior

The third line of the output is not indented to the same level as the second line - the output of Invoke-Formatter is as shown below.

$all_links = `
    [array](Get-ChildItem -Path ([Environment]::GetFolderPath('StartMenu')) -Recurse -Include '*.lnk') + `
(Get-ChildItem -Path ([Environment]::GetFolderPath('CommonStartMenu')) -Recurse -Include '*.lnk')

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.18356.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18356.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.18.0

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo lo script PowerShell fornito tramite Invoke-Formatter con PSScriptAnalyzer 1.18.0 e verifica come vengono indentate più continuazioni con backtick. Il lavoro è completato quando la terza riga è indentata allo stesso livello della seconda e l’output formattato corrisponde all’input.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.