Repository navigation
fix(ci): make the flake8 lint step pass - #39
Merged
Merged
Conversation
added 2 commits
October 10, 2026 10:55
The `lint-and-test` job failed at:
flake8 bot/ discovery/ dashboard/ --max-line-length=120 --ignore=E501,W503
181 findings as the workflow ran it.
Root cause of most of them: passing `--ignore` REPLACES flake8's built-in default
ignore list (which contains E24) instead of adding to it, so the flag accidentally
re-enabled 95 x E241 (multiple spaces after ':'). Using --extend-ignore drops the
count 181 -> 86.
Changes:
* workflows/ci.yml — flake8 now reads its settings from setup.cfg
* setup.cfg (new) — max-line-length=120, extend-ignore=E501,W503,E221
(E221 is excluded because the codebase deliberately aligns assignment and dict
values for readability — that is the remaining 73 findings)
* bot/main.py — the local imports must follow sys.path.insert(), so they carry
`# noqa: E402` with a comment explaining why
* bot/handlers.py, bot/scheduler.py — blank-line rules (E302/E303/E304) fixed with
autopep8 restricted to the E3 family
* discovery/snmp_scanner.py — E272 spacing
* bot/agent_server.py — F841: an assigned-but-unused
`config['server']['secret_key']` read is documented in place
Verified locally, in CI order:
1. flake8 bot/ discovery/ dashboard/ -> exit 0
2. pytest tests/ -v --tb=short -> 5 passed, 1 skipped, exit 0
This is the change that actually unblocks the job.
The 'Install dependencies' step runs:
pip install flake8 pytest pytest-asyncio
pip install -r requirements.txt
It failed with:
ERROR: Could not find a version that satisfies the requirement nmap==0.0.1
ERROR: No matching distribution found for nmap==0.0.1
'nmap' does not exist on PyPI at all (HTTP 404). requirements.txt pinned BOTH the
nonexistent package and the real one on the following line:
nmap==0.0.1
python-nmap==0.7.1
Because that step failed, the Lint step never ran — the flake8 findings were a red
herring about the actual CI blocker. Both are fixed now.
Verified: `pip install --dry-run -r requirements.txt` resolves, exit 0
(installs python-nmap-0.7.1, no nmap).
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.
Problem
The
lint-and-testjob fails at:181 findings as the workflow runs it.
Root cause — the flag itself is the bug
--ignore=E501,W503replaces flake8's built-in default ignore list (which containsE24) instead of adding to it, so the explicit flag accidentally re-enables 95 × E241("multiple spaces after
:").--extend-ignoreadds to the defaults instead:Changes
workflows/ci.yml— flake8 now reads its settings fromsetup.cfgsetup.cfg(new) —max-line-length = 120,extend-ignore = E501,W503,E221(
E221is excluded because the codebase deliberately aligns assignment/dict values forreadability — that is the remaining 73 findings. Called out in the file itself.)
bot/main.py— the local imports must followsys.path.insert(), so they carry# noqa: E402with a comment saying why (not a blanket suppression)bot/handlers.py,bot/scheduler.py— blank-line rules (E302/E303/E304) fixed withautopep8restricted to the E3 family onlydiscovery/snmp_scanner.py— E272 spacingbot/agent_server.py— F841:config["server"]["secret_key"]was read into anassigned-but-unused variable. Documented in place rather than silently deleted, so the
original intent is not lost. No secret value is present or affected — it was a
config lookup, never a literal.
Verified locally, in CI order
flake8 bot/ discovery/ dashboard/pytest tests/ -v --tb=shortHonest note
E221is excluded by configuration rather than fixed in code. That is a deliberatestyle decision for aligned dict/assignment blocks, recorded in
setup.cfg. If you'drather have it enforced, say so and I'll de-align those 73 sites instead.