PowerShell / PowerShell/PSScriptAnalyzer
Extra level of indentation within #region/#endregion tags
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 2.2k
- Forks
- 414
- Ø Merge
- 13 Std. 1 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
Support indenting an extra level inside regions, both with analyzing and auto-formatting, so it's possible to verify/auto-format code to look like this:
#region
Get-ChildItem
#endregion
Currently the formatter will do this (because #region/#endregion isn't a token that merits an indent
#region
Get-ChildItem
#endregion
After discussing in the PowerShell slack, I was pointed towards this area where the change would need to be made:
https://github.com/PowerShell/PSScriptAnalyzer/blob/c78f5a60c1f49a5e767286ff6323a2ec0788991a/Rules/UseConsistentIndentation.cs#L146
I believe specifically this would need to be handled in the default part of the switch block.
Per @bergmeister this would most likely get added as a configurable option for the PSUseConsistentIndentation rule.
I'm putting this here because I sort of volunteered to work on it, but it will be a very low priority for me, and also I don't want this information to disappear from the Slack buffer and be gone entirely.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in Rules/UseConsistentIndentation.cs beim switch-Block um die referenzierte Zeile herum, insbesondere in dessen default case. Untersuche, wie die Regel PSUseConsistentIndentation die Konfiguration behandelt, und definiere dann die Änderung so, dass sowohl die Analyse als auch die automatische Formatierung Code innerhalb von #region/#endregion-Tags einrücken können. Als erledigt gilt die Aufgabe, wenn das gezeigte Regionslayout über die vorgesehene konfigurierbare Option unterstützt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, powershell
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100