PowerShell / PowerShell/PSScriptAnalyzer
Revise semantics of compatibility rule profile inclusion
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
UseCompatibleCommands and UseCompatibleTypes create a "union" profile for comparison of target profiles to a base standard. This allows us to use simple heuristic to determine whether a PowerShell AST represents something that is platform-specific (we see if the command or type is available in any platform, and if not ignore it as user-defined).
The problem here is that to create good warnings we have to have a good baseline union profile. Meaning we need to be judicious about how we make the profile. But since we could get it wrong, I created an informal mechanism for including things into the union profile. We use all the profiles in the "profile directory" and nothing else:
This means that:
- Including only one target, you still get good warnings, because it's compared against all the other profiles we ship by default
- Using a target not in the profile directory, that won't be included in the union comparison
- You can configure a different profile directory to get rid of comparisons to PowerShells you don't care about
This works but it's a bit subtle. I think we should move to:
- All targets are in the union by default
- Targets in the profile directory are in the union by default
- Targets can be excluded from the union in a configuration setting, by name or path
- The profile directory automatic union inclusion can be turned off by default
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with CompatibilityProfileLoader.cs, especially the profile-directory loading logic linked in the issue, and trace how UseCompatibleCommands and UseCompatibleTypes build the union profile. Define the configuration and exclusion behavior for named or path-based targets and for disabling automatic profile-directory inclusion. Done means all targets are included by default while configured exclusions and the opt-out setting are honored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- devtools, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100