4 Use linting effectively

 

In this chapter

  • identifying the types of problems linting can find in your code: bugs, errors, and style problems
  • aiming for the ideal of zero problems identified but tempering this against the reality of legacy codebases
  • linting large existing codebases by approaching the problem iteratively
  • weighing the risks of introducing new bugs against the benefits of addressing problems

Let’s get started building your pipelines! Linting is a key component to the CI portion of your pipeline: it allows you to identify and flag known issues and coding standard violations, reducing bugs in your code and making it easier to maintain.

Becky and Super Game Console

Becky just joined the team at Super Game Console and is really excited! Super Game Console, a video game console that runs simple Python games, is very popular. The best feature is its huge library of Python games, to which anyone can contribute.

The folks at Super Game Console have a submission process that allows everyone from the hobbyist to the professional to sign up as a developer and submit their own games.

But these games have a lot of bugs, and it is starting to become a problem. Becky and Ramon, who has been on the team for a while now, have been working their way through the massive backlog of game bugs. Becky has noticed a few things:

Linting to the rescue!

The lowdown on linting

The tale of Pylint and many, many issues

Legacy code: Using a systematic approach

Step 1: Configure against coding standards

Step 2: Establish a baseline

Step 3: Enforce at submission time

Adding enforcement to the pipeline