From 5b2d9c8bb40ab5039a9261ea6195595730387b26 Mon Sep 17 00:00:00 2001 From: Daniel Ecer Date: Tue, 18 Aug 2026 11:43:59 +0100 Subject: [PATCH] Lint benchmarks in CI The Makefile's dev-flake8, dev-pylint and dev-mypy cover benchmarks, but the Docker lint stages did not, so that tree was checked only on a laptop and only by whoever remembered to run make dev-lint. It had been failing on main since #690 as a result. The two findings it had accumulated go with it. The split gets maxsplit=1, which changes nothing. The empty-list comparison stays as it is, with a disable and a reason: `not ...` would accept None and the empty string equally, and the empty list is what the function contracts to return. flake8 and mypy were already clean over benchmarks, so this only widens what they cover. --- Dockerfile | 6 +++--- benchmarks/tests/report_test.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3087919..777d391b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -135,19 +135,19 @@ COPY --from=python-dist-builder /opt/sciencebeam_parser/dist /dist # lint-flake8 FROM dev AS lint-flake8 -RUN python -m flake8 sciencebeam_parser tests +RUN python -m flake8 sciencebeam_parser tests benchmarks # lint-pylint FROM dev AS lint-pylint -RUN python -m pylint sciencebeam_parser tests +RUN python -m pylint sciencebeam_parser tests benchmarks # lint-mypy FROM dev AS lint-mypy -RUN python -m mypy --ignore-missing-imports sciencebeam_parser tests +RUN python -m mypy --ignore-missing-imports sciencebeam_parser tests benchmarks # pytest diff --git a/benchmarks/tests/report_test.py b/benchmarks/tests/report_test.py index b4b1355a..1e26ba73 100644 --- a/benchmarks/tests/report_test.py +++ b/benchmarks/tests/report_test.py @@ -289,6 +289,8 @@ def test_each_corpus_has_collapsible_section(self): class TestUnequalDocsNote: def test_silent_when_every_run_covered_the_same_documents(self): + # pylint: disable=use-implicit-booleaness-not-comparison + # the empty list is the contract; `not ...` would also accept None assert _unequal_docs_note([("grobid", 10), ("local", 10)]) == [] def test_calls_out_a_difference_with_the_counts(self): @@ -351,5 +353,5 @@ def test_overall_ignores_a_corpus_only_one_run_scored(self): assert "Overall (10 docs across 1 corpora)" in report assert "Excludes b, which not every run scored" in report # The unequal-columns warning belongs to b's own section, not the overall row. - overall = report.split("
")[0] + overall = report.split("
", maxsplit=1)[0] assert "Unequal document sets" not in overall