From the course: Agile Software Development: Code Quality

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Detect style violations with Flake8

Detect style violations with Flake8 - SonarQube Tutorial

From the course: Agile Software Development: Code Quality

Start my 1-month free trial

Detect style violations with Flake8

- [Instructor] Let's explore using Flake8, a Python Linter, by running it against the code base for Flask, a popular Python web development framework. Let's go ahead and switch into the Flask directory that we cloned, and then to install Flake8, all we need to do is do pip install flake8 equals 3.7.2, where three point seven two needs to match the version of Python that you have installed. Once that's done, we can rune Flake8 to see what's detected. We get a bunch of output. To make a little more sense of that, we can pass it into the WC utility, to get an exact count of the number of issues that Flake8 reported. So we do flake8, pipe, WC dash L, which tells the WC or word count utility to give us a line count. We get 212 lines, that's a lot, but don't get overwhelmed, not every issue that Flake8 reports is going to make sense for your project. That's why Flake8 gives you a few different ways that you can control its output. Let's look at an example. First, let's limit the output to…

Contents