131 lines
5.1 KiB
JSON
131 lines
5.1 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://cflmy.cn/marqdo-lint/marqdo-lint-v1.schema.json",
|
|
"title": "Marqdo Lint v1",
|
|
"oneOf": [
|
|
{"$ref": "#/$defs/document"},
|
|
{"$ref": "#/$defs/run"}
|
|
],
|
|
"$defs": {
|
|
"span": {
|
|
"type": "object",
|
|
"required": ["start", "end"],
|
|
"properties": {
|
|
"start": {"type": "integer", "minimum": 0},
|
|
"end": {"type": "integer", "minimum": 0}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"diagnostic": {
|
|
"type": "object",
|
|
"required": ["id", "severity", "span", "related_spans", "message", "reason", "suggestion", "fix_safety"],
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "^MQD-[A-Z]+-[0-9]{3}$"},
|
|
"severity": {"enum": ["info", "warning", "error"]},
|
|
"span": {"$ref": "#/$defs/span"},
|
|
"related_spans": {"type": "array", "items": {"$ref": "#/$defs/span"}},
|
|
"message": {"type": "string"},
|
|
"reason": {"type": "string"},
|
|
"suggestion": {"type": "string"},
|
|
"fix_safety": {"enum": ["manual", "safe_only", "not_applicable"]},
|
|
"function": {"type": "string"}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"nullable_span": {
|
|
"oneOf": [{"$ref": "#/$defs/span"}, {"type": "null"}]
|
|
},
|
|
"coverage": {
|
|
"type": "object",
|
|
"required": ["entry_span", "result_anchor_span", "result_span", "repeated_prose_spans"],
|
|
"properties": {
|
|
"entry_span": {"$ref": "#/$defs/nullable_span"},
|
|
"result_anchor_span": {"$ref": "#/$defs/nullable_span"},
|
|
"result_span": {"$ref": "#/$defs/nullable_span"},
|
|
"repeated_prose_spans": {"type": "array", "items": {"$ref": "#/$defs/span"}}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"function_metrics": {
|
|
"type": "object",
|
|
"required": ["function_id", "function_name", "heading_span", "n", "e", "table_n",
|
|
"statement_count", "threshold", "ratio", "status", "measurement_version",
|
|
"has_control_flow", "has_explicit_effects", "heading_segment_count", "coverage"],
|
|
"properties": {
|
|
"function_id": {"type": "string"},
|
|
"function_name": {"type": "string"},
|
|
"heading_span": {"$ref": "#/$defs/span"},
|
|
"n": {"type": "integer", "minimum": 0},
|
|
"e": {"type": "integer", "minimum": 0},
|
|
"table_n": {"type": "integer", "minimum": 0},
|
|
"statement_count": {"type": "integer", "minimum": 0},
|
|
"threshold": {"type": "number", "minimum": 0, "maximum": 1},
|
|
"ratio": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
|
|
"status": {"enum": ["applicable", "not_applicable"]},
|
|
"measurement_version": {"const": 1},
|
|
"has_control_flow": {"type": "boolean"},
|
|
"has_explicit_effects": {"type": "boolean"},
|
|
"heading_segment_count": {"type": "integer", "minimum": 0},
|
|
"coverage": {"$ref": "#/$defs/coverage"}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"metrics": {
|
|
"type": "object",
|
|
"required": ["narrative_ratio", "measurement_version", "functions"],
|
|
"properties": {
|
|
"narrative_ratio": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
|
|
"measurement_version": {"const": 1},
|
|
"functions": {"type": "array", "items": {"$ref": "#/$defs/function_metrics"}}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"document": {
|
|
"type": "object",
|
|
"required": ["schema", "schema_version", "source", "diagnostics", "analysis_status", "metrics"],
|
|
"properties": {
|
|
"schema": {"const": "marqdo.lint"},
|
|
"schema_version": {"const": 1},
|
|
"source": {
|
|
"type": "object",
|
|
"required": ["path", "digest"],
|
|
"properties": {
|
|
"path": {"type": "string"},
|
|
"digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"diagnostics": {"type": "array", "items": {"$ref": "#/$defs/diagnostic"}},
|
|
"analysis_status": {"enum": ["complete", "analysis_incomplete"]},
|
|
"metrics": {"$ref": "#/$defs/metrics"},
|
|
"notices": {"type": "array", "items": {"type": "string"}},
|
|
"core_output": {"type": "string"}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"summary": {
|
|
"type": "object",
|
|
"required": ["files", "info", "warnings", "errors", "analysis_incomplete"],
|
|
"properties": {
|
|
"files": {"type": "integer", "minimum": 0},
|
|
"info": {"type": "integer", "minimum": 0},
|
|
"warnings": {"type": "integer", "minimum": 0},
|
|
"errors": {"type": "integer", "minimum": 0},
|
|
"analysis_incomplete": {"type": "integer", "minimum": 0}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"run": {
|
|
"type": "object",
|
|
"required": ["schema", "schema_version", "reports", "summary"],
|
|
"properties": {
|
|
"schema": {"const": "marqdo.lint"},
|
|
"schema_version": {"const": 1},
|
|
"reports": {"type": "array", "items": {"$ref": "#/$defs/document"}},
|
|
"summary": {"$ref": "#/$defs/summary"}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
}
|