PowerShell / PowerShell/PSScriptAnalyzer

Rule request: AvoidDefaultEncoding

Abierto
#2,079 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Up for Grabs
Lenguaje dominante
C#
Estrellas
2.2k
Forks
414
Merge medio
13 h 1 min
PR fusionados (30 d)
2

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza revisando la regla PSUseCompatibleCommands y sus perfiles de compatibilidad; después, compara la documentación enlazada sobre la codificación de Windows PowerShell y PowerShell. Define los diagnósticos esperados para -Encoding Default y -Encoding utf8 cuando el análisis de compatibilidad está habilitado, incluido cómo deben tratarse los valores más nuevos Ansi y utf8NoBom; el issue estará terminado cuando el comportamiento de la regla y la cobertura correspondiente reflejen esa decisión.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
powershell
Área
devtools
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.