PowerShell / PowerShell/PSScriptAnalyzer

[RULE] PSScriptAnalyzerSettingsSchema

オープン
#1,279 コメント 3 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Area - Configuration Area - Engine Consider - 2.0 Issue - Enhancement
主要言語
C#
スター
2.2k
フォーク
414
平均マージ
13時間 1分
マージ済み PR(30日)
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-ScriptAnalyzer command.
  • The implementation of the "PSScriptAnalyzerSettingsSchema" rule SHOULD share source code for validation logic with the Invoke-ScriptAnalyzer command 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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず Invoke-ScriptAnalyzer コマンドと提案されている PSScriptAnalyzerSettingsSchema ルールを見つけ、次に設定が現在どのように検証されているかを追跡します。指定された大文字と小文字を区別しないスキーマがコマンドによって適用され、必要に応じてルールがコマンドと検証ロジックを共有すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
powershell
領域
tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。