Skip to content

Commit e4b0a2e

Browse files
authored
Update ty's JSON schema (SchemaStore#4856)
1 parent a1a571c commit e4b0a2e

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

src/schemas/json/ty.json

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,6 @@
5656
},
5757
"additionalProperties": false,
5858
"definitions": {
59-
"DiagnosticFormat": {
60-
"description": "The diagnostic output format.",
61-
"oneOf": [
62-
{
63-
"description": "The default full mode will print \"pretty\" diagnostics.\n\nThat is, color will be used when printing to a `tty`. Moreover, diagnostic messages may include additional context and annotations on the input to help understand the message.",
64-
"type": "string",
65-
"enum": ["full"]
66-
},
67-
{
68-
"description": "Print diagnostics in a concise mode.\n\nThis will guarantee that each diagnostic is printed on a single line. Only the most important or primary aspects of the diagnostic are included. Contextual information is dropped.\n\nThis may use color when printing to a `tty`.",
69-
"type": "string",
70-
"enum": ["concise"]
71-
}
72-
]
73-
},
7459
"EnvironmentOptions": {
7560
"type": "object",
7661
"properties": {
@@ -143,6 +128,21 @@
143128
}
144129
]
145130
},
131+
"OutputFormat": {
132+
"description": "The diagnostic output format.",
133+
"oneOf": [
134+
{
135+
"description": "The default full mode will print \"pretty\" diagnostics.\n\nThat is, color will be used when printing to a `tty`. Moreover, diagnostic messages may include additional context and annotations on the input to help understand the message.",
136+
"type": "string",
137+
"enum": ["full"]
138+
},
139+
{
140+
"description": "Print diagnostics in a concise mode.\n\nThis will guarantee that each diagnostic is printed on a single line. Only the most important or primary aspects of the diagnostic are included. Contextual information is dropped.\n\nThis may use color when printing to a `tty`.",
141+
"type": "string",
142+
"enum": ["concise"]
143+
}
144+
]
145+
},
146146
"OverrideOptions": {
147147
"type": "object",
148148
"properties": {
@@ -831,6 +831,16 @@
831831
}
832832
]
833833
},
834+
"unresolved-global": {
835+
"title": "detects `global` statements with no definition in the global scope",
836+
"description": "## What it does\nDetects variables declared as `global` in an inner scope that have no explicit\nbindings or declarations in the global scope.\n\n## Why is this bad?\nFunction bodies with `global` statements can run in any order (or not at all), which makes\nit hard for static analysis tools to infer the types of globals without\nexplicit definitions or declarations.\n\n## Example\n```python\ndef f():\n global x # unresolved global\n x = 42\n\ndef g():\n print(x) # unresolved reference\n```\n\nUse instead:\n```python\nx: int\n\ndef f():\n global x\n x = 42\n\ndef g():\n print(x)\n```\n\nOr:\n```python\nx: int | None = None\n\ndef f():\n global x\n x = 42\n\ndef g():\n print(x)\n```",
837+
"default": "warn",
838+
"oneOf": [
839+
{
840+
"$ref": "#/definitions/Level"
841+
}
842+
]
843+
},
834844
"unresolved-import": {
835845
"title": "detects unresolved imports",
836846
"description": "## What it does\nChecks for import statements for which the module cannot be resolved.\n\n## Why is this bad?\nImporting a module that cannot be resolved will raise a `ModuleNotFoundError`\nat runtime.\n\n## Examples\n```python\nimport foo # ModuleNotFoundError: No module named 'foo'\n```",
@@ -946,7 +956,7 @@
946956
"description": "The format to use for printing diagnostic messages.\n\nDefaults to `full`.",
947957
"anyOf": [
948958
{
949-
"$ref": "#/definitions/DiagnosticFormat"
959+
"$ref": "#/definitions/OutputFormat"
950960
},
951961
{
952962
"type": "null"

0 commit comments

Comments
 (0)