PowerShell / PowerShell/PSScriptAnalyzer

Revise semantics of compatibility rule profile inclusion

Aberta
#1,224 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Area - Configuration Area - Engine Consider - 2.0 Issue - Enhancement
Linguagem predominante
C#
Estrelas
2.2k
Forks
415
Merge médio
13h 1min
PRs com merge (30d)
2

Descrição

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:

https://github.com/PowerShell/PSScriptAnalyzer/blob/df566b577803375cd6f1faba7d9d5d8715deefab/PSCompatibilityAnalyzer/Microsoft.PowerShell.CrossCompatibility/Utility/CompatibilityProfileLoader.cs#L76

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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece por CompatibilityProfileLoader.cs, especialmente pela lógica de carregamento do diretório de perfis vinculada na issue, e rastreie como UseCompatibleCommands e UseCompatibleTypes constroem o perfil de união. Defina o comportamento de configuração e exclusão para destinos nomeados ou baseados em caminho e para desabilitar a inclusão automática do diretório de perfis. O trabalho estará concluído quando todos os destinos forem incluídos por padrão e as exclusões configuradas e a configuração de opt-out forem respeitadas.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
csharp, powershell
Domínio
devtools, tooling
Tipo de issue
Funcionalidade
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
30/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.