PowerShell / PowerShell/PSScriptAnalyzer

Missing line number in rule PSUseBOMForUnicodeEncodedFile

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

Nadie ha tomado este issue todavía.

Area - Rules Issue-Bug
Lenguaje dominante
C#
Estrellas
2.2k
Forks
414
Merge medio
13 h 1 min
PR fusionados (30 d)
2

Descripción

Line numbers are missing for the Rule "Missing Line Number for PSUseBOMForUnicodeEncodedFile"

Steps to reproduce

Introduce a file test.ps1 with the following content:

Get–ChildItem

Run the PSScriptAnalyzer in the directory where the file remains.

Be aware of the dash:

The character U+2013 "–" could be confused with the character U+002d "-", which is more common in source code.

Expected behavior

Invoke-ScriptAnalyzer -Recurse -Path .

RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSUseBOMForUnicodeEncodedFile       Warning      test.ps1   1     Missing BOM encoding for non-ASCII encoded file 'test.ps1'

Actual behavior

Invoke-ScriptAnalyzer -Recurse -Path .

RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSUseBOMForUnicodeEncodedFile       Warning      test.ps1         Missing BOM encoding for non-ASCII encoded file 'test.ps1'

If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.2.5
PSEdition                      Core
GitCommitId                    7.2.5
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.21.0

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

Reproduce el problema con el contenido proporcionado de test.ps1 y el comando Invoke-ScriptAnalyzer; después, busca en el repositorio PSUseBOMForUnicodeEncodedFile y la creación del diagnóstico. Se considera completado cuando la advertencia informa de la línea 1 para test.ps1 y hay una prueba de regresión que cubre el caso de un archivo con caracteres no ASCII.

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

Evaluación

Stack tecnológico
csharp, powershell
Área
testing-qa, tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.