Flake8

Objectives

Duration: 20 minutes

Code style checkers are a great way to ensure that your project has a clean and consistent style with minimal code smell. Consistent style makes it easier for new contributors to follow the code, makes the code easier to maintain, and helps keep all of us honest when following best-practices. Automatically checking the code style can reduce the burden of the maintainer in reviewing pull requests and ensures that the checks are always run.

pytest-flake8

Discuss additional flake8 plugins

Add to Travis config

Running locally

Supressing warnings

[flake8]
max-line-length = 95
[flake8]
ignore = F403
max-line-length = 95

Activity Fix the flake failures, but don’t worry about fixing the F403 issues in plots/__init__.py.

Solution

"""This module contains a variety of plotting functions."""
"""Make a random plot of some size for science.

Makes a random plot of num_points and colored randomly. While this probably
sounds silly, it sometimes shows more patterns that some real dataself.

Parameters
----------
num_points : integer
    The number of random points to plot on the graph.
seed : integer, optional
    Seed value for the random number generator for reproducible plots.

Returns
-------
matplotlib.figure.Figure : figure object
matplotlib.axes._subplots.AxesSubplot : axes

"""