forked from numtide/treefmt-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff-format.nix
More file actions
52 lines (49 loc) · 900 Bytes
/
ruff-format.nix
File metadata and controls
52 lines (49 loc) · 900 Bytes
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
{
config,
lib,
mkFormatterModule,
...
}:
let
cfg = config.programs.ruff-format;
in
{
meta.maintainers = [ "sebaszv" ];
imports = [
(lib.mkRenamedOptionModule
[ "programs" "ruff" "format" ]
[
"programs"
"ruff-format"
"enable"
]
)
(mkFormatterModule {
name = "ruff-format";
package = "ruff";
args = [ "format" ];
includes = [
"*.py"
"*.pyi"
];
})
];
options.programs.ruff-format = {
lineLength = lib.mkOption {
description = ''
Set the line-length.
'';
type = with lib.types; nullOr int;
example = 79;
default = null;
};
};
config = lib.mkIf cfg.enable {
settings.formatter.ruff-format = {
options = lib.mkIf (cfg.lineLength != null) [
"--line-length"
(toString cfg.lineLength)
];
};
};
}