forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruff.schema.json
4021 lines (4021 loc) · 128 KB
/
ruff.schema.json
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Options",
"type": "object",
"properties": {
"allowed-confusables": {
"description": "A list of allowed \"confusable\" Unicode characters to ignore when enforcing `RUF001`, `RUF002`, and `RUF003`.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"type": "string",
"maxLength": 1,
"minLength": 1
}
},
"builtins": {
"description": "A list of builtins to treat as defined references, in addition to the system builtins.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"cache-dir": {
"description": "A path to the cache directory.\n\nBy default, Ruff stores cache results in a `.ruff_cache` directory in the current project root.\n\nHowever, Ruff will also respect the `RUFF_CACHE_DIR` environment variable, which takes precedence over that default.\n\nThis setting will override even the `RUFF_CACHE_DIR` environment variable, if set.",
"type": [
"string",
"null"
]
},
"dummy-variable-rgx": {
"description": "A regular expression used to identify \"dummy\" variables, or those which should be ignored when enforcing (e.g.) unused-variable rules. The default expression matches `_`, `__`, and `_var`, but not `_var_`.",
"deprecated": true,
"type": [
"string",
"null"
]
},
"exclude": {
"description": "A list of file patterns to exclude from formatting and linting.\n\nExclusions are based on globs, and can be either:\n\n- Single-path patterns, like `.mypy_cache` (to exclude any directory named `.mypy_cache` in the tree), `foo.py` (to exclude any file named `foo.py`), or `foo_*.py` (to exclude any file matching `foo_*.py` ). - Relative patterns, like `directory/foo.py` (to exclude that specific file) or `directory/*.py` (to exclude any Python files in `directory`). Note that these paths are relative to the project root (e.g., the directory containing your `pyproject.toml`).\n\nFor more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).\n\nNote that you'll typically want to use [`extend-exclude`](#extend-exclude) to modify the excluded paths.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"explicit-preview-rules": {
"description": "Whether to require exact codes to select preview rules. When enabled, preview rules will not be selected by prefixes — the full code of each preview rule will be required to enable the rule.",
"deprecated": true,
"type": [
"boolean",
"null"
]
},
"extend": {
"description": "A path to a local `pyproject.toml` file to merge into this configuration. User home directory and environment variables will be expanded.\n\nTo resolve the current `pyproject.toml` file, Ruff will first resolve this base configuration file, then merge in any properties defined in the current configuration file.",
"type": [
"string",
"null"
]
},
"extend-exclude": {
"description": "A list of file patterns to omit from formatting and linting, in addition to those specified by [`exclude`](#exclude).\n\nExclusions are based on globs, and can be either:\n\n- Single-path patterns, like `.mypy_cache` (to exclude any directory named `.mypy_cache` in the tree), `foo.py` (to exclude any file named `foo.py`), or `foo_*.py` (to exclude any file matching `foo_*.py` ). - Relative patterns, like `directory/foo.py` (to exclude that specific file) or `directory/*.py` (to exclude any Python files in `directory`). Note that these paths are relative to the project root (e.g., the directory containing your `pyproject.toml`).\n\nFor more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"extend-fixable": {
"description": "A list of rule codes or prefixes to consider fixable, in addition to those specified by [`fixable`](#lint_fixable).",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"extend-ignore": {
"description": "A list of rule codes or prefixes to ignore, in addition to those specified by `ignore`.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"extend-include": {
"description": "A list of file patterns to include when linting, in addition to those specified by [`include`](#include).\n\nInclusion are based on globs, and should be single-path patterns, like `*.pyw`, to include any file with the `.pyw` extension.\n\nFor more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"extend-per-file-ignores": {
"description": "A list of mappings from file pattern to rule codes or prefixes to exclude, in addition to any rules excluded by [`per-file-ignores`](#lint_per-file-ignores).",
"deprecated": true,
"type": [
"object",
"null"
],
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/RuleSelector"
}
}
},
"extend-safe-fixes": {
"description": "A list of rule codes or prefixes for which unsafe fixes should be considered safe.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"extend-select": {
"description": "A list of rule codes or prefixes to enable, in addition to those specified by [`select`](#lint_select).",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"extend-unfixable": {
"description": "A list of rule codes or prefixes to consider non-auto-fixable, in addition to those specified by [`unfixable`](#lint_unfixable).",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"extend-unsafe-fixes": {
"description": "A list of rule codes or prefixes for which safe fixes should be considered unsafe.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"external": {
"description": "A list of rule codes or prefixes that are unsupported by Ruff, but should be preserved when (e.g.) validating `# noqa` directives. Useful for retaining `# noqa` directives that cover plugins not yet implemented by Ruff.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"fix": {
"description": "Enable fix behavior by-default when running `ruff` (overridden by the `--fix` and `--no-fix` command-line flags). Only includes automatic fixes unless `--unsafe-fixes` is provided.",
"type": [
"boolean",
"null"
]
},
"fix-only": {
"description": "Like [`fix`](#fix), but disables reporting on leftover violation. Implies [`fix`](#fix).",
"type": [
"boolean",
"null"
]
},
"fixable": {
"description": "A list of rule codes or prefixes to consider fixable. By default, all rules are considered fixable.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"flake8-annotations": {
"description": "Options for the `flake8-annotations` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8AnnotationsOptions"
},
{
"type": "null"
}
]
},
"flake8-bandit": {
"description": "Options for the `flake8-bandit` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8BanditOptions"
},
{
"type": "null"
}
]
},
"flake8-boolean-trap": {
"description": "Options for the `flake8-boolean-trap` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8BooleanTrapOptions"
},
{
"type": "null"
}
]
},
"flake8-bugbear": {
"description": "Options for the `flake8-bugbear` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8BugbearOptions"
},
{
"type": "null"
}
]
},
"flake8-builtins": {
"description": "Options for the `flake8-builtins` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8BuiltinsOptions"
},
{
"type": "null"
}
]
},
"flake8-comprehensions": {
"description": "Options for the `flake8-comprehensions` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8ComprehensionsOptions"
},
{
"type": "null"
}
]
},
"flake8-copyright": {
"description": "Options for the `flake8-copyright` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8CopyrightOptions"
},
{
"type": "null"
}
]
},
"flake8-errmsg": {
"description": "Options for the `flake8-errmsg` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8ErrMsgOptions"
},
{
"type": "null"
}
]
},
"flake8-gettext": {
"description": "Options for the `flake8-gettext` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8GetTextOptions"
},
{
"type": "null"
}
]
},
"flake8-implicit-str-concat": {
"description": "Options for the `flake8-implicit-str-concat` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8ImplicitStrConcatOptions"
},
{
"type": "null"
}
]
},
"flake8-import-conventions": {
"description": "Options for the `flake8-import-conventions` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8ImportConventionsOptions"
},
{
"type": "null"
}
]
},
"flake8-pytest-style": {
"description": "Options for the `flake8-pytest-style` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8PytestStyleOptions"
},
{
"type": "null"
}
]
},
"flake8-quotes": {
"description": "Options for the `flake8-quotes` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8QuotesOptions"
},
{
"type": "null"
}
]
},
"flake8-self": {
"description": "Options for the `flake8_self` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8SelfOptions"
},
{
"type": "null"
}
]
},
"flake8-tidy-imports": {
"description": "Options for the `flake8-tidy-imports` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8TidyImportsOptions"
},
{
"type": "null"
}
]
},
"flake8-type-checking": {
"description": "Options for the `flake8-type-checking` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8TypeCheckingOptions"
},
{
"type": "null"
}
]
},
"flake8-unused-arguments": {
"description": "Options for the `flake8-unused-arguments` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Flake8UnusedArgumentsOptions"
},
{
"type": "null"
}
]
},
"force-exclude": {
"description": "Whether to enforce [`exclude`](#exclude) and [`extend-exclude`](#extend-exclude) patterns, even for paths that are passed to Ruff explicitly. Typically, Ruff will lint any paths passed in directly, even if they would typically be excluded. Setting `force-exclude = true` will cause Ruff to respect these exclusions unequivocally.\n\nThis is useful for [`pre-commit`](https://pre-commit.com/), which explicitly passes all changed files to the [`ruff-pre-commit`](https://github.com/astral-sh/ruff-pre-commit) plugin, regardless of whether they're marked as excluded by Ruff's own settings.",
"type": [
"boolean",
"null"
]
},
"format": {
"description": "Options to configure code formatting.",
"anyOf": [
{
"$ref": "#/definitions/FormatOptions"
},
{
"type": "null"
}
]
},
"ignore": {
"description": "A list of rule codes or prefixes to ignore. Prefixes can specify exact rules (like `F841`), entire categories (like `F`), or anything in between.\n\nWhen breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively), more specific prefixes override less specific prefixes.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"ignore-init-module-imports": {
"description": "Avoid automatically removing unused imports in `__init__.py` files. Such imports will still be flagged, but with a dedicated message suggesting that the import is either added to the module's `__all__` symbol, or re-exported with a redundant alias (e.g., `import os as os`).\n\nThis option is enabled by default, but you can opt-in to removal of imports via an unsafe fix.",
"deprecated": true,
"type": [
"boolean",
"null"
]
},
"include": {
"description": "A list of file patterns to include when linting.\n\nInclusion are based on globs, and should be single-path patterns, like `*.pyw`, to include any file with the `.pyw` extension. `pyproject.toml` is included here not for configuration but because we lint whether e.g. the `[project]` matches the schema.\n\nIf [preview](https://docs.astral.sh/ruff/preview/) is enabled, the default includes notebook files (`.ipynb` extension). You can exclude them by adding `*.ipynb` to [`extend-exclude`](#extend-exclude).\n\nFor more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"indent-width": {
"description": "The number of spaces per indentation level (tab).\n\nUsed by the formatter and when enforcing long-line violations (like `E501`) to determine the visual width of a tab.\n\nThis option changes the number of spaces the formatter inserts when using soft-tabs (`indent-style = space`).\n\nPEP 8 recommends using 4 spaces per [indentation level](https://peps.python.org/pep-0008/#indentation).",
"anyOf": [
{
"$ref": "#/definitions/IndentWidth"
},
{
"type": "null"
}
]
},
"isort": {
"description": "Options for the `isort` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/IsortOptions"
},
{
"type": "null"
}
]
},
"line-length": {
"description": "The line length to use when enforcing long-lines violations (like `E501`) and at which `isort` and the formatter prefers to wrap lines.\n\nThe length is determined by the number of characters per line, except for lines containing East Asian characters or emojis. For these lines, the [unicode width](https://unicode.org/reports/tr11/) of each character is added up to determine the length.\n\nThe value must be greater than `0` and less than or equal to `320`.\n\nNote: While the formatter will attempt to format lines such that they remain within the `line-length`, it isn't a hard upper bound, and formatted lines may exceed the `line-length`.\n\nSee [`pycodestyle.max-line-length`](#lint_pycodestyle_max-line-length) to configure different lengths for `E501` and the formatter.",
"anyOf": [
{
"$ref": "#/definitions/LineLength"
},
{
"type": "null"
}
]
},
"lint": {
"anyOf": [
{
"$ref": "#/definitions/LintOptions"
},
{
"type": "null"
}
]
},
"logger-objects": {
"description": "A list of objects that should be treated equivalently to a `logging.Logger` object.\n\nThis is useful for ensuring proper diagnostics (e.g., to identify `logging` deprecations and other best-practices) for projects that re-export a `logging.Logger` object from a common module.\n\nFor example, if you have a module `logging_setup.py` with the following contents: ```python import logging\n\nlogger = logging.getLogger(__name__) ```\n\nAdding `\"logging_setup.logger\"` to `logger-objects` will ensure that `logging_setup.logger` is treated as a `logging.Logger` object when imported from other modules (e.g., `from logging_setup import logger`).",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"mccabe": {
"description": "Options for the `mccabe` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/McCabeOptions"
},
{
"type": "null"
}
]
},
"namespace-packages": {
"description": "Mark the specified directories as namespace packages. For the purpose of module resolution, Ruff will treat those directories and all their subdirectories as if they contained an `__init__.py` file.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"output-format": {
"description": "The style in which violation messages should be formatted: `\"full\"` (default) (shows source), `\"concise\"`, `\"grouped\"` (group messages by file), `\"json\"` (machine-readable), `\"junit\"` (machine-readable XML), `\"github\"` (GitHub Actions annotations), `\"gitlab\"` (GitLab CI code quality report), `\"pylint\"` (Pylint text format) or `\"azure\"` (Azure Pipeline logging commands).",
"anyOf": [
{
"$ref": "#/definitions/OutputFormat"
},
{
"type": "null"
}
]
},
"pep8-naming": {
"description": "Options for the `pep8-naming` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/Pep8NamingOptions"
},
{
"type": "null"
}
]
},
"per-file-ignores": {
"description": "A list of mappings from file pattern to rule codes or prefixes to exclude, when considering any matching files. An initial '!' negates the file pattern.",
"deprecated": true,
"type": [
"object",
"null"
],
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/RuleSelector"
}
}
},
"preview": {
"description": "Whether to enable preview mode. When preview mode is enabled, Ruff will use unstable rules, fixes, and formatting.",
"type": [
"boolean",
"null"
]
},
"pycodestyle": {
"description": "Options for the `pycodestyle` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/PycodestyleOptions"
},
{
"type": "null"
}
]
},
"pydocstyle": {
"description": "Options for the `pydocstyle` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/PydocstyleOptions"
},
{
"type": "null"
}
]
},
"pyflakes": {
"description": "Options for the `pyflakes` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/PyflakesOptions"
},
{
"type": "null"
}
]
},
"pylint": {
"description": "Options for the `pylint` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/PylintOptions"
},
{
"type": "null"
}
]
},
"pyupgrade": {
"description": "Options for the `pyupgrade` plugin.",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/PyUpgradeOptions"
},
{
"type": "null"
}
]
},
"required-version": {
"description": "Enforce a requirement on the version of Ruff, to enforce at runtime. If the version of Ruff does not meet the requirement, Ruff will exit with an error.\n\nUseful for unifying results across many environments, e.g., with a `pyproject.toml` file.\n\nAccepts a [PEP 440](https://peps.python.org/pep-0440/) specifier, like `==0.3.1` or `>=0.3.1`.",
"anyOf": [
{
"$ref": "#/definitions/RequiredVersion"
},
{
"type": "null"
}
]
},
"respect-gitignore": {
"description": "Whether to automatically exclude files that are ignored by `.ignore`, `.gitignore`, `.git/info/exclude`, and global `gitignore` files. Enabled by default.",
"type": [
"boolean",
"null"
]
},
"select": {
"description": "A list of rule codes or prefixes to enable. Prefixes can specify exact rules (like `F841`), entire categories (like `F`), or anything in between.\n\nWhen breaking ties between enabled and disabled rules (via `select` and `ignore`, respectively), more specific prefixes override less specific prefixes.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"show-fixes": {
"description": "Whether to show an enumeration of all fixed lint violations (overridden by the `--show-fixes` command-line flag).",
"type": [
"boolean",
"null"
]
},
"src": {
"description": "The directories to consider when resolving first- vs. third-party imports.\n\nAs an example: given a Python package structure like:\n\n```text my_project ├── pyproject.toml └── src └── my_package ├── __init__.py ├── foo.py └── bar.py ```\n\nThe `./src` directory should be included in the `src` option (e.g., `src = [\"src\"]`), such that when resolving imports, `my_package.foo` is considered a first-party import.\n\nWhen omitted, the `src` directory will typically default to the directory containing the nearest `pyproject.toml`, `ruff.toml`, or `.ruff.toml` file (the \"project root\"), unless a configuration file is explicitly provided (e.g., via the `--config` command-line flag).\n\nThis field supports globs. For example, if you have a series of Python packages in a `python_modules` directory, `src = [\"python_modules/*\"]` would expand to incorporate all of the packages in that directory. User home directory and environment variables will also be expanded.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"tab-size": {
"description": "The number of spaces a tab is equal to when enforcing long-line violations (like `E501`) or formatting code with the formatter.\n\nThis option changes the number of spaces inserted by the formatter when using soft-tabs (`indent-style = space`).",
"deprecated": true,
"anyOf": [
{
"$ref": "#/definitions/IndentWidth"
},
{
"type": "null"
}
]
},
"target-version": {
"description": "The minimum Python version to target, e.g., when considering automatic code upgrades, like rewriting type annotations. Ruff will not propose changes using features that are not available in the given version.\n\nFor example, to represent supporting Python >=3.10 or ==3.10 specify `target-version = \"py310\"`.\n\nIf you're already using a `pyproject.toml` file, we recommend `project.requires-python` instead, as it's based on Python packaging standards, and will be respected by other tools. For example, Ruff treats the following as identical to `target-version = \"py38\"`:\n\n```toml [project] requires-python = \">=3.8\" ```\n\nIf both are specified, `target-version` takes precedence over `requires-python`.",
"anyOf": [
{
"$ref": "#/definitions/PythonVersion"
},
{
"type": "null"
}
]
},
"task-tags": {
"description": "A list of task tags to recognize (e.g., \"TODO\", \"FIXME\", \"XXX\").\n\nComments starting with these tags will be ignored by commented-out code detection (`ERA`), and skipped by line-length rules (`E501`) if [`ignore-overlong-task-comments`](#lint_pycodestyle_ignore-overlong-task-comments) is set to `true`.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"typing-modules": {
"description": "A list of modules whose exports should be treated equivalently to members of the `typing` module.\n\nThis is useful for ensuring proper type annotation inference for projects that re-export `typing` and `typing_extensions` members from a compatibility module. If omitted, any members imported from modules apart from `typing` and `typing_extensions` will be treated as ordinary Python objects.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"unfixable": {
"description": "A list of rule codes or prefixes to consider non-fixable.",
"deprecated": true,
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/RuleSelector"
}
},
"unsafe-fixes": {
"description": "Enable application of unsafe fixes. If excluded, a hint will be displayed when unsafe fixes are available. If set to false, the hint will be hidden.",
"type": [
"boolean",
"null"
]
}
},
"additionalProperties": false,
"definitions": {
"ApiBan": {
"type": "object",
"required": [
"msg"
],
"properties": {
"msg": {
"description": "The message to display when the API is used.",
"type": "string"
}
},
"additionalProperties": false
},
"BannedAliases": {
"type": "array",
"items": {
"type": "string"
}
},
"ConstantType": {
"type": "string",
"enum": [
"bytes",
"complex",
"float",
"int",
"str"
]
},
"Convention": {
"oneOf": [
{
"description": "Use Google-style docstrings.",
"type": "string",
"enum": [
"google"
]
},
{
"description": "Use NumPy-style docstrings.",
"type": "string",
"enum": [
"numpy"
]
},
{
"description": "Use PEP257-style docstrings.",
"type": "string",
"enum": [
"pep257"
]
}
]
},
"DocstringCodeLineWidth": {
"anyOf": [
{
"description": "Wrap docstring code examples at a fixed line width.",
"allOf": [
{
"$ref": "#/definitions/LineWidth"
}
]
},
{
"description": "Respect the line length limit setting for the surrounding Python code.",
"allOf": [
{
"$ref": "#/definitions/Dynamic"
}
]
}
]
},
"Dynamic": {
"type": "string",
"const": "dynamic"
},
"Flake8AnnotationsOptions": {
"type": "object",
"properties": {
"allow-star-arg-any": {
"description": "Whether to suppress `ANN401` for dynamically typed `*args` and `**kwargs` arguments.",
"type": [
"boolean",
"null"
]
},
"ignore-fully-untyped": {
"description": "Whether to suppress `ANN*` rules for any declaration that hasn't been typed at all. This makes it easier to gradually add types to a codebase.",
"type": [
"boolean",
"null"
]
},
"mypy-init-return": {
"description": "Whether to allow the omission of a return type hint for `__init__` if at least one argument is annotated.",
"type": [
"boolean",
"null"
]
},
"suppress-dummy-args": {
"description": "Whether to suppress `ANN000`-level violations for arguments matching the \"dummy\" variable regex (like `_`).",
"type": [
"boolean",
"null"
]
},
"suppress-none-returning": {
"description": "Whether to suppress `ANN200`-level violations for functions that meet either of the following criteria:\n\n- Contain no `return` statement. - Explicit `return` statement(s) all return `None` (explicitly or implicitly).",
"type": [
"boolean",
"null"
]
}
},
"additionalProperties": false
},
"Flake8BanditOptions": {
"type": "object",
"properties": {
"check-typed-exception": {
"description": "Whether to disallow `try`-`except`-`pass` (`S110`) for specific exception types. By default, `try`-`except`-`pass` is only disallowed for `Exception` and `BaseException`.",
"type": [
"boolean",
"null"
]
},
"hardcoded-tmp-directory": {
"description": "A list of directories to consider temporary.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"hardcoded-tmp-directory-extend": {
"description": "A list of directories to consider temporary, in addition to those specified by [`hardcoded-tmp-directory`](#lint_flake8-bandit_hardcoded-tmp-directory).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"Flake8BooleanTrapOptions": {
"type": "object",
"properties": {
"extend-allowed-calls": {
"description": "Additional callable functions with which to allow boolean traps.\n\nExpects to receive a list of fully-qualified names (e.g., `pydantic.Field`, rather than `Field`).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"Flake8BugbearOptions": {
"type": "object",
"properties": {
"extend-immutable-calls": {
"description": "Additional callable functions to consider \"immutable\" when evaluating, e.g., the `function-call-in-default-argument` rule (`B008`) or `function-call-in-dataclass-defaults` rule (`RUF009`).\n\nExpects to receive a list of fully-qualified names (e.g., `fastapi.Query`, rather than `Query`).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"Flake8BuiltinsOptions": {
"type": "object",
"properties": {
"builtins-allowed-modules": {
"description": "List of builtin module names to allow.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"builtins-ignorelist": {
"description": "Ignore list of builtins.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"Flake8ComprehensionsOptions": {
"type": "object",
"properties": {
"allow-dict-calls-with-keyword-arguments": {
"description": "Allow `dict` calls that make use of keyword arguments (e.g., `dict(a=1, b=2)`).",
"type": [
"boolean",
"null"
]
}
},
"additionalProperties": false
},
"Flake8CopyrightOptions": {
"type": "object",
"properties": {
"author": {
"description": "Author to enforce within the copyright notice. If provided, the author must be present immediately following the copyright notice.",
"type": [
"string",
"null"
]
},
"min-file-size": {
"description": "A minimum file size (in bytes) required for a copyright notice to be enforced. By default, all files are validated.",
"type": [
"integer",
"null"
],
"format": "uint",
"minimum": 0.0
},
"notice-rgx": {
"description": "The regular expression used to match the copyright notice, compiled with the [`regex`](https://docs.rs/regex/latest/regex/) crate. Defaults to `(?i)Copyright\\s+((?:\\(C\\)|©)\\s+)?\\d{4}((-|,\\s)\\d{4})*`, which matches the following:\n\n- `Copyright 2023` - `Copyright (C) 2023` - `Copyright 2021-2023` - `Copyright (C) 2021-2023` - `Copyright (C) 2021, 2023`",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},