PowerShell / PowerShell/PSScriptAnalyzer
Format Document with Hash Table entry on first line stopping all formatting in file
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 2.2k
- 派生
- 414
- 平均合并
- 13 小时 1 分钟
- 30 天内合并 PR
- 2
描述
Steps to reproduce
following data in VS Code editor will prevent any formatting of PowerShell code in the file. If I move the PivotRows = 'Date' to the next line proper formatting occurs throughout rest of file.
{
$pt.SprintEffortCharts=@{ PivotRows = 'Date'
NoTotalsInPivot = $true
PivotDataToColumn = $true
}
}
Output of Invoke-Formatter
Invoke-Formatter -ScriptDefinition "$(Get-Content $scriptPath)" -Verbose 2> .\invoke-formatter.log
VERBOSE: Using settings file at C:\Program Files\WindowsPowerShell\Modules\PSScriptAnalyzer\1.17.1\Settings\CodeFormatting.psd1.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSPlaceCloseBrace rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSPlaceOpenBrace rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSUseConsistentWhitespace rule.
VERBOSE: Found 2 violations.
VERBOSE: Fixed 1 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSUseConsistentWhitespace rule.
VERBOSE: Found 1 violations.
VERBOSE: Fixed 1 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSUseConsistentIndentation rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSAlignAssignmentStatement rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
{ $pt.SprintEffortCharts = @{ PivotRows = 'Date' NoTotalsInPivot = $true PivotDataToColumn = $true } }
invoke-formatter.log
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.820
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.820
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.17.1
1.17.1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 Invoke-Formatter 在 PSScriptAnalyzer 1.17.1 上重现提供的哈希表示例,然后将其与 PivotRows 移动到下一行的版本进行比较。跟踪格式化程序对第一行哈希表条目的处理行为。完成的标准是整个文件能够正确格式化,同时不会折叠哈希表内容。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- powershell
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100