PowerShell / PowerShell/PSScriptAnalyzer

Extra level of indentation within #region/#endregion tags

Ouverte
#1,562 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Area - Formatter Issue - Enhancement
Langage dominant
C#
Étoiles
2.2k
Forks
414
Merge moyen
13 h 1 min
PR mergées (30 j)
2

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez dans Rules/UseConsistentIndentation.cs, au niveau du bloc switch autour de la ligne référencée, en particulier dans son default case. Examinez la manière dont la règle PSUseConsistentIndentation gère la configuration, puis définissez la modification afin que l’analyse et le formatage automatique puissent tous deux indenter le code à l’intérieur des balises #region/#endregion. Le travail est terminé lorsque la disposition de région présentée est prise en charge par l’option configurable prévue.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, powershell
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.