Skip to main content

Flake8 lint for newline after class definitions.

Project description

Flake8 Extension to lint for a newline after a Class definition
===========================================

.. image:: https://travis-ci.org/AlexvEck/flake8-class-newline.svg?branch=master
:target: https://travis-ci.org/AlexvEck/flake8-class-newline
:alt: Build Status

Usage
-----

If you are using flake8, you can install this package through pip.

.. code:: shell

pip install flake8-class-newline

This plugin is then automatically triggered when you run;

.. code:: shell

flake8

It produces only 1 error type; "CNL100: Class definition does not have a new line."

NOTE; Documentation blocks (or docblocks) should be on the newline, they are therefore ignored by this plugin. See https://www.python.org/dev/peps/pep-0008/#documentation-strings


Example
-----

PEP8 is unclear on whether we should allow for a newline after a class definition.

Basically;

.. code:: python

class AClassWithoutANewLine(object):
an_arg = 'a_value'

or

.. code:: python

class AClassWithANewLine(object):

an_arg = 'a_value'


The former seems to be widely accepted by auto-formatters. This plugin was made to enforce the latter.



Special Notice
-----

This package was inspired by flake8-quotes created by @zheller.
Thanks for the inspiration!

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-class-newline-1.4.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file flake8-class-newline-1.4.0.tar.gz.

File metadata

File hashes

Hashes for flake8-class-newline-1.4.0.tar.gz
Algorithm Hash digest
SHA256 621d10ecffac3889402b328ec7e03259ad7cc82630e1ae8250a2b30ceb4f710f
MD5 1d8fe358982a090f4298a8351350e092
BLAKE2b-256 f747b2aaa3d44d8fcae0916037b889e247485a7b17c635a551b30d2c9da9833a

See more details on using hashes here.

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