PowerShell / PowerShell/PSScriptAnalyzer

Rule request: AvoidDefaultEncoding

Aberta
#2,079 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Up for Grabs
Linguagem predominante
C#
Estrelas
2.2k
Forks
414
Merge médio
13h 1min
PRs com merge (30d)
2

Descrição

Apparently the default encoding -Encoding Default is removed from the cmdlet documentation that supports the -Encoding parameter. See e.g.:

Which makes sense in a way that this might cause compatibility issues when something is e.g. written (using -Encoding Default in Windows PowerShell 5.1 and read back in PowerShell 7 (e.g. after a PowerShell update migration). Yet, afaik, this isn't captured by any of the UseCompatibleCommands profiles either (probably because the default value is still accepted.

Also note:

  • that using any of the newer encoding values as Ansi and utf8NoBom in PowerShell 7 might cause an incompatibility issue with older versions of PowerShell.
  • the implementation of the -Encoding utf8 value also differs between Windows PowerShell and newer versions of PowerShell:

Therefore I think that it is wise to avoid the default and utf8 encoding (-Encoding Default and -Encoding utf8) when PSUseCompatibleCommands is enabled in the PSScriptAnalyzer settings.

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.

Direção de pesquisa

Comece revisando a regra PSUseCompatibleCommands e seus perfis de compatibilidade; em seguida, compare a documentação vinculada sobre codificação do Windows PowerShell e do PowerShell. Defina os diagnósticos esperados para -Encoding Default e -Encoding utf8 quando a análise de compatibilidade estiver habilitada, incluindo como os valores mais novos Ansi e utf8NoBom devem ser tratados; a issue estará concluída quando o comportamento da regra e a cobertura correspondente refletirem essa decisão.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
powershell
Domínio
devtools
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
38/100

Receba novas issues na sua caixa de entrada

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