Skip to main content
Flake8 Extension to lint for a method 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 says we should surround every class method with a single blank line. See https://www.python.org/dev/peps/pep-0008/#blank-lines
However flake8 is ambiguous about the first method having a blank line above it.

Basically;

.. code:: python

class AClassWithoutANewLine(object):
def a_method(self):
return 'a_value'

class AClassWithoutANewLineProperty(object):
@property
def a_method(self):
return 'a_value'

or

.. code:: python

class AClassWithANewLine(object):

def a_method(self):
return 'a_value'

class AClassWithANewLineProperty(object):

@property
def a_method(self):
return 'a_value'



This plugin was made to enforce the latter.

NOTE; properties of a class do not need a surrounding blank line, only methods.

Special Notice
-----

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


Release files for flake8-class-newline 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-class-newline 1.6.0
File Size Uploaded
flake8-class-newline-1.6.0.tar.gz 4.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for flake8-class-newline 1.6.0
File Interpreter ABI Platform
flake8_class_newline-1.6.0-py3-none-any.whl Python 3 none any Details
flake8_class_newline-1.6.0-py2-none-any.whl Python 2 none any Details

Total release size: 14.7 kB

Release files / flake8-class-newline-1.6.0.tar.gz

Download URL flake8-class-newline-1.6.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
514c4923c88eb8b3dd52db4b55b8d3483520db89db80af6ba812a4af15421ff1
BLAKE2b-256 checksum
How to use checksums
17f3d93a95971801e0bd28539e7727e90553217ea76d48098ea02d10832f609f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / flake8_class_newline-1.6.0-py3-none-any.whl

Download URL flake8_class_newline-1.6.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
130a6991e8c58ec9a6380d273e449e61bcd974b446c97f1e16493f6350fa8d35
BLAKE2b-256 checksum
How to use checksums
9435e62c4643382c7c21836cae115604d6c397dbaeae08c8853e5c46e8657cd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / flake8_class_newline-1.6.0-py2-none-any.whl

Download URL flake8_class_newline-1.6.0-py2-none-any.whl
Size 5.2 kB
Tags Python 2
SHA-256 checksum
How to use checksums
44e77747396c7586bbfe7814df9caf17d92000cb70a5ef9df5d721c934c6db33
BLAKE2b-256 checksum
How to use checksums
420d5c8dbf4c4878e091f910da23bdda7374a52ef5866ec66c30667cb3612142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.6.0 This release

3 release files

1.5.1

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page