jarbin-c-coding-style 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jarbin_c_coding_style-2.0.0.dist-info/METADATA +150 -0
- jarbin_c_coding_style-2.0.0.dist-info/RECORD +186 -0
- jarbin_c_coding_style-2.0.0.dist-info/WHEEL +4 -0
- jarbin_c_coding_style-2.0.0.dist-info/entry_points.txt +2 -0
- jarbin_c_coding_style-2.0.0.dist-info/licenses/LICENSE +674 -0
- sources/__init__.py +0 -0
- sources/__main__.py +6 -0
- sources/analysis/__init__.py +0 -0
- sources/analysis/directives.py +258 -0
- sources/analysis/lexer.py +288 -0
- sources/analysis/parser.py +1754 -0
- sources/analysis/project.py +286 -0
- sources/analysis/source.py +326 -0
- sources/analysis/syntax.py +238 -0
- sources/analysis/tokens.py +116 -0
- sources/analysis/unit.py +700 -0
- sources/application.py +118 -0
- sources/build_info.json +6 -0
- sources/cli/__init__.py +0 -0
- sources/cli/arguments.py +507 -0
- sources/cli/completion.py +610 -0
- sources/cli/context.py +258 -0
- sources/cli/converters.py +204 -0
- sources/cli/help.py +162 -0
- sources/cli/parser.py +659 -0
- sources/configs/__init__.py +0 -0
- sources/configs/editor.py +207 -0
- sources/configs/ini.py +327 -0
- sources/configs/project.py +735 -0
- sources/configs/schema/__init__.py +0 -0
- sources/configs/schema/project.py +68 -0
- sources/constants.py +801 -0
- sources/diagnostics/__init__.py +0 -0
- sources/diagnostics/fingerprint.py +82 -0
- sources/diagnostics/model.py +146 -0
- sources/engine/__init__.py +0 -0
- sources/engine/api.py +355 -0
- sources/engine/examples.py +157 -0
- sources/engine/outcome.py +114 -0
- sources/engine/plan.py +440 -0
- sources/engine/runner.py +345 -0
- sources/engine/scanner.py +179 -0
- sources/enums.py +838 -0
- sources/errors/__init__.py +0 -0
- sources/errors/exceptions.py +727 -0
- sources/fixers/__init__.py +0 -0
- sources/fixers/base.py +209 -0
- sources/fixers/conflicts.py +129 -0
- sources/fixers/diff.py +73 -0
- sources/fixers/engine.py +434 -0
- sources/fixers/journal.py +290 -0
- sources/fixers/kinds.py +30 -0
- sources/fixers/layout.py +411 -0
- sources/fixers/model.py +151 -0
- sources/fixers/registry.py +54 -0
- sources/fixers/text.py +353 -0
- sources/fixers/verify.py +123 -0
- sources/fixers/writer.py +88 -0
- sources/integrations/__init__.py +0 -0
- sources/integrations/ci/__init__.py +0 -0
- sources/integrations/ci/github.py +183 -0
- sources/integrations/editors/__init__.py +0 -0
- sources/integrations/git/__init__.py +0 -0
- sources/integrations/git/repository.py +176 -0
- sources/integrations/update/__init__.py +0 -0
- sources/integrations/update/installers.py +529 -0
- sources/integrations/update/releases.py +397 -0
- sources/integrations/update/state.py +143 -0
- sources/outputs/__init__.py +0 -0
- sources/outputs/github/__init__.py +0 -0
- sources/outputs/github/renderer.py +135 -0
- sources/outputs/html/__init__.py +0 -0
- sources/outputs/html/renderer.py +694 -0
- sources/outputs/json/__init__.py +0 -0
- sources/outputs/json/renderer.py +154 -0
- sources/outputs/json/report.schema.json +121 -0
- sources/outputs/junit/__init__.py +0 -0
- sources/outputs/junit/renderer.py +151 -0
- sources/outputs/registry.py +135 -0
- sources/outputs/report.py +224 -0
- sources/outputs/sarif/__init__.py +0 -0
- sources/outputs/sarif/renderer.py +182 -0
- sources/outputs/terminal/__init__.py +0 -0
- sources/outputs/terminal/renderer.py +184 -0
- sources/outputs/terminal/style.py +159 -0
- sources/rules/__init__.py +0 -0
- sources/rules/arguments.py +362 -0
- sources/rules/catalog.py +227 -0
- sources/rules/categories/advanced/constant_pointers.ini +46 -0
- sources/rules/categories/advanced/line_break_at_end_of_file.ini +44 -0
- sources/rules/categories/advanced/static.ini +65 -0
- sources/rules/categories/advanced/typing.ini +47 -0
- sources/rules/categories/control_structures/conditional_branching.ini +89 -0
- sources/rules/categories/control_structures/goto.ini +45 -0
- sources/rules/categories/control_structures/ternary_operators.ini +57 -0
- sources/rules/categories/extensions/language_extensions.ini +71 -0
- sources/rules/categories/files_organization/contents_of_the_repository.ini +85 -0
- sources/rules/categories/files_organization/file_coherence.ini +166 -0
- sources/rules/categories/files_organization/file_extension.ini +68 -0
- sources/rules/categories/files_organization/fixtures/program +0 -0
- sources/rules/categories/files_organization/naming_files_and_folders.ini +74 -0
- sources/rules/categories/functions/coherence_of_functions.ini +45 -0
- sources/rules/categories/functions/comments_inside_a_function.ini +45 -0
- sources/rules/categories/functions/functions_without_parameters.ini +39 -0
- sources/rules/categories/functions/naming_functions.ini +79 -0
- sources/rules/categories/functions/number_of_columns.ini +61 -0
- sources/rules/categories/functions/number_of_lines.ini +70 -0
- sources/rules/categories/functions/number_of_parameters.ini +64 -0
- sources/rules/categories/functions/structures_as_parameters.ini +44 -0
- sources/rules/categories/global_scope/constant_values.ini +49 -0
- sources/rules/categories/global_scope/file_header.ini +92 -0
- sources/rules/categories/global_scope/global_variables.ini +53 -0
- sources/rules/categories/global_scope/include.ini +39 -0
- sources/rules/categories/global_scope/indentation_of_preprocessor.ini +62 -0
- sources/rules/categories/global_scope/inline_assembly.ini +43 -0
- sources/rules/categories/global_scope/leading_trailing_lines.ini +58 -0
- sources/rules/categories/global_scope/line_endings.ini +53 -0
- sources/rules/categories/global_scope/separation_of_functions.ini +61 -0
- sources/rules/categories/global_scope/trailing_spaces.ini +45 -0
- sources/rules/categories/header_files/content.ini +104 -0
- sources/rules/categories/header_files/include_guard.ini +47 -0
- sources/rules/categories/header_files/macros.ini +57 -0
- sources/rules/categories/layout_inside_a_function_scope/blank_lines.ini +71 -0
- sources/rules/categories/layout_inside_a_function_scope/code_line_content.ini +112 -0
- sources/rules/categories/layout_inside_a_function_scope/curly_brackets.ini +94 -0
- sources/rules/categories/layout_inside_a_function_scope/indentation.ini +96 -0
- sources/rules/categories/layout_inside_a_function_scope/spaces.ini +113 -0
- sources/rules/categories/layout_inside_a_function_scope/variable_declarations.ini +65 -0
- sources/rules/categories/variables_and_types/naming_identifiers.ini +74 -0
- sources/rules/categories/variables_and_types/pointers.ini +67 -0
- sources/rules/categories/variables_and_types/structures.ini +47 -0
- sources/rules/data/verbs.txt +182 -0
- sources/rules/definition.py +430 -0
- sources/rules/loader.py +925 -0
- sources/rules/paths.py +6 -0
- sources/rules/primitives/__init__.py +0 -0
- sources/rules/primitives/base.py +297 -0
- sources/rules/primitives/braces.py +211 -0
- sources/rules/primitives/directives.py +203 -0
- sources/rules/primitives/indentation.py +376 -0
- sources/rules/primitives/layout.py +199 -0
- sources/rules/primitives/naming.py +277 -0
- sources/rules/primitives/project.py +62 -0
- sources/rules/primitives/registry.py +49 -0
- sources/rules/primitives/repository.py +129 -0
- sources/rules/primitives/review.py +87 -0
- sources/rules/primitives/semantic.py +319 -0
- sources/rules/primitives/spacing.py +210 -0
- sources/rules/primitives/structure.py +586 -0
- sources/rules/primitives/syntax.py +200 -0
- sources/rules/primitives/text.py +408 -0
- sources/rules/primitives/tokens.py +84 -0
- sources/rules/template.py +138 -0
- sources/selftest/__init__.py +0 -0
- sources/selftest/cases.py +292 -0
- sources/services.py +90 -0
- sources/subcommands/__init__.py +0 -0
- sources/subcommands/base.py +45 -0
- sources/subcommands/check/__init__.py +0 -0
- sources/subcommands/check/command.py +45 -0
- sources/subcommands/check/fixing.py +224 -0
- sources/subcommands/check/handler.py +757 -0
- sources/subcommands/info/__init__.py +0 -0
- sources/subcommands/info/command.py +45 -0
- sources/subcommands/info/handler.py +527 -0
- sources/subcommands/registry.py +37 -0
- sources/subcommands/rule/__init__.py +0 -0
- sources/subcommands/rule/command.py +45 -0
- sources/subcommands/rule/handler.py +1067 -0
- sources/subcommands/rule/render.py +273 -0
- sources/subcommands/runner.py +124 -0
- sources/subcommands/test/__init__.py +0 -0
- sources/subcommands/test/command.py +45 -0
- sources/subcommands/test/handler.py +166 -0
- sources/subcommands/test/render.py +219 -0
- sources/subcommands/test/runner.py +430 -0
- sources/subcommands/update/__init__.py +0 -0
- sources/subcommands/update/command.py +45 -0
- sources/subcommands/update/handler.py +408 -0
- sources/utils/__init__.py +0 -0
- sources/utils/build_info.py +188 -0
- sources/utils/git.py +73 -0
- sources/utils/globs.py +98 -0
- sources/utils/logging.py +154 -0
- sources/utils/schema.py +77 -0
- sources/utils/versions.py +87 -0
sources/enums.py
ADDED
|
@@ -0,0 +1,838 @@
|
|
|
1
|
+
from enum import Enum, IntEnum, StrEnum, auto
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ExitCode(IntEnum):
|
|
5
|
+
"""
|
|
6
|
+
Process exit codes returned by JCCS (see devs/plans/02-cli-specification.md, section 8).
|
|
7
|
+
(IntEnum)
|
|
8
|
+
|
|
9
|
+
Attributes
|
|
10
|
+
----------
|
|
11
|
+
OK : int
|
|
12
|
+
Run completed and nothing blocking was found.
|
|
13
|
+
INTERNAL : int
|
|
14
|
+
Unexpected internal failure (bug in JCCS or in a flag/rule definition).
|
|
15
|
+
USAGE : int
|
|
16
|
+
Invalid command line (unknown flag, bad value, conflicting flags...).
|
|
17
|
+
CONFIG : int
|
|
18
|
+
Invalid configuration or rule file content.
|
|
19
|
+
ENVIRONMENT : int
|
|
20
|
+
Environment problem (filesystem, git, network, missing dependency).
|
|
21
|
+
TIMEOUT : int
|
|
22
|
+
The run exceeded its time budget.
|
|
23
|
+
UPDATE_AVAILABLE : int
|
|
24
|
+
`update --check` found a newer version.
|
|
25
|
+
FINDINGS : int
|
|
26
|
+
Coding style violations were found (Epitech convention).
|
|
27
|
+
INTERRUPTED : int
|
|
28
|
+
The run was interrupted by the user (SIGINT).
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
# Run completed and nothing blocking was found.
|
|
32
|
+
OK = 0
|
|
33
|
+
# Unexpected internal failure.
|
|
34
|
+
INTERNAL = 1
|
|
35
|
+
# Invalid command line.
|
|
36
|
+
USAGE = 2
|
|
37
|
+
# Invalid configuration or rule file content.
|
|
38
|
+
CONFIG = 3
|
|
39
|
+
# Environment problem (filesystem, git, network, dependency).
|
|
40
|
+
ENVIRONMENT = 4
|
|
41
|
+
# Time budget exceeded.
|
|
42
|
+
TIMEOUT = 5
|
|
43
|
+
# `update --check`: a newer version is available (range 10-19: command-specific informational statuses).
|
|
44
|
+
UPDATE_AVAILABLE = 10
|
|
45
|
+
# Coding style violations found (Epitech convention).
|
|
46
|
+
FINDINGS = 84
|
|
47
|
+
# Interrupted by the user (128 + SIGINT).
|
|
48
|
+
INTERRUPTED = 130
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class RepeatPolicy(Enum):
|
|
52
|
+
"""
|
|
53
|
+
Behaviour of a flag when it appears more than once on the command line.
|
|
54
|
+
(Enum)
|
|
55
|
+
|
|
56
|
+
Attributes
|
|
57
|
+
----------
|
|
58
|
+
FORBID : RepeatPolicy
|
|
59
|
+
A second occurrence is a usage error.
|
|
60
|
+
LAST_WINS : RepeatPolicy
|
|
61
|
+
Each occurrence replaces the previous value.
|
|
62
|
+
ACCUMULATE : RepeatPolicy
|
|
63
|
+
Values of every occurrence are collected into one tuple (not allowed for switches).
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
# A second occurrence is a usage error.
|
|
67
|
+
FORBID = auto()
|
|
68
|
+
# Each occurrence replaces the previous value.
|
|
69
|
+
LAST_WINS = auto()
|
|
70
|
+
# Values of every occurrence are collected into one tuple.
|
|
71
|
+
ACCUMULATE = auto()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class OutputFormat(StrEnum):
|
|
75
|
+
"""
|
|
76
|
+
Report formats available for `check --format`.
|
|
77
|
+
(StrEnum)
|
|
78
|
+
|
|
79
|
+
Attributes
|
|
80
|
+
----------
|
|
81
|
+
TEXT : str
|
|
82
|
+
Human-readable terminal output.
|
|
83
|
+
JSON : str
|
|
84
|
+
JSON report (contract v1, plan 08).
|
|
85
|
+
JUNIT : str
|
|
86
|
+
JUnit XML report.
|
|
87
|
+
SARIF : str
|
|
88
|
+
SARIF 2.1.0 report.
|
|
89
|
+
GITHUB : str
|
|
90
|
+
GitHub Actions workflow annotations.
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
# Human-readable terminal output.
|
|
94
|
+
TEXT = "text"
|
|
95
|
+
# JSON report.
|
|
96
|
+
JSON = "json"
|
|
97
|
+
# JUnit XML report.
|
|
98
|
+
JUNIT = "junit"
|
|
99
|
+
# SARIF 2.1.0 report.
|
|
100
|
+
SARIF = "sarif"
|
|
101
|
+
# GitHub Actions workflow annotations.
|
|
102
|
+
GITHUB = "github"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class ReportFormat(StrEnum):
|
|
106
|
+
"""
|
|
107
|
+
Formats of the report artifacts written by `check --report [FORMAT:]PATH` (every `--format` value, plus
|
|
108
|
+
the HTML page, plan 08 section 6).
|
|
109
|
+
(StrEnum)
|
|
110
|
+
|
|
111
|
+
Attributes
|
|
112
|
+
----------
|
|
113
|
+
TEXT : str
|
|
114
|
+
Flat text lines.
|
|
115
|
+
JSON : str
|
|
116
|
+
JSON report (contract v1).
|
|
117
|
+
JUNIT : str
|
|
118
|
+
JUnit XML report.
|
|
119
|
+
SARIF : str
|
|
120
|
+
SARIF 2.1.0 report.
|
|
121
|
+
GITHUB : str
|
|
122
|
+
GitHub Actions workflow annotations.
|
|
123
|
+
HTML : str
|
|
124
|
+
Self-contained HTML page.
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
# Flat text lines.
|
|
128
|
+
TEXT = "text"
|
|
129
|
+
# JSON report.
|
|
130
|
+
JSON = "json"
|
|
131
|
+
# JUnit XML report.
|
|
132
|
+
JUNIT = "junit"
|
|
133
|
+
# SARIF 2.1.0 report.
|
|
134
|
+
SARIF = "sarif"
|
|
135
|
+
# GitHub Actions workflow annotations.
|
|
136
|
+
GITHUB = "github"
|
|
137
|
+
# Self-contained HTML page.
|
|
138
|
+
HTML = "html"
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class SelfTestFormat(StrEnum):
|
|
142
|
+
"""
|
|
143
|
+
Report formats available for `test --format`.
|
|
144
|
+
(StrEnum)
|
|
145
|
+
|
|
146
|
+
Attributes
|
|
147
|
+
----------
|
|
148
|
+
TEXT : str
|
|
149
|
+
Human-readable terminal output.
|
|
150
|
+
JSON : str
|
|
151
|
+
JSON report.
|
|
152
|
+
JUNIT : str
|
|
153
|
+
JUnit XML report.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
# Human-readable terminal output.
|
|
157
|
+
TEXT = "text"
|
|
158
|
+
# JSON report.
|
|
159
|
+
JSON = "json"
|
|
160
|
+
# JUnit XML report.
|
|
161
|
+
JUNIT = "junit"
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class Shell(StrEnum):
|
|
165
|
+
"""
|
|
166
|
+
Shells supported by `--completion`.
|
|
167
|
+
(StrEnum)
|
|
168
|
+
|
|
169
|
+
Attributes
|
|
170
|
+
----------
|
|
171
|
+
BASH : str
|
|
172
|
+
GNU Bash.
|
|
173
|
+
ZSH : str
|
|
174
|
+
Z shell.
|
|
175
|
+
FISH : str
|
|
176
|
+
Fish shell.
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
# GNU Bash.
|
|
180
|
+
BASH = "bash"
|
|
181
|
+
# Z shell.
|
|
182
|
+
ZSH = "zsh"
|
|
183
|
+
# Fish shell.
|
|
184
|
+
FISH = "fish"
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class SeverityLevel(StrEnum):
|
|
188
|
+
"""
|
|
189
|
+
Diagnostic severity levels, from least to most severe (plan 03, section 4).
|
|
190
|
+
(StrEnum)
|
|
191
|
+
|
|
192
|
+
Attributes
|
|
193
|
+
----------
|
|
194
|
+
INFO : str
|
|
195
|
+
Advisory, never fails by default.
|
|
196
|
+
MINOR : str
|
|
197
|
+
Style deviation.
|
|
198
|
+
MAJOR : str
|
|
199
|
+
Clear violation of a mandatory rule.
|
|
200
|
+
FATAL : str
|
|
201
|
+
Hard constraint, or the code cannot be meaningfully checked.
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
# Advisory, never fails by default.
|
|
205
|
+
INFO = "info"
|
|
206
|
+
# Style deviation.
|
|
207
|
+
MINOR = "minor"
|
|
208
|
+
# Clear violation of a mandatory rule.
|
|
209
|
+
MAJOR = "major"
|
|
210
|
+
# Hard constraint, or the code cannot be meaningfully checked.
|
|
211
|
+
FATAL = "fatal"
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class UpdateChannel(StrEnum):
|
|
215
|
+
"""
|
|
216
|
+
Release channels available for `update --channel`.
|
|
217
|
+
(StrEnum)
|
|
218
|
+
|
|
219
|
+
Attributes
|
|
220
|
+
----------
|
|
221
|
+
STABLE : str
|
|
222
|
+
Stable releases only.
|
|
223
|
+
BETA : str
|
|
224
|
+
Pre-releases included.
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
# Stable releases only.
|
|
228
|
+
STABLE = "stable"
|
|
229
|
+
# Pre-releases included.
|
|
230
|
+
BETA = "beta"
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class FileKind(StrEnum):
|
|
234
|
+
"""
|
|
235
|
+
Kind of a project file, used by `applies_to` and `where.file_kind` (plan 03, section 6.2).
|
|
236
|
+
(StrEnum)
|
|
237
|
+
|
|
238
|
+
Attributes
|
|
239
|
+
----------
|
|
240
|
+
C : str
|
|
241
|
+
C source file (`.c`).
|
|
242
|
+
H : str
|
|
243
|
+
C header file (`.h`).
|
|
244
|
+
MAKE : str
|
|
245
|
+
Makefile (`Makefile`, `makefile`, `GNUmakefile`, `*.mk`).
|
|
246
|
+
OTHER : str
|
|
247
|
+
Any other file of the repository.
|
|
248
|
+
"""
|
|
249
|
+
|
|
250
|
+
# C source file.
|
|
251
|
+
C = "c"
|
|
252
|
+
# C header file.
|
|
253
|
+
H = "h"
|
|
254
|
+
# Makefile.
|
|
255
|
+
MAKE = "make"
|
|
256
|
+
# Any other file of the repository.
|
|
257
|
+
OTHER = "other"
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class Layer(IntEnum):
|
|
261
|
+
"""
|
|
262
|
+
Analysis layers, ordered from the cheapest to the most expensive (plan 03, section 7.1).
|
|
263
|
+
(IntEnum)
|
|
264
|
+
|
|
265
|
+
Attributes
|
|
266
|
+
----------
|
|
267
|
+
REPOSITORY : int
|
|
268
|
+
File list, names and raw content.
|
|
269
|
+
TEXT : int
|
|
270
|
+
Decoded text and physical lines.
|
|
271
|
+
TOKENS : int
|
|
272
|
+
Lossless token stream and preprocessor directives.
|
|
273
|
+
SYNTAX : int
|
|
274
|
+
Syntax tree of each C/H file.
|
|
275
|
+
PROJECT : int
|
|
276
|
+
Cross-file facts (symbols, calls, typedefs, include graph).
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
# File list, names and raw content.
|
|
280
|
+
REPOSITORY = 0
|
|
281
|
+
# Decoded text and physical lines.
|
|
282
|
+
TEXT = 1
|
|
283
|
+
# Lossless token stream and preprocessor directives.
|
|
284
|
+
TOKENS = 2
|
|
285
|
+
# Syntax tree of each C/H file.
|
|
286
|
+
SYNTAX = 3
|
|
287
|
+
# Cross-file facts.
|
|
288
|
+
PROJECT = 4
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
class TokenKind(StrEnum):
|
|
292
|
+
"""
|
|
293
|
+
Kinds of the tokens produced by the lexer (plan 04, section 8).
|
|
294
|
+
(StrEnum)
|
|
295
|
+
|
|
296
|
+
Attributes
|
|
297
|
+
----------
|
|
298
|
+
IDENTIFIER : str
|
|
299
|
+
Identifier (including names that are not C keywords, such as `asm`).
|
|
300
|
+
KEYWORD : str
|
|
301
|
+
C keyword.
|
|
302
|
+
NUMBER : str
|
|
303
|
+
Preprocessing number.
|
|
304
|
+
STRING : str
|
|
305
|
+
String literal, with its optional encoding prefix.
|
|
306
|
+
CHAR : str
|
|
307
|
+
Character constant, with its optional encoding prefix.
|
|
308
|
+
PUNCTUATOR : str
|
|
309
|
+
Operator or punctuator.
|
|
310
|
+
WHITESPACE : str
|
|
311
|
+
Spaces, tabs, form feeds and vertical tabs.
|
|
312
|
+
NEWLINE : str
|
|
313
|
+
End of a physical line (`\\n`, `\\r\\n` or `\\r`).
|
|
314
|
+
COMMENT : str
|
|
315
|
+
Line or block comment.
|
|
316
|
+
DIRECTIVE : str
|
|
317
|
+
`#` followed by the directive name, e.g. `#include`.
|
|
318
|
+
HEADER_NAME : str
|
|
319
|
+
`<...>` operand of an `#include` directive.
|
|
320
|
+
LINE_SPLICE : str
|
|
321
|
+
Backslash immediately followed by a newline.
|
|
322
|
+
UNKNOWN : str
|
|
323
|
+
Character that starts no valid token.
|
|
324
|
+
"""
|
|
325
|
+
|
|
326
|
+
# Identifier.
|
|
327
|
+
IDENTIFIER = "identifier"
|
|
328
|
+
# C keyword.
|
|
329
|
+
KEYWORD = "keyword"
|
|
330
|
+
# Preprocessing number.
|
|
331
|
+
NUMBER = "number"
|
|
332
|
+
# String literal.
|
|
333
|
+
STRING = "string"
|
|
334
|
+
# Character constant.
|
|
335
|
+
CHAR = "char"
|
|
336
|
+
# Operator or punctuator.
|
|
337
|
+
PUNCTUATOR = "punctuator"
|
|
338
|
+
# Spaces, tabs, form feeds and vertical tabs.
|
|
339
|
+
WHITESPACE = "whitespace"
|
|
340
|
+
# End of a physical line.
|
|
341
|
+
NEWLINE = "newline"
|
|
342
|
+
# Line or block comment.
|
|
343
|
+
COMMENT = "comment"
|
|
344
|
+
# `#` followed by the directive name.
|
|
345
|
+
DIRECTIVE = "directive"
|
|
346
|
+
# `<...>` operand of an `#include` directive.
|
|
347
|
+
HEADER_NAME = "header_name"
|
|
348
|
+
# Backslash immediately followed by a newline.
|
|
349
|
+
LINE_SPLICE = "line_splice"
|
|
350
|
+
# Character that starts no valid token.
|
|
351
|
+
UNKNOWN = "unknown"
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
class NodeKind(StrEnum):
|
|
355
|
+
"""
|
|
356
|
+
Kinds of the syntax tree nodes built by the parser. Their values are the names used in rule files
|
|
357
|
+
(`target`, `where.node`, `count:<node>`).
|
|
358
|
+
(StrEnum)
|
|
359
|
+
|
|
360
|
+
Attributes
|
|
361
|
+
----------
|
|
362
|
+
TRANSLATION_UNIT : str
|
|
363
|
+
Root node of a file.
|
|
364
|
+
FUNCTION_DEFINITION : str
|
|
365
|
+
Function with a body.
|
|
366
|
+
DECLARATION : str
|
|
367
|
+
Declaration of variables or function prototypes.
|
|
368
|
+
TYPE_DEFINITION : str
|
|
369
|
+
`typedef` declaration.
|
|
370
|
+
DECLARATOR : str
|
|
371
|
+
Declarator of a variable, a field or a type name.
|
|
372
|
+
FUNCTION_DECLARATOR : str
|
|
373
|
+
Declarator with a parameter list.
|
|
374
|
+
INIT_DECLARATOR : str
|
|
375
|
+
Declarator followed by `=` and an initialiser.
|
|
376
|
+
PARAMETER_LIST : str
|
|
377
|
+
Parenthesised parameters of a function declarator.
|
|
378
|
+
PARAMETER : str
|
|
379
|
+
One parameter of a function declarator.
|
|
380
|
+
STRUCT_SPECIFIER : str
|
|
381
|
+
`struct` type, with or without a body.
|
|
382
|
+
UNION_SPECIFIER : str
|
|
383
|
+
`union` type, with or without a body.
|
|
384
|
+
ENUM_SPECIFIER : str
|
|
385
|
+
`enum` type, with or without a body.
|
|
386
|
+
FIELD_DECLARATION : str
|
|
387
|
+
Declaration inside a struct or union body.
|
|
388
|
+
ENUMERATOR : str
|
|
389
|
+
Member of an enum body.
|
|
390
|
+
TYPE_NAME : str
|
|
391
|
+
Abstract type in a cast, `sizeof` or compound literal.
|
|
392
|
+
COMPOUND_STATEMENT : str
|
|
393
|
+
Block between braces.
|
|
394
|
+
IF_STATEMENT : str
|
|
395
|
+
`if` statement (an `else if` is an `if_statement` nested in the `else` branch).
|
|
396
|
+
FOR_STATEMENT : str
|
|
397
|
+
`for` loop.
|
|
398
|
+
WHILE_STATEMENT : str
|
|
399
|
+
`while` loop.
|
|
400
|
+
DO_STATEMENT : str
|
|
401
|
+
`do ... while` loop.
|
|
402
|
+
SWITCH_STATEMENT : str
|
|
403
|
+
`switch` statement.
|
|
404
|
+
CASE_STATEMENT : str
|
|
405
|
+
`case` or `default` label with its statement.
|
|
406
|
+
LABELED_STATEMENT : str
|
|
407
|
+
`label:` with its statement.
|
|
408
|
+
RETURN_STATEMENT : str
|
|
409
|
+
`return` statement.
|
|
410
|
+
BREAK_STATEMENT : str
|
|
411
|
+
`break` statement.
|
|
412
|
+
CONTINUE_STATEMENT : str
|
|
413
|
+
`continue` statement.
|
|
414
|
+
GOTO_STATEMENT : str
|
|
415
|
+
`goto` statement.
|
|
416
|
+
EXPRESSION_STATEMENT : str
|
|
417
|
+
Expression followed by `;` (or a lone `;`).
|
|
418
|
+
CONDITION : str
|
|
419
|
+
Wrapper of the controlling expression of `if`, `while`, `do`, `switch` and of the `for` condition.
|
|
420
|
+
FOR_INIT : str
|
|
421
|
+
Wrapper of the first part of a `for` header.
|
|
422
|
+
FOR_UPDATE : str
|
|
423
|
+
Wrapper of the third part of a `for` header.
|
|
424
|
+
ASSIGNMENT_EXPRESSION : str
|
|
425
|
+
`=` or compound assignment.
|
|
426
|
+
CONDITIONAL_EXPRESSION : str
|
|
427
|
+
Ternary `a ? b : c`.
|
|
428
|
+
LOGICAL_EXPRESSION : str
|
|
429
|
+
`&&` or `||`.
|
|
430
|
+
BINARY_EXPRESSION : str
|
|
431
|
+
Any other binary operator.
|
|
432
|
+
UNARY_EXPRESSION : str
|
|
433
|
+
Prefix `! ~ - + & *`.
|
|
434
|
+
UPDATE_EXPRESSION : str
|
|
435
|
+
Prefix or postfix `++` / `--`.
|
|
436
|
+
CAST_EXPRESSION : str
|
|
437
|
+
`(type) value`.
|
|
438
|
+
SIZEOF_EXPRESSION : str
|
|
439
|
+
`sizeof` or `_Alignof` expression.
|
|
440
|
+
CALL_EXPRESSION : str
|
|
441
|
+
Function call.
|
|
442
|
+
SUBSCRIPT_EXPRESSION : str
|
|
443
|
+
`a[i]`.
|
|
444
|
+
MEMBER_EXPRESSION : str
|
|
445
|
+
`a.b` or `a->b`.
|
|
446
|
+
COMMA_EXPRESSION : str
|
|
447
|
+
Comma operator.
|
|
448
|
+
PARENTHESIZED_EXPRESSION : str
|
|
449
|
+
Expression between parentheses.
|
|
450
|
+
COMPOUND_LITERAL : str
|
|
451
|
+
`(type){...}`.
|
|
452
|
+
INITIALIZER_LIST : str
|
|
453
|
+
Braced initialiser.
|
|
454
|
+
IDENTIFIER : str
|
|
455
|
+
Name used in an expression.
|
|
456
|
+
NUMBER_LITERAL : str
|
|
457
|
+
Number constant.
|
|
458
|
+
STRING_LITERAL : str
|
|
459
|
+
One or several adjacent string literals.
|
|
460
|
+
CHAR_LITERAL : str
|
|
461
|
+
Character constant.
|
|
462
|
+
ERROR : str
|
|
463
|
+
Region the parser could not understand (skipped by syntax checks).
|
|
464
|
+
"""
|
|
465
|
+
|
|
466
|
+
# Root node of a file.
|
|
467
|
+
TRANSLATION_UNIT = "translation_unit"
|
|
468
|
+
# Function with a body.
|
|
469
|
+
FUNCTION_DEFINITION = "function_definition"
|
|
470
|
+
# Declaration of variables or function prototypes.
|
|
471
|
+
DECLARATION = "declaration"
|
|
472
|
+
# `typedef` declaration.
|
|
473
|
+
TYPE_DEFINITION = "type_definition"
|
|
474
|
+
# Declarator of a variable, a field or a type name.
|
|
475
|
+
DECLARATOR = "declarator"
|
|
476
|
+
# Declarator with a parameter list.
|
|
477
|
+
FUNCTION_DECLARATOR = "function_declarator"
|
|
478
|
+
# Declarator followed by an initialiser.
|
|
479
|
+
INIT_DECLARATOR = "init_declarator"
|
|
480
|
+
# Parenthesised parameters of a function declarator.
|
|
481
|
+
PARAMETER_LIST = "parameter_list"
|
|
482
|
+
# One parameter of a function declarator.
|
|
483
|
+
PARAMETER = "parameter"
|
|
484
|
+
# `struct` type.
|
|
485
|
+
STRUCT_SPECIFIER = "struct_specifier"
|
|
486
|
+
# `union` type.
|
|
487
|
+
UNION_SPECIFIER = "union_specifier"
|
|
488
|
+
# `enum` type.
|
|
489
|
+
ENUM_SPECIFIER = "enum_specifier"
|
|
490
|
+
# Declaration inside a struct or union body.
|
|
491
|
+
FIELD_DECLARATION = "field_declaration"
|
|
492
|
+
# Member of an enum body.
|
|
493
|
+
ENUMERATOR = "enumerator"
|
|
494
|
+
# Abstract type in a cast, `sizeof` or compound literal.
|
|
495
|
+
TYPE_NAME = "type_name"
|
|
496
|
+
# Block between braces.
|
|
497
|
+
COMPOUND_STATEMENT = "compound_statement"
|
|
498
|
+
# `if` statement.
|
|
499
|
+
IF_STATEMENT = "if_statement"
|
|
500
|
+
# `for` loop.
|
|
501
|
+
FOR_STATEMENT = "for_statement"
|
|
502
|
+
# `while` loop.
|
|
503
|
+
WHILE_STATEMENT = "while_statement"
|
|
504
|
+
# `do ... while` loop.
|
|
505
|
+
DO_STATEMENT = "do_statement"
|
|
506
|
+
# `switch` statement.
|
|
507
|
+
SWITCH_STATEMENT = "switch_statement"
|
|
508
|
+
# `case` or `default` label with its statement.
|
|
509
|
+
CASE_STATEMENT = "case_statement"
|
|
510
|
+
# `label:` with its statement.
|
|
511
|
+
LABELED_STATEMENT = "labeled_statement"
|
|
512
|
+
# `return` statement.
|
|
513
|
+
RETURN_STATEMENT = "return_statement"
|
|
514
|
+
# `break` statement.
|
|
515
|
+
BREAK_STATEMENT = "break_statement"
|
|
516
|
+
# `continue` statement.
|
|
517
|
+
CONTINUE_STATEMENT = "continue_statement"
|
|
518
|
+
# `goto` statement.
|
|
519
|
+
GOTO_STATEMENT = "goto_statement"
|
|
520
|
+
# Expression followed by `;`.
|
|
521
|
+
EXPRESSION_STATEMENT = "expression_statement"
|
|
522
|
+
# Controlling expression of a control statement.
|
|
523
|
+
CONDITION = "condition"
|
|
524
|
+
# First part of a `for` header.
|
|
525
|
+
FOR_INIT = "for_init"
|
|
526
|
+
# Third part of a `for` header.
|
|
527
|
+
FOR_UPDATE = "for_update"
|
|
528
|
+
# Assignment.
|
|
529
|
+
ASSIGNMENT_EXPRESSION = "assignment_expression"
|
|
530
|
+
# Ternary operator.
|
|
531
|
+
CONDITIONAL_EXPRESSION = "conditional_expression"
|
|
532
|
+
# `&&` or `||`.
|
|
533
|
+
LOGICAL_EXPRESSION = "logical_expression"
|
|
534
|
+
# Any other binary operator.
|
|
535
|
+
BINARY_EXPRESSION = "binary_expression"
|
|
536
|
+
# Prefix unary operator.
|
|
537
|
+
UNARY_EXPRESSION = "unary_expression"
|
|
538
|
+
# `++` / `--`.
|
|
539
|
+
UPDATE_EXPRESSION = "update_expression"
|
|
540
|
+
# Cast.
|
|
541
|
+
CAST_EXPRESSION = "cast_expression"
|
|
542
|
+
# `sizeof` or `_Alignof`.
|
|
543
|
+
SIZEOF_EXPRESSION = "sizeof_expression"
|
|
544
|
+
# Function call.
|
|
545
|
+
CALL_EXPRESSION = "call_expression"
|
|
546
|
+
# `a[i]`.
|
|
547
|
+
SUBSCRIPT_EXPRESSION = "subscript_expression"
|
|
548
|
+
# `a.b` or `a->b`.
|
|
549
|
+
MEMBER_EXPRESSION = "member_expression"
|
|
550
|
+
# Comma operator.
|
|
551
|
+
COMMA_EXPRESSION = "comma_expression"
|
|
552
|
+
# Expression between parentheses.
|
|
553
|
+
PARENTHESIZED_EXPRESSION = "parenthesized_expression"
|
|
554
|
+
# `(type){...}`.
|
|
555
|
+
COMPOUND_LITERAL = "compound_literal"
|
|
556
|
+
# Braced initialiser.
|
|
557
|
+
INITIALIZER_LIST = "initializer_list"
|
|
558
|
+
# Name used in an expression.
|
|
559
|
+
IDENTIFIER = "identifier"
|
|
560
|
+
# Number constant.
|
|
561
|
+
NUMBER_LITERAL = "number_literal"
|
|
562
|
+
# String literal(s).
|
|
563
|
+
STRING_LITERAL = "string_literal"
|
|
564
|
+
# Character constant.
|
|
565
|
+
CHAR_LITERAL = "char_literal"
|
|
566
|
+
# Region the parser could not understand.
|
|
567
|
+
ERROR = "error"
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
class CodeContext(StrEnum):
|
|
571
|
+
"""
|
|
572
|
+
Contexts a token or a node can be in, used by `where.context` / `where.not_context` (plan 03, section 6.2).
|
|
573
|
+
(StrEnum)
|
|
574
|
+
|
|
575
|
+
Attributes
|
|
576
|
+
----------
|
|
577
|
+
FILE_SCOPE : str
|
|
578
|
+
Outside any function body.
|
|
579
|
+
FUNCTION_BODY : str
|
|
580
|
+
Inside the braces of a function definition.
|
|
581
|
+
FUNCTION_HEADER : str
|
|
582
|
+
Return type, name and parameters of a function definition.
|
|
583
|
+
CONTROL_HEADER : str
|
|
584
|
+
Parenthesised header of `if`, `while`, `do`, `switch` or `for`.
|
|
585
|
+
FOR_HEADER : str
|
|
586
|
+
Parenthesised header of a `for` loop.
|
|
587
|
+
CONDITION : str
|
|
588
|
+
Controlling expression of a control statement.
|
|
589
|
+
PREPROCESSOR : str
|
|
590
|
+
Line of a preprocessor directive (including continuation lines).
|
|
591
|
+
MACRO_BODY : str
|
|
592
|
+
Replacement list of a `#define`.
|
|
593
|
+
COMMENT : str
|
|
594
|
+
Inside a comment.
|
|
595
|
+
STRING : str
|
|
596
|
+
Inside a string or character literal.
|
|
597
|
+
"""
|
|
598
|
+
|
|
599
|
+
# Outside any function body.
|
|
600
|
+
FILE_SCOPE = "file_scope"
|
|
601
|
+
# Inside the braces of a function definition.
|
|
602
|
+
FUNCTION_BODY = "function_body"
|
|
603
|
+
# Return type, name and parameters of a function definition.
|
|
604
|
+
FUNCTION_HEADER = "function_header"
|
|
605
|
+
# Parenthesised header of a control statement.
|
|
606
|
+
CONTROL_HEADER = "control_header"
|
|
607
|
+
# Parenthesised header of a `for` loop.
|
|
608
|
+
FOR_HEADER = "for_header"
|
|
609
|
+
# Controlling expression of a control statement.
|
|
610
|
+
CONDITION = "condition"
|
|
611
|
+
# Line of a preprocessor directive.
|
|
612
|
+
PREPROCESSOR = "preprocessor"
|
|
613
|
+
# Replacement list of a `#define`.
|
|
614
|
+
MACRO_BODY = "macro_body"
|
|
615
|
+
# Inside a comment.
|
|
616
|
+
COMMENT = "comment"
|
|
617
|
+
# Inside a string or character literal.
|
|
618
|
+
STRING = "string"
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
class StorageFilter(StrEnum):
|
|
622
|
+
"""
|
|
623
|
+
Values accepted by `where.storage` (plan 03, section 6.2).
|
|
624
|
+
(StrEnum)
|
|
625
|
+
|
|
626
|
+
Attributes
|
|
627
|
+
----------
|
|
628
|
+
STATIC : str
|
|
629
|
+
Declared `static`.
|
|
630
|
+
EXTERN : str
|
|
631
|
+
Declared `extern`.
|
|
632
|
+
NONE : str
|
|
633
|
+
No storage class specifier.
|
|
634
|
+
NOT_STATIC : str
|
|
635
|
+
Anything but `static`.
|
|
636
|
+
"""
|
|
637
|
+
|
|
638
|
+
# Declared `static`.
|
|
639
|
+
STATIC = "static"
|
|
640
|
+
# Declared `extern`.
|
|
641
|
+
EXTERN = "extern"
|
|
642
|
+
# No storage class specifier.
|
|
643
|
+
NONE = "none"
|
|
644
|
+
# Anything but `static`.
|
|
645
|
+
NOT_STATIC = "not static"
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
class Detection(StrEnum):
|
|
649
|
+
"""
|
|
650
|
+
How reliable a check is (plan 03, section 3.4, RULE-13).
|
|
651
|
+
(StrEnum)
|
|
652
|
+
|
|
653
|
+
Attributes
|
|
654
|
+
----------
|
|
655
|
+
AUTOMATIC : str
|
|
656
|
+
Decidable from the source; normal diagnostic.
|
|
657
|
+
HEURISTIC : str
|
|
658
|
+
Approximation; diagnostic flagged `review`, counts only with strict heuristics.
|
|
659
|
+
MANUAL : str
|
|
660
|
+
Not decidable; review item that never counts toward failure.
|
|
661
|
+
"""
|
|
662
|
+
|
|
663
|
+
# Decidable from the source.
|
|
664
|
+
AUTOMATIC = "automatic"
|
|
665
|
+
# Approximation of a semantic rule.
|
|
666
|
+
HEURISTIC = "heuristic"
|
|
667
|
+
# Not decidable.
|
|
668
|
+
MANUAL = "manual"
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
class RuleStatus(StrEnum):
|
|
672
|
+
"""
|
|
673
|
+
Lifecycle status of a rule (plan 03, section 13).
|
|
674
|
+
(StrEnum)
|
|
675
|
+
|
|
676
|
+
Attributes
|
|
677
|
+
----------
|
|
678
|
+
PREVIEW : str
|
|
679
|
+
New rule, active only when explicitly selected.
|
|
680
|
+
STABLE : str
|
|
681
|
+
Rule active by default.
|
|
682
|
+
DEPRECATED : str
|
|
683
|
+
Rule kept for compatibility, active by default.
|
|
684
|
+
"""
|
|
685
|
+
|
|
686
|
+
# New rule, active only when explicitly selected.
|
|
687
|
+
PREVIEW = "preview"
|
|
688
|
+
# Rule active by default.
|
|
689
|
+
STABLE = "stable"
|
|
690
|
+
# Rule kept for compatibility.
|
|
691
|
+
DEPRECATED = "deprecated"
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
class ReportMode(StrEnum):
|
|
695
|
+
"""
|
|
696
|
+
Granularity of the findings of a check (plan 03, RULE-17).
|
|
697
|
+
(StrEnum)
|
|
698
|
+
|
|
699
|
+
Attributes
|
|
700
|
+
----------
|
|
701
|
+
EACH : str
|
|
702
|
+
Every finding is reported.
|
|
703
|
+
ONCE_PER_LINE : str
|
|
704
|
+
At most one finding per line.
|
|
705
|
+
ONCE_PER_NODE : str
|
|
706
|
+
At most one finding per syntax node.
|
|
707
|
+
ONCE_PER_FILE : str
|
|
708
|
+
At most one finding per file.
|
|
709
|
+
"""
|
|
710
|
+
|
|
711
|
+
# Every finding is reported.
|
|
712
|
+
EACH = "each"
|
|
713
|
+
# At most one finding per line.
|
|
714
|
+
ONCE_PER_LINE = "once_per_line"
|
|
715
|
+
# At most one finding per syntax node.
|
|
716
|
+
ONCE_PER_NODE = "once_per_node"
|
|
717
|
+
# At most one finding per file.
|
|
718
|
+
ONCE_PER_FILE = "once_per_file"
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
class FixApplicability(StrEnum):
|
|
722
|
+
"""
|
|
723
|
+
Whether a check offers an automatic fix (plan 07).
|
|
724
|
+
(StrEnum)
|
|
725
|
+
|
|
726
|
+
Attributes
|
|
727
|
+
----------
|
|
728
|
+
NONE : str
|
|
729
|
+
No fix.
|
|
730
|
+
SAFE : str
|
|
731
|
+
Fix that never changes the behaviour of the program.
|
|
732
|
+
UNSAFE : str
|
|
733
|
+
Fix that needs a human review.
|
|
734
|
+
"""
|
|
735
|
+
|
|
736
|
+
# No fix.
|
|
737
|
+
NONE = "none"
|
|
738
|
+
# Fix that never changes the behaviour of the program.
|
|
739
|
+
SAFE = "safe"
|
|
740
|
+
# Fix that needs a human review.
|
|
741
|
+
UNSAFE = "unsafe"
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
class BananaSupport(StrEnum):
|
|
745
|
+
"""
|
|
746
|
+
How much of an Epitech rule the official checker (Banana) verifies.
|
|
747
|
+
(StrEnum)
|
|
748
|
+
|
|
749
|
+
Attributes
|
|
750
|
+
----------
|
|
751
|
+
FULL : str
|
|
752
|
+
Fully checked.
|
|
753
|
+
PARTIAL : str
|
|
754
|
+
Partially checked.
|
|
755
|
+
NONE : str
|
|
756
|
+
Left to human review.
|
|
757
|
+
"""
|
|
758
|
+
|
|
759
|
+
# Fully checked.
|
|
760
|
+
FULL = "full"
|
|
761
|
+
# Partially checked.
|
|
762
|
+
PARTIAL = "partial"
|
|
763
|
+
# Left to human review.
|
|
764
|
+
NONE = "none"
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
class ArgumentType(StrEnum):
|
|
768
|
+
"""
|
|
769
|
+
Types of rule arguments, check parameters and project config values (plan 03, section 5.4).
|
|
770
|
+
(StrEnum)
|
|
771
|
+
|
|
772
|
+
Attributes
|
|
773
|
+
----------
|
|
774
|
+
INT : str
|
|
775
|
+
Integer, with optional `min` / `max`.
|
|
776
|
+
FLOAT : str
|
|
777
|
+
Real number, with optional `min` / `max`.
|
|
778
|
+
BOOL : str
|
|
779
|
+
`true` or `false`.
|
|
780
|
+
STR : str
|
|
781
|
+
Free text.
|
|
782
|
+
ENUM : str
|
|
783
|
+
One of `choices`.
|
|
784
|
+
REGEX : str
|
|
785
|
+
Regular expression, compiled at load.
|
|
786
|
+
LIST : str
|
|
787
|
+
Comma-separated or one item per line; items typed by `item_type`.
|
|
788
|
+
GLOB : str
|
|
789
|
+
Path pattern.
|
|
790
|
+
PATH : str
|
|
791
|
+
Path relative to the defining file.
|
|
792
|
+
TEMPLATE : str
|
|
793
|
+
`|` lines with `{placeholder}` markers.
|
|
794
|
+
WORD_SET : str
|
|
795
|
+
Inline word list, or `file:<relative path>`.
|
|
796
|
+
"""
|
|
797
|
+
|
|
798
|
+
# Integer.
|
|
799
|
+
INT = "int"
|
|
800
|
+
# Real number.
|
|
801
|
+
FLOAT = "float"
|
|
802
|
+
# `true` or `false`.
|
|
803
|
+
BOOL = "bool"
|
|
804
|
+
# Free text.
|
|
805
|
+
STR = "str"
|
|
806
|
+
# One of `choices`.
|
|
807
|
+
ENUM = "enum"
|
|
808
|
+
# Regular expression.
|
|
809
|
+
REGEX = "regex"
|
|
810
|
+
# List of typed items.
|
|
811
|
+
LIST = "list"
|
|
812
|
+
# Path pattern.
|
|
813
|
+
GLOB = "glob"
|
|
814
|
+
# Path relative to the defining file.
|
|
815
|
+
PATH = "path"
|
|
816
|
+
# Text template with placeholders.
|
|
817
|
+
TEMPLATE = "template"
|
|
818
|
+
# Set of words.
|
|
819
|
+
WORD_SET = "word_set"
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
class ExampleKind(StrEnum):
|
|
823
|
+
"""
|
|
824
|
+
Kinds of rule examples (plan 03, section 5.5).
|
|
825
|
+
(StrEnum)
|
|
826
|
+
|
|
827
|
+
Attributes
|
|
828
|
+
----------
|
|
829
|
+
GOOD : str
|
|
830
|
+
Must produce no diagnostic (review items only).
|
|
831
|
+
BAD : str
|
|
832
|
+
Must produce exactly the `expect` list.
|
|
833
|
+
"""
|
|
834
|
+
|
|
835
|
+
# Must produce no diagnostic.
|
|
836
|
+
GOOD = "good"
|
|
837
|
+
# Must produce exactly the `expect` list.
|
|
838
|
+
BAD = "bad"
|