flake8-cls-attr-order
A flake8 plugin that checks class attributes for the proper alphabetical order.
Tools
Production
- python 3.7+
- flake8
Development
Installation
PYPI
pip install flake8-cls-attr-order
✨ 🍰 ✨
Source code
git clone git@github.com:vyahello/flake8-cls-attr-order.git
cd flake8-cls-attr-order
python3 -m venv venv
. venv/bin/activate
pip install -e .
Errors
Codes
CL100- class name should start with upper case letter.CL101- wrong class constants order.CL200- @staticmethod is detected, should be converted to function.CL201- wrong class methods order. Order should be@property,@classmethod,@staticmethodand instance methods.
Sample
# cls.py
class foo:
BAR = ()
ABRA = {}
@staticmethod
def smethod(): ...
def imethod(self): ...
@property
def prop(self): ...
flake8 cls.py
cls.py:1:1: CL100 "foo" class name should start with upper case letter
cls.py:1:1: CL101 wrong "foo" class constants order, should be "ABRA, BAR"
cls.py:1:1: CL201 wrong "foo" class methods order. Comply with @property, @classmethod, @staticmethod, instance methods. Should be "prop, smethod, imethod"
cls.py:6:5: CL200 "smethod" @staticmethod is detected, should be converted to function
Development notes
Testing
Unit tests
Please run the following script to start plugin unit tests:
pytest
Package tests
Please run the following script to start plugin package tests:
bats test-package.bats
CI
To be able to run code analysis, please execute command below:
./analyse-source-code.sh
Meta
Author – Vladimir Yahello.
Distributed under the MIT license. See license for more information.
You can reach out me at:
- vyahello@gmail.com
- https://twitter.com/vyahello
- https://www.linkedin.com/in/volodymyr-yahello-821746127
Contributing
I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:
- Clone the repository
- Configure
gitfor the first time after cloning with yournameandemail pip install -r requirements.txtto install all project dependenciespip install -r requirements-dev.txtto install all development project dependencies- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request
What's next
All recent activities and ideas are described at project issues page. If you have ideas you want to change/implement please do not hesitate and create an issue.
Metadata
Release files for flake8-cls-attr-order 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_cls_attr_order-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / flake8_cls_attr_order-0.3.0-py3-none-any.whl
| Download URL | flake8_cls_attr_order-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33c4399085fc7a2383619174fb6540bef83a15aae77f8d54eec11e2b01fe3621
|
|
BLAKE2b-256 checksum How to use checksums |
971fcce6542a5f437416da6132b0f950fda5540ddd1b9f1272c3a66304cc6a1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0
|