Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
flake8-class-newline
Advanced tools
.. image:: https://travis-ci.org/AlexvEck/flake8-class-newline.svg?branch=master :target: https://travis-ci.org/AlexvEck/flake8-class-newline :alt: Build Status
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
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.
This package was inspired by flake8-quotes created by @zheller. Thanks for the inspiration!
FAQs
Flake8 lint for newline after class definitions.
We found that flake8-class-newline demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.