Level 3 / Project 13 - Quality Gate Runner¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | Browser |
Estimated time: 55 minutes
Focus¶
- simulate lint/test/build gate process
Why this project exists¶
This project gives you level-appropriate practice in a realistic operations context. Goal: run the baseline, alter behavior, break one assumption, recover safely, and explain the fix.
Run (copy/paste)¶
Use <repo-root> as the folder containing this repository's README.md.
cd <repo-root>/projects/level-3/13-quality-gate-runner
python project.py project.py
python project.py project.py --json
python project.py project.py --max-lines 100
pytest -q
Expected terminal output¶
Pipeline: FAIL (5.2ms)
[PASS] file_exists:project.py: File found
[PASS] syntax:project.py: No syntax errors
[FAIL] no_print:project.py: 3 print statement(s) found
[PASS] size:project.py: 165 lines (limit: 300)
3/4 gates passed
14 passed
Expected artifacts¶
- Pipeline results on stdout
- Passing tests
- Updated
notes.md
Checkpoint: Baseline code runs and all tests pass. Commit your work before continuing.
Alter it (required) — Extension¶
- Add a
check_docstringsgate that verifies all functions have docstrings. - Add a
--gateflag to run only specific gates. - Add
--strictmode where any warning is treated as a failure.
Break it (required) — Core¶
- Run on a non-Python file — do syntax and print checks handle it?
- Run on a file that doesn't exist — does the pipeline still report all gates?
- Set
--max-lines 0— does the size check handle the edge case?
Fix it (required) — Core¶
- Add file type detection (skip syntax check for non-.py files).
- Ensure all gates handle missing files consistently.
- Add a
--quietflag that only shows failures.
Checkpoint: All modifications done, tests still pass. Good time to review your changes.
Explain it (teach-back)¶
- What is a "quality gate" in CI/CD and how does this project simulate one?
- How does
compile()check for syntax errors without running the code? - Why use
time.perf_counter()instead oftime.time()for timing? - How does the pipeline aggregate individual gate results?
Mastery check¶
You can move on when you can:
- build composable quality gate checks,
- use compile() for syntax validation,
- aggregate results into a pass/fail pipeline,
- time operations with time.perf_counter().
Related Concepts¶
| ← Prev | Home | Next → |
|---|---|---|