Phase 6: Testing & Code Quality · ~30 minutes · Python · uv · ruff
Linters, Formatters, and Style
A linter flagged 'toal is assigned to but never used' — and toal was supposed to be total. The 'style' warning just caught a real bug a test suite might have missed entirely.
Hiring signal: Treats a linter warning as worth investigating, not reflexively suppressing
What you will learn
- Explain what a linter catches that a test doesn't
- Distinguish automatic formatting from manual formatting, and why teams default to automatic
- Recognize when a lint warning is flagging a genuine bug vs. a cosmetic preference
- Run ruff and fix real flagged issues rather than silencing them
Introduction
Type: Learn Languages: Python Prerequisites: Lesson 02 (Writing Your First Real Tests) Time: ~30 minutes
Objective
Learning objectives
- Explain what a linter catches that a test doesn't
- Distinguish automatic formatting from manual formatting, and why teams default to automatic
- Recognize when a lint warning is flagging a genuine bug vs. a cosmetic preference
- Run
ruff and fix real flagged issues rather than silencing them
What you're building
A script (lint_audit.py) or use of your own choice of file:
- Pick any 2-3 lab files you've already written earlier in this course
- Run
ruff check against them for real and record the actual output (paste it as a comment, not a summary) - For every genuine issue ruff finds, fix it properly (don't just add a
# noqa suppression comment) — if ruff finds zero issues, that's a valid real outcome, state it - Run
ruff format --diff against the same files and note, in a comment, whether any real formatting inconsistencies existed
ruff flags E501 Line too long (95 > 88 characters) on a line of code, and separately flags F821 Undefined name 'user_id' on a different line in the same file. Which is cosmetic and which demands investigation before doing anything else?
E501 is a genuinely cosmetic convention — a line being 95 characters instead of 88 has zero effect on what the code does, and reasonable teams pick different limits. F821 (undefined name) is a different category entirely: the code refers to something, user_id, that ruff cannot find defined anywhere in scope. That's not a style opinion — it's very likely a real bug hiding in plain sight (a typo'd variable name, a forgotten assignment, a missing import), exactly the toal pattern from this lesson, and it deserves to be understood and fixed, not stylistically adjusted.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers The Problem, Check Yourself, Key Terms & Next — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy