PowerShell / PowerShell/PSScriptAnalyzer

Should PSScriptAnalyzer suggest use of the RemotingCapability cmdlet attribute when a ComputerName parameter is used?

Abierto
#397 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Issue - Discussion Issue - Question
Lenguaje dominante
C#
Estrellas
2.2k
Forks
414
Merge medio
13 h 1 min
PR fusionados (30 d)
2

Descripción

This is just a point of discussion. I just came across the RemotingCapability cmdlet attribute and it made me wonder whether or not I should be using it in commands I write that do something remotely. The easiest way I can think of to identify such a command is to detect the presence of a ComputerName parameter. For such commands, is using the RemotingCapability attribute a best practice? I have written many commands that do things remotely, and have yet to use this attribute.

Since many core commands use this rule, presumably it offers some value. Here's a one-liner to see which core commands use this rule:

gcm -module Microsoft.* | % {$md = new-object system.management.automation.commandmetadata $_; $md} | ft Name,RemotingCapability

If RemotingCapability is recommended for commands that do remote management, then PSScriptAnalyzer should probably have a rule to guide users in the right direction (detecting when that attribute is missing where it should be used).

To be honest, at this point I have no idea where/how RemotingCapability is used in PowerShell or PowerShell tools. Is it informational? Does it impact command execution? Or do tools provide script authoring tips, etc?

This should be reviewed so that a rule can be identified if it would help people use this attribute where appropriate.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Revisa el atributo de cmdlet RemotingCapability, los parámetros ComputerName y los comandos principales Microsoft.* enumerados para determinar cómo se utiliza el atributo y si afecta a la ejecución o a las directrices de autoría. Se considera terminado cuando se documente la recomendación y se decida si es apropiada una regla de PSScriptAnalyzer, incluido un alcance claro para detectar atributos ausentes.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
powershell
Área
tooling
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.