Skip to main content

A flake8 plugin that finds that finds improvements for raise statements.

Project description

A flake8 plugin that finds improvements for raise statements.

Installation

Install using pip:

$ pip install flake8-raise

When installed, the plugin will automatically be used by flake8. To check it is installed correctly, run flake8 --version and look in the list of installed plugins:

$ flake8 --version
3.7.9 (flake8-raise: 0.0.3, mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.8.1 on Linux

Rules

Code

Rule

R100

raise in except handler without from.

Examples

The following example:

try:
    foo["bar"]
except KeyError:
    raise MyException

Will result in the flake8 error:

R100 raise in except handler without from.

To fix, change the code to:

try:
    foo['bar']
except KeyError as e:
    raise MyException from e

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-raise-0.0.3.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

flake8_raise-0.0.3-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page