PowerShell / PowerShell/PSScriptAnalyzer

Rule request: Avoid enclosing strings with smart quotes

Aperta
#1,936 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Issue - Discussion
Lingua principale
C#
Stelle
2.2k
Fork
414
Merge medio
13h 1m
PR unite (30g)
2

Descrizione

Background (excerpt from Wikipedea Quotation mark definition):

Regarding their appearance, there are two types of quotation marks:

  • '…' and "…" are known as neutral, vertical, straight, typewriter, dumb, or ASCII quotation marks. The left and right marks are identical. These are found on typical English typewriters and computer keyboards, although they are sometimes automatically converted to the other type by software.
  • ‘…’ and “…” are known as typographic, curly, curved, book, or smart quotation marks...

Summary of the new feature

Quoted strings are sometimes unintendedly replaced when passed by word processors as Microsoft Office applications as MSWord and Outlook. It is recommended to surround strings with unambiguous single quoted or double quoted string as it unnecessary triggers the UseBOMForUnicodeEncodedFile rule with no clear indication of the location.

Proposed technical implementation details (optional)

See (PowerShell based) prototype AvoidSmartQuotedString at: https://github.com/iRon7/PSRules

What is the latest version of PSScriptAnalyzer at the point of writing

1.21.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 leggendo il prototipo AvoidSmartQuotedString in PSRules e la documentazione esistente della regola UseBOMForUnicodeEncodedFile in PSScriptAnalyzer. Determina come viene strutturata e testata una nuova regola di analisi, quindi definisci il completamento in modo da rilevare stringhe con virgolette tipografiche non intenzionali senza produrre un avviso BOM fuorviante.

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

Valutazione

Stack tecnologico
csharp, powershell
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.