PowerShell / PowerShell/PSScriptAnalyzer
[RULE] PSScriptAnalyzerSettingsSchema
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 2.2k
- 派生
- 414
- 平均合并
- 13 小时 1 分钟
- 30 天内合并 PR
- 2
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位 Invoke-ScriptAnalyzer 命令和提议的 PSScriptAnalyzerSettingsSchema 规则,然后追踪当前如何验证设置。完成的标准是:指定的不区分大小写的 schema 由该命令强制执行,并且该规则按要求与该命令共享验证逻辑。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- powershell
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100