variable assignments are not aligned
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- powershell
- 领域
- tooling
调研方向
运行提供的 PowerShell 5.1 重现,并启用 PSAlignAssignmentStatement,包括 CheckHashtable。阅读该规则的 formatter 行为,并比较赋值和哈希表条目的对齐方式;当示例中的变量赋值和哈希表等号保持一致对齐时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
After executing the following code, the = in variable assignments are not aligned, and the = in the first hashtable are also not aligned. I tested this in PowerShell 5.1 on Windows 10.
cls
$s = @'
$hashtable = @{ property1 ="value"
anotherProperty= "another value"
}
$hashtable = @{
property1 = "value"
anotherProperty = "another value"
}
$hashtable = @{
property1 = "value"
anotherProperty = "another value"
}
$a= "hello"
$ccc = "world"
$b="Hi"
function foo {
"hello"
}
'@
$settings = @{
IncludeRules = @("PSPlaceOpenBrace", "PSUseConsistentIndentation", "PSUseConsistentWhitespace","PSAlignAssignmentStatement")
Rules = @{
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $false
}
PSUseConsistentIndentation = @{
Enable = $true
Kind = 'tab' # space,tab
IndentationSize = 1
PipelineIndentation = 'NoIndentation'
}
PSAlignAssignmentStatement = @{
Enable = $true
CheckHashtable = $true
}
}
}
Invoke-Formatter -ScriptDefinition $s -Settings $settings
- 主要语言
- C#
- 星标
- 2.2k
- 派生
- 415
- 平均合并
- 13 小时 1 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PowerShell/PSScriptAnalyzer 的其他 Issue
-
Up-for-Grabs
难度 1/5 1-3 小时 新手友好度 78/100
PowerShell/PSScriptAnalyzer#2213 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 72/100
PowerShell/PSScriptAnalyzer#2217 · 1 条评论 ·
-
PSUseConsistentIndentation double-indents attribute bodies that open a scriptblock (`[Attr({ … })]`) 未关闭
难度 3/5 1-2 天 新手友好度 70/100
PowerShell/PSScriptAnalyzer#2216 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 68/100
PowerShell/PSScriptAnalyzer#2211 ·
-
`PSPlaceOpenBrace` and `PSPlaceCloseBrace` leave trailing whitespace when expanding one-line blocks 未关闭
难度 3/5 1-2 天 新手友好度 70/100
PowerShell/PSScriptAnalyzer#2210 ·