PowerShell / PowerShell/PSScriptAnalyzer

Invoke-Formatter: Tab Issue

Aberta
#1,055 8 comentários 0 reações 1 responsável Ver no GitHub

@bergmeister já está trabalhando nisso.

Desde 15/11/2018.

Area - Formatter Issue - Bug
Linguagem predominante
C#
Estrelas
2.2k
Forks
414
Merge médio
13h 1min
PRs com merge (30d)
2

Descrição

# CodeFormatting.psd1
@{
    IncludeRules = @(
        'PSPlaceOpenBrace',
        'PSPlaceCloseBrace',
        'PSUseConsistentWhitespace',
        'PSUseConsistentIndentation',
        'PSAlignAssignmentStatement'
    )

    Rules        = @{
        PSPlaceOpenBrace           = @{
            Enable             = $true
            OnSameLine         = $false
            NewLineAfter       = $true
            IgnoreOneLineBlock = $true
        }

        PSPlaceCloseBrace          = @{
            Enable             = $true
            NewLineAfter       = $true
            IgnoreOneLineBlock = $true
            NoEmptyLineBefore  = $false
        }

        PSUseConsistentIndentation = @{
            Enable          = $true
            **Kind            = 'tab'**
            IndentationSize = 4
        }

        PSUseConsistentWhitespace  = @{
            Enable         = $true
            CheckOpenBrace = $true
            CheckOpenParen = $true
            CheckOperator  = $true
            CheckSeparator = $true
        }

        PSAlignAssignmentStatement = @{
            Enable         = $true
            CheckHashtable = $true
        }
    }
}

Steps to reproduce

$Params = @{
	'AppName'		= "AppTest9001"
	'NTID'			= "TestNTID"
	'Credential'	= $Credential
	'Verbose'		= $True
}

Expected behavior

It should preserve tabs (anywhere) but in this case specifically, between the key and the equal sign

Actual behavior

It is changing out tabs for spaces between the key and equal sign.
Also, I noticed it is also did not convert some tabs to spaces. If there is only one tab between the key and equal sign, it didn't convert the tab to spaces. My guess is the tab isn't a full tab (meaning it would only be 1-3 spaces and not the full 4)

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.15063.1155
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.1155
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.17.1

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.