Skip to content

Commit f57eae6

Browse files
mkannwischerhanno-becker
authored andcommitted
Lint: Replace black with ruff
Ports pq-code-package/mlkem-native#1653 Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
1 parent 087bdcd commit f57eae6

16 files changed

Lines changed: 263 additions & 222 deletions

File tree

nix/util.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ rec {
8787
nixpkgs-fmt
8888
shfmt
8989
shellcheck
90-
actionlint;
90+
actionlint
91+
ruff;
9192

9293
inherit (pkgs.python3Packages)
93-
mpmath sympy black pyparsing pyyaml rich;
94+
mpmath sympy pyparsing pyyaml rich;
9495
};
9596
};
9697

proofs/cbmc/lib/summarize.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def export_result_json(output_path, run_file):
137137

138138
failures, runtimes = [], []
139139
for name, status, duration_str in proof_table[1:]: # skip header
140-
is_timeout = duration_str == "TIMEOUT"
141140
is_success = status == "Success"
142141

143142
if not is_success:

proofs/cbmc/run-cbmc-proofs.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ def get_args():
107107
{
108108
"flags": ["--fail-on-proof-failure"],
109109
"action": "store_true",
110-
"help": "exit with return code `10' if any proof failed"
111-
" (default: exit 0)",
110+
"help": "exit with return code `10' if any proof failed (default: exit 0)",
112111
},
113112
{
114113
"flags": ["--no-standalone"],
@@ -131,9 +130,7 @@ def get_args():
131130
"flags": ["--marker-file"],
132131
"metavar": "FILE",
133132
"default": "Makefile",
134-
"help": (
135-
"name of file that marks proof directories. Default: " "%(default)s"
136-
),
133+
"help": ("name of file that marks proof directories. Default: %(default)s"),
137134
},
138135
{
139136
"flags": ["--no-memory-profile"],
@@ -217,8 +214,9 @@ def task_pool_size():
217214
def print_counter(counter):
218215
# pylint: disable=consider-using-f-string
219216
print(
220-
"\rConfiguring CBMC proofs: "
221-
"{complete:{width}} / {total:{width}}".format(**counter),
217+
"\rConfiguring CBMC proofs: {complete:{width}} / {total:{width}}".format(
218+
**counter
219+
),
222220
end="",
223221
file=sys.stderr,
224222
)

ruff.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) The mldsa-native project authors
2+
# Copyright (c) The mlkem-native project authors
3+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4+
5+
# In addition to ruff's default (*.py, *.pyi), format and lint the
6+
# extension-less python scripts under scripts/.
7+
extend-include = [
8+
"scripts/autogen",
9+
"scripts/cfify",
10+
"scripts/check-contracts",
11+
"scripts/check-magic",
12+
"scripts/check-namespace",
13+
"scripts/simpasm",
14+
"scripts/stack",
15+
"scripts/tests",
16+
]
17+
18+
[lint]
19+
select = ["E", "F", "W"]
20+
ignore = [
21+
"E501", # line too long
22+
]

0 commit comments

Comments
 (0)