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!
===========================================
.. 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)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8-class-newline-1.6.0.tar.gz | 4.3 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 |