PowerShell / PowerShell/PSScriptAnalyzer

Normalisation of new lines after pipes in expressions with 2 or more pipes

未关闭
#1,755 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Area - Formatter Issue - Enhancement
主要语言
C#
星标
2.2k
派生
414
平均合并
13 小时 1 分钟
30 天内合并 PR
2

描述

Summary of the new feature

Consider the following

$List | Where-Object {
} |
    ForEach-Object {
    }

This is a formatted piece of PowerShell with the notable feature of using both no new line after the pipe and new line after the pipe. The new rule would normalise the presence of a new line after a pipe across the input data.
The rule would have the option to enforce new lines or enforce no new lines after a pipe.

For example,

$List | Where-Object {
} |
    ForEach-Object {
    }

would become

$List | Where-Object {
} | ForEach-Object {
}

If there only exists one pipe, then removing a Newline pending its line length could also be within the scope of the feature.

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

PS > (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.19.1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

该 issue 未指定任何文件、测试或入口点;首先定位负责处理 pipe 换行的 formatter 入口点。使用提供的混合换行示例定义预期的规范化行为,并明确该规则是否适用于单个 pipe 和行长度限制。选定的 enforcement 选项能够生成一致的输出,并且其行为已由测试覆盖,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
powershell
领域
tooling
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。