Skip to content

Make flake8 fail CI and fix what it reports - #136

Merged
pancakereport merged 2 commits into
mainfrom
flake8-strict
Oct 16, 2026
Merged

pancakereport merged 2 commits into
mainfrom
flake8-strict

Conversation

@pancakereport

Copy link
Copy Markdown

lint.yml ran flake8 twice: a strict run limited to syntax errors and undefined names, then every other check with --exit-zero. The second run reported 64 problems on main, but CI stayed green, so nobody saw them. This fixes those problems and makes lint fail on any finding.

Changes

  • lint.yml: a single flake8 . --count --show-source --statistics that fails CI. The default checks already include syntax errors and undefined names, so the separate strict run isn't needed.

  • .flake8: ignore becomes extend-ignore. ignore replaced flake8's default ignore list instead of adding to it, which turned W503 back on, even though flake8 ignores it by default and it conflicts with W504. E722 and F401 stay ignored as before.

  • Fixed findings:

    • Whitespace (48): trailing whitespace, whitespace-only lines, a missing final newline, and inline comment spacing. Mostly in tests/unit/test_assignment.py and test_email.py. A few were inside docstrings.
    • Long lines (5) in forms.py, assign.py and export.py: wrapped.
    • Missing blank lines (2) in assign.py and test_assignment.py.
  • Complexity: max-complexity = 10 stays for new code. The eight functions already over it get # noqa: C901 rather than a higher limit:

    • prepare_students (31)
    • seven views in views.py (11 to 14)

    Refactoring them is a separate job.

Apart from the line wrapping, the code changes are whitespace and noqa markers only; git diff -w shows no changes to the test files.

Testing

🤖 Generated with Claude Code

Lint ran every check with --exit-zero, so its 64 findings never failed
CI. Fix the whitespace, blank-line and line-length ones, mark the eight
functions already over max-complexity with noqa so new code stays under
10, and switch .flake8 to extend-ignore so flake8's default ignores
(like W503) apply again. Lint is now one flake8 run that fails on any
problem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Coverage

Coverage for unit tests for Python 3.14
FileStmtsMissCoverMissing
server
   __init__.py52492%55, 65–67, 87
   cache.py6183%12
   forms.py1381490%24–26, 42–44, 71, 94, 169–172, 179, 187
   models.py2112688%60, 64, 67, 70, 73, 76–81, 143–152, 182, 200, 257, 260, 283, 327, 341
   views.py76751333%39, 49–85, 95–129, 140–144, 161–170, 186–203, 214–221, 230–252, 263–276, 285, 296–299, 317–318, 320–325, 327–328, 342–366, 375–397, 406–433, 450–452, 462–504, 544–574, 583–613, 633, 647–650, 652–655, 664–694, 703–720, 751–755, 764–810, 816–868, 880–882, 889–910, 918–939, 971, 995, 1040–1049, 1051, 1066–1067, 1072–1085, 1099, 1104, 1131–1132
server/controllers
   __init__.py821779%27–28, 36–39, 43, 72, 76, 85, 101–110
   auth_controllers.py402342%22–51, 57–59
   health_controllers.py21767%18–19, 24–28
server/services/auth
   __init__.py28389%25–26, 30
server/services/canvas
   __init__.py806124%18–25, 29, 33, 37, 43, 55–64, 69–105, 109–124, 128
   fake_canvas.py392633%9, 12, 15, 20–25, 28–29, 37–46, 49–56
server/services/core
   assign.py76396%25, 28, 114
   data.py613444%13–18, 22–26, 30–34, 38–40, 44–55, 90–92, 101–102, 106–107
   export.py27678%37–39, 41–43
   room.py611870%11–33, 57, 70–71, 74
   student.py192597%33, 37–38, 47, 284
server/services/email
   __init__.py50394%47, 74, 92
   smtp.py1002575%20, 60–62, 84–92, 104–105, 117–124, 128–130, 141–142
server/services/email/templates
   __init__.py33197%20
server/typings
   exception.py34488%42, 53, 59–60
server/utils
   date.py7186%30
   misc.py16756%13–19
TOTAL239180266% 

Tests Skipped Failures Errors Time
300 0 💤 0 ❌ 0 🔥 23.904s ⏱️

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Coverage

