PowerShell / PowerShell/PSScriptAnalyzer

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

Open
#1,657 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - CompatibilityRules Area - Documentation Issue - Bug
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RuleDocumentation/UseCompatibleCommands.md and the referenced PSCompatibilityCollector documentation. Verify the TargetProfiles syntax and version requirements for the Ubuntu and PowerShell example, then document the values and clarify whether invalid profiles are rejected or ignored. Done means the documentation answers the example questions and explains the behavior for malformed profiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
documentation, tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.