PowerShell / PowerShell/PSScriptAnalyzer

What would be the correct TargetProfile for Ubuntu 20.04 runnin PSCore 7.1.3?

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

还没有人认领这个 Issue。

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

描述

Reading the UseCompatibleCommands documentation, it says the TargetProfiles should follow the syntax:

<os-name>_<os-arch>_<os-version>_<ps-version>_<ps-arch>_<dotnet-version>_<dotnet-edition>

But it falls short on explaining how to get these values.

So, after a little bit of detective work and figuring out which framework version each PowerShell ships with, I come up with the following string:

ubuntu_x64_20.04_7.1.3_x64_5.0.220.61302_core

The most painful to figure out is the 5.0.220.61302 part which I assume is the dotnet-version PowerShell 7.1.3 ships with. Or does it matter?

Especially figuring out the build number is painful because the documentation on the referenced page don't go to explain if 5.0.2 is good enough or should I use the full version 5.0.220.61302.

It's not at all helpful that if I put 'dos_arm_6.1_9.9.9_x64_9999999999_goosfraba' into TargetProfiles, the Invoke-ScriptAnalyzer just merrily goes forward as if nothing happened.

  1. Is ubuntu_x64_20.04_7.1.3_x64_5.0.220.61302_core good for PSCore 7.1.3 running under Ubuntu 20.04?
  2. Could you update the docs when new version of PowerShell is released? It could prove useful if my case was already in the docs so I could just copy/paste it.
  3. Would it at all be possible if Invoke-ScriptAnalyzer would produce at least a warning message when a profile string like 'dos_arm_6.1_9.9.9_x64_9999999999_goosfraba' is passed to it?

Yes, the documentation says I could use PSCompatibilityCollector but when I go there, there's 0 documentation.

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 RuleDocumentation/UseCompatibleCommands.md 以及其中引用的 PSCompatibilityCollector 文档开始。验证 Ubuntu 和 PowerShell 示例的 TargetProfiles 语法及版本要求,然后记录这些值,并明确无效配置文件是被拒绝还是被忽略。文档能够回答示例中的问题并解释格式错误的配置文件的行为,即表示完成。

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

评估

技术栈
powershell
领域
documentation, tooling
Issue 类型
文档
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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