forked from numtide/treefmt-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff-check.nix
More file actions
63 lines (60 loc) · 1.09 KB
/
Copy pathruff-check.nix
File metadata and controls
63 lines (60 loc) · 1.09 KB
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
{
config,
lib,
mkFormatterModule,
...
}:
let
cfg = config.programs.ruff-check;
in
{
meta.maintainers = [ ];
imports = [
(lib.mkRenamedOptionModule
[ "programs" "ruff" "check" ]
[
"programs"
"ruff-check"
"enable"
]
)
(lib.mkRenamedOptionModule
[ "programs" "ruff" "enable" ]
[
"programs"
"ruff-check"
"enable"
]
)
(mkFormatterModule {
name = "ruff-check";
package = "ruff";
args = [
"check"
"--fix"
];
includes = [
"*.py"
"*.pyi"
];
})
];
options.programs.ruff-check = {
extendSelect = lib.mkOption {
description = ''
--extend-select options
'';
type = lib.types.listOf lib.types.str;
example = [ "I" ];
default = [ ];
};
};
config = lib.mkIf cfg.enable {
settings.formatter.ruff-check = {
options = lib.optionals ((builtins.length cfg.extendSelect) != 0) [
"--extend-select"
(lib.concatStringsSep "," cfg.extendSelect)
];
};
};
}