-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
diagnostic.py
228 lines (221 loc) · 6.53 KB
/
diagnostic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
from typing import Literal, TypedDict
class Diagnostic(TypedDict):
sname: str
"Short name"
cname: str
"C++ ideintifer name"
severity: Literal["Error", "Warning", "Fatal", "Hint"]
message: str
"Message of this diagnostic"
diagnostics: list[Diagnostic] = [
{
"sname": "lex-unterminated-bcomment",
"cname": "UnterminatedBComment",
"severity": "Error",
"message": "unterminated /* comment",
},
{
"sname": "lex-float-no-exp",
"cname": "FloatNoExp",
"severity": "Fatal",
"message": "float point has trailing `{}` but has no exponential part",
},
{
"sname": "lex-float-leading-zero",
"cname": "FloatLeadingZero",
"severity": "Warning",
"message": "float begins with extra zeros `{}` is nixf extension",
},
{
"sname": "parse-expected",
"cname": "Expected",
"severity": "Error",
"message": "expected {}",
},
{
"sname": "parse-int-too-big",
"cname": "IntTooBig",
"severity": "Error",
"message": "this integer is too big for nix interpreter",
},
{
"sname": "parse-redundant-paren",
"cname": "RedundantParen",
"severity": "Warning",
"message": "redundant parentheses",
},
{
"sname": "parse-attrpath-extra-dot",
"cname": "AttrPathExtraDot",
"severity": "Error",
"message": "extra `.` at the end of attrpath",
},
{
"sname": "parse-select-extra-dot",
"cname": "SelectExtraDot",
"severity": "Error",
"message": "extra `.` after expression, but missing attrpath",
},
{
"sname": "parse-unexpected-between",
"cname": "UnexpectedBetween",
"severity": "Error",
"message": "unexpected {} between {} and {}",
},
{
"sname": "parse-unexpected",
"cname": "UnexpectedText",
"severity": "Error",
"message": "unexpected text",
},
{
"sname": "parse-missing-sep-formals",
"cname": "MissingSepFormals",
"severity": "Error",
"message": "missing seperator `,` between two lambda formals",
},
{
"sname": "parse-lambda-arg-extra-at",
"cname": "LambdaArgExtraAt",
"severity": "Error",
"message": "extra `@` for lambda arg",
},
{
"sname": "parse-operator-noassoc",
"cname": "OperatorNotAssociative",
"severity": "Error",
"message": "operator is non-associative",
},
{
"sname": "let-dynamic",
"cname": "LetDynamic",
"severity": "Error",
"message": "dynamic attributes are not allowed in let ... in ... expression",
},
{
"sname": "empty-inherit",
"cname": "EmptyInherit",
"severity": "Warning",
"message": "empty inherit expression",
},
{
"sname": "or-identifier",
"cname": "OrIdentifier",
"severity": "Warning",
"message": "keyword `or` used as an identifier",
},
{
"sname": "deprecated-url-literal",
"cname": "DeprecatedURL",
"severity": "Warning",
"message": "URL literal is deprecated",
},
{
"sname": "deprecated-let",
"cname": "DeprecatedLet",
"severity": "Warning",
"message": "using deprecated `let' syntactic sugar `let {{..., body = ...}}' -> (rec {{..., body = ...}}).body'",
},
{
"sname": "path-trailing-slash",
"cname": "PathTrailingSlash",
"severity": "Fatal",
"message": "path has a trailing slash",
},
{
"sname": "merge-diff-rec",
"cname": "MergeDiffRec",
"severity": "Warning",
"message": "merging two attributes with different `rec` modifiers, the latter will be implicitly ignored",
},
{
"sname": "sema-duplicated-attrname",
"cname": "DuplicatedAttrName",
"severity": "Error",
"message": "duplicated attrname `{}`",
},
{
"sname": "sema-dynamic-inherit",
"cname": "DynamicInherit",
"severity": "Error",
"message": "dynamic attributes are not allowed in inherit",
},
{
"sname": "sema-empty-formal",
"cname": "EmptyFormal",
"severity": "Error",
"message": "empty formal",
},
{
"sname": "sema-formal-missing-comma",
"cname": "FormalMissingComma",
"severity": "Error",
"message": "missing `,` for lambda formal",
},
{
"sname": "sema-formal-extra-ellipsis",
"cname": "FormalExtraEllipsis",
"severity": "Error",
"message": "extra `...` for lambda formal",
},
{
"sname": "sema-misplaced-ellipsis",
"cname": "FormalMisplacedEllipsis",
"severity": "Error",
"message": "misplaced `...` for lambda formal",
},
{
"sname": "sema-dup-formal",
"cname": "DuplicatedFormal",
"severity": "Error",
"message": "duplicated function formal",
},
{
"sname": "sema-dup-formal-arg",
"cname": "DuplicatedFormalToArg",
"severity": "Error",
"message": "function argument duplicated to a function formal",
},
{
"sname": "sema-undefined-variable",
"cname": "UndefinedVariable",
"severity": "Error",
"message": "undefined variable `{}`",
},
{
"sname": "sema-unused-def-let",
"cname": "UnusedDefLet",
"severity": "Warning",
"message": "definition `{}` in let-expression is not used",
},
{
"sname": "sema-unused-def-lambda-noarg-formal",
"cname": "UnusedDefLambdaNoArg_Formal",
"severity": "Warning",
"message": "attribute `{}` of argument is not used",
},
{
"sname": "sema-unused-def-lambda-witharg-formal",
"cname": "UnusedDefLambdaWithArg_Formal",
"severity": "Hint",
"message": "attribute `{}` of `@`-pattern argument is not used, but may be referenced from the argument",
},
{
"sname": "sema-unused-def-lambda-witharg-arg",
"cname": "UnusedDefLambdaWithArg_Arg",
"severity": "Warning",
"message": "argument `{}` in `@`-pattern is not used",
},
{
"sname": "sema-extra-rec",
"cname": "ExtraRecursive",
"severity": "Warning",
"message": "attrset is not necessary to be `rec`ursive",
},
{
"sname": "sema-extra-with",
"cname": "ExtraWith",
"severity": "Warning",
"message": "unused `with` expression",
},
]