PowerShell / PowerShell/PSScriptAnalyzer
[RULE] PSScriptAnalyzerSettingsSchema
Personne n'a encore pris cette issue.
- Langage dominant
- C#
- Étoiles
- 2.2k
- Forks
- 414
- Merge moyen
- 13 h 1 min
- PR mergées (30 j)
- 2
Description
User Story
- As a writer of PSScriptAnalyzer settings files
- I want static code checking of the structure of PSScriptAnalyzer settings files
- so that I can catch schematic violations early and easily.
Specification Details
The static schema for an Invoke-ScriptAnalyzer -Settings hashtable is not formally documented in a rigorous format at present. However, the current implementation implicitly adheres to the following as expressed using JSON Schema (with the exception of case-sensitivity):
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "PSScriptAnalyzerSettings",
"type": "object",
"definitions": {
"SeverityString": {
"type": "string",
"pattern": "Error|Warning|Information"
},
"stringOrStrings": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"properties": {
"CustomRulePath": {
"$ref": "#/definitions/stringOrStrings"
},
"ExcludeRules": {
"$ref": "#/definitions/stringOrStrings"
},
"IncludeDefaultRules": {
"type": "boolean"
},
"IncludeRules": {
"$ref": "#/definitions/stringOrStrings"
},
"RecurseCustomRulePath": {
"type": "boolean"
},
"Rules": {
"type": "object",
"additionalProperties": {
"type": "object"
}
},
"Severity": {
"oneOf": [
{
"$ref": "#/definitions/SeverityString"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/SeverityString"
}
}
]
}
},
"additionalProperties": false
}
The static schema of an Invoke-ScriptAnalyzer -Settings hashtable, as currently implemented and as expressed above (but with the addition of global case-insensitivity), shall serve as the specification for the proposed "PSScriptAnalyzerSettingsSchema" rule. Additional requirements are as follows:
- The schema utilized by the "PSScriptAnalyzerSettingsSchema" rule MUST be enforced by the
Invoke-ScriptAnalyzercommand. - The implementation of the "PSScriptAnalyzerSettingsSchema" rule SHOULD share source code for validation logic with the
Invoke-ScriptAnalyzercommand in an appropriately modular fashion such that changes to the aforementioned schema's specification correspond one-to-one to changes in the source code.
PSScriptAnalyzer Version
The latest version of PSScriptAnalyzer as of this writing is 1.18.1.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par localiser la commande Invoke-ScriptAnalyzer et la règle proposée PSScriptAnalyzerSettingsSchema, puis retracez la manière dont les paramètres sont actuellement validés. C'est terminé lorsque le schéma spécifié, insensible à la casse, est imposé par la commande et que la règle partage avec elle la logique de validation comme requis.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- powershell
- Domaine
- tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100