flake8_qgis
A flake8 plugin for QGIS3 python plugins written in Python.
Made with Cookiecutter template cookiecutter-flake8-plugin. Inspired by flake8-simplify.
Installation
Install with pip:
pip install flake8-qgis
Usage
Just call flake8 . in your package or flake your.py.
Rules
QGS101: Don't use from-imports from qgis projected members (example)QGS102: Don't use imports from qgis projected members (example)QGS103: Don't use from-imports from PyQt directly (example)QGS104: Don't use imports from PyQt directly (example)QGS105: Don't pass QgisInterface as an argument (example)
You might have good reasons to ignore some rules.
To do that, use the standard Flake8 configuration. For example, within the setup.cfg file:
[flake8]
ignore = QGS101, QGS102
Examples
QGS101
# Bad
from qgs._core import QgsMapLayer, QgsVectorLayer
# Good
from qgs.core import QgsMapLayer, QgsVectorLayer
QGS102
# Bad
import qgs._core.QgsVectorLayer as QgsVectorLayer
# Good
import qgs.core.QgsVectorLayer as QgsVectorLayer
QGS103
# Bad
from PyQt5.QtCore import pyqtSignal
# Good
from qgis.PyQt.QtCore import pyqtSignal
QGS104
# Bad
import PyQt5.QtCore.pyqtSignal as pyqtSignal
# Good
import qgis.PyQt.QtCore.pyqtSignal as pyqtSignal
QGS105
# Bad: iface passed as argument
def some_function(somearg, iface):
# do something with iface
# Good
from qgis.utils import iface
def some_function(somearg):
# iface imported
Metadata
Release files for flake8-qgis 0.1.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_qgis-0.1.0.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_qgis-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / flake8_qgis-0.1.0.tar.gz
| Download URL | flake8_qgis-0.1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e41099d625e73473ea2a2b135a0e47938e991a298c82e0e0b5078d711cf2a66
|
|
BLAKE2b-256 checksum How to use checksums |
43bec3026c243affcfe501d2f84422efb91c7cbf58850e2c83a736d10a7fb6dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Release files / flake8_qgis-0.1.0-py3-none-any.whl
| Download URL | flake8_qgis-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaeb0b205b234a3c3bff20f6f17f0b98d481b000fad91fece729879402d931aa
|
|
BLAKE2b-256 checksum How to use checksums |
0644c7fdc510cd2b58974cb9c23915c085e4d3c23ab390325a73256b270c470e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|