ci: fix the lint findings that stop CI before any test runs - #122
Open
nk0952 wants to merge 1 commit into
Open
Conversation
Every leg of the CI matrix on master fails at the "Lint (ruff)" step (run #455, all nine legs), so yamllint, mypy and the test suite never run. The red X on master is not a failing test being reported -- CI has not got as far as running one in a long time. That is not academic. `python -m pytest tests/` fails 9 tests in tests/unit/test_index_sync.py on master today, and CI has never said so. ruff reports four findings, all in test files: tests/ebuild/test_build_dir_resolution.py:31 F811 import shutil twice tests/unit/test_ci_gate.py:214,215 E402 imports below code tests/ebuild/test_package_recipe.py:117 W292 no newline at EOF With those fixed the job gets as far as mypy, which fails on ebuild/plugins/__init__.py:46. The `# type: ignore[attr-defined]` there names the wrong error code, so it was never silencing the arg-type error the same line raises. I spelled out the pre-3.10 entry_points() mapping shape with cast instead of widening the ignore. That branch only runs on Python 3.8/3.9, which the matrix does not cover, so runtime behaviour is unchanged either way. The 9 index-sync failures that remain are PR embeddedos-org#119's, and I have not duplicated it. With both applied the suite is 678 passed, 0 failed. Checked on Python 3.11.15 with ruff 0.16.6, running each CI step by hand: ruff and yamllint clean, mypy down from 2 errors to 1, pytest unchanged at 669 passed with no test expectations touched. Signed-off-by: Nitesh Kumar <nk0952@gmail.com>
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CI on master is red, and it fails at the Lint (ruff) step in all nine matrix legs. Everything after that step - yamllint, mypy,
Run test suite- is skipped. So the red X isn't a failing test being reported; CI hasn't got as far as running one.That has been hiding a real regression.
python -m pytest tests/fails 9 tests intests/unit/test_index_sync.pyon master right now, and CI has never mentioned it.This clears the lint and type findings sitting between the workflow and its own test step.
Type of Change
Changes
ruff check .reports four findings on master, all in test files:tests/ebuild/test_build_dir_resolution.py:31- F811,import shutilappears twicetests/unit/test_ci_gate.py:214,215- E402, two imports sitting below module-level codetests/ebuild/test_package_recipe.py:117- W292, no newline at end of fileFixing those gets the job as far as
Type check (mypy), which then fails onebuild/plugins/__init__.py:46:The
# type: ignorethere names the wrong error code, so it was never silencing anything. I spelled out the pre-3.10entry_points()mapping shape withcastrather than widening the ignore. That branch only runs on Python 3.8/3.9, which the matrix doesn't cover, so behaviour is unchanged either way.Testing
Python 3.11.15,
pip install -e ".[dev]", ruff 0.16.6. I ran each CI step by hand with the same flagsci.ymluses:ruff check .yamllint .mypy ...pytest tests/Nothing outside the
casttouches a shipped code path.Related Issues
The 9 remaining failures are
test_index_sync.py, which open PR #119 fixes. I've left those alone rather than duplicate that work - landing both gives a green gate, which is the last column above.Additional Notes
Two things I noticed but didn't fold in, since they look like maintainer calls:
ci.ymlinstalls its linters unpinned. A new ruff release can turn the gate red with no change to this repo, which may well be how this arrived. Pinning them, or moving them into thedevextra inpyproject.toml, would make the gate reproducible..coveragercsetsfail_under = 100against a suite measuring ~24%, andci.ymlworks around it with--cov-fail-under=0plus a comment calling it a maintainer decision. Probably worth settling in one place.