Coverage for e2e tests for Python 3.14
FileStmtsMissCoverMissing
server
   __init__.py521277%13, 16–22, 27, 55, 65–67, 87
   cache.py6183%12
   forms.py1382185%24–26, 42–44, 69–71, 93–99, 169–172, 179, 187
   models.py2117067%27, 60, 64, 67, 70, 73, 76–81, 111, 126–132, 136, 140, 143–152, 161–162, 169–170, 177–182, 189–197, 200, 214, 217–219, 222, 226, 238, 242, 246, 250–251, 257, 260, 280, 283, 304, 309, 314, 319, 324, 327, 341
   views.py76765614%38–40, 49–85, 95–129, 140–144, 161–170, 186–203, 214–221, 230–252, 263–276, 285, 296–299, 310–329, 342–366, 375–397, 406–433, 442–453, 462–504, 515–523, 531–535, 544–574, 583–613, 622–655, 664–694, 703–720, 726–729, 739–746, 751–755, 764–810, 816–868, 874–884, 889–910, 915–945, 950–954, 962–972, 976–978, 983–1016, 1026–1030, 1037–1061, 1066–1067, 1072–1085, 1094, 1099, 1104, 1120–1136, 1146–1147
server/controllers
   __init__.py824644%26–44, 47–49, 60–87, 90, 101–110, 113
   auth_controllers.py402635%14–16, 22–51, 57–59
   dev_login_controllers.py584424%17–30, 35–52, 60–61, 68–79, 84–101
   health_controllers.py211243%9, 14–19, 24–28
server/services/auth
   __init__.py28775%25–26, 30, 62–63, 68–69
server/services/canvas
   __init__.py806124%18–25, 29, 33, 37, 43, 55–64, 69–105, 109–124, 128
   fake_canvas.py392633%9, 12, 15, 20–25, 28–29, 37–46, 49–56
server/services/core
   assign.py765824%10–13, 16, 19, 22, 25, 28, 36, 40–46, 54–55, 63, 67, 84–149, 163–180
   data.py614133%13–18, 22–26, 30–34, 38–40, 44–55, 62, 72–74, 79, 90–92, 96–97, 101–102, 106–107
   export.py272219%11–46
   layout_preview.py925738%81, 85, 90, 94, 105–110, 116–119, 128–130, 140, 147, 159–162, 167–171, 175–177, 199–200, 206–209, 218–222, 227, 239–259
   room.py61568%11–33, 41–89
   student.py19215917%33, 37–38, 42, 46–48, 57–60, 70–72, 79, 88–93, 104–107, 110–114, 122–136, 140–143, 152–157, 161, 165, 172–307
server/services/csv
   __init__.py261735%11–12, 20, 27–30, 40, 54–56, 63–68
server/services/email
   __init__.py503824%23–40, 44–81, 90–101
   smtp.py1007822%20, 28–41, 49–50, 54–63, 68–93, 99–131, 136–142
server/services/email/templates
   __init__.py332330%9–11, 14–17, 20, 30–41, 45–47
server/services/google
   __init__.py553929%21–36, 40–43, 47–53, 57–76
server/typings
   exception.py341362%20–36, 42, 47, 53, 59–60, 69, 72
server/utils
   date.py7443%17–19, 30
   misc.py161319%5–9, 13–19, 23
TOTAL2391160033% 

Tests Skipped Failures Errors Time
14 0 💤 0 ❌ 0 🔥 40.468s ⏱️

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.45%. Comparing base (e67caa8) to head (415e5a6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #136   +/-   ##
=======================================
  Coverage   66.45%   66.45%           
=======================================
  Files          29       29           
  Lines        2391     2391           
=======================================
  Hits         1589     1589           
  Misses        802      802           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

🚀 Staging Preview Deployed!

URL: https://preview-seating-pr-136-137456085712.us-west1.run.app

@pancakereport
pancakereport marked this pull request as draft October 16, 2026 23:33
@pancakereport
pancakereport marked this pull request as ready for review October 16, 2026 23:37
@pancakereport
pancakereport merged commit 42af93f into main Oct 16, 2026
14 of 15 checks passed
@pancakereport
pancakereport deleted the flake8-strict branch October 16, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant