[CANCELLED] Build your own linters
- Room:
- Wicklow Hall 1
- Start (Dublin time):
- Start (your time):
- Duration:
- 180 minutes
Abstract
Despite a ton of wonderful linters out there, it pays off to scratch your itch and learn how to write one yourself. Anytime a pet peeve starts bothering you in code reviews, you’ll have all the tools at your disposal.
TutorialTesting
Description
Developers are opinionated, and it reflects in their programming style — not just the way code looks, but how it feels: its organization and readability. In such cases, maintaining consistency across a project helps everyone involved. One aspect of this is ensuring that there are (at least partial) automated tests to enforce this style.
This training aims to enable the audience to write such tests by giving them a tour of code analysis and the vast array of tools it makes available to us. First, we dissect the code using Python's ast
and tokenize
modules and object internals like __dict__
. From there and on, we visit some real-world examples:
- A test to detect unnecessary use of double-quotes. They are such a terrible waste of pixels, after all.
- Flagging the use of list() instead of []. The former is slower – as it requires an extra lookup in "globals" – and might result in a bug if the name is rebound to another object.
- Find if statements are nested for more than four levels. It can lead to hard-to-understand, ugly-looking code.
- Look for unused imports. Shred the extra loading time and memory amounting from these unused lines of code.