Software Design by Example in Python 13: A Code Linter
The HTML validator example in Chapter 11 has two natural follow-ons.
the template expander of Chapter 12
(discussed [yesterday][template_post])
and a linter that checks whether the source of a Python program
obeys a set of rules.
Of these,
I think the second is more important:
the original lint
utility on Unix helped me learn how to write C properly,
and I now set up ruff before writing the first line of Python in a new project.
One thing that surprised me as I was writing Chapter 13: A Code Linter was how few new ideas it needed to introduce. By this point in the book, readers have walked trees using the Visitor pattern and understand that a program is just a data structure in memory. Putting those two things together was a lot easier than I feared it would be; in a way, the fact that the concept map below is smaller than most of its predecessors is a sign that I’ve put topics in the right (or “a” right) order.
Note: I would be grateful for help getting the book to display properly in dark mode. In particular, if you have a tool that will convert the SVG produced by draw.io to white-on-black and some CSS to select them in place of the black-on-white versions, please get in touch.
Terms defined: false negative, linter.