replace pylint with flake8 everywhere

This commit is contained in:
Sarah Hoffmann
2024-11-10 23:14:09 +01:00
parent 122ecd4626
commit d77aa7dfc9
5 changed files with 16 additions and 9 deletions

8
.flake8 Normal file
View File

@@ -0,0 +1,8 @@
[flake8]
max-line-length = 100
max-doc-length = 100
extend-ignore =
# something == None constructs are needed for SQLAlchemy
E711
per-file-ignores =
__init__.py: F401

View File

@@ -103,12 +103,12 @@ jobs:
- name: Install Python webservers - name: Install Python webservers
run: pip3 install falcon starlette asgi_lifespan run: pip3 install falcon starlette asgi_lifespan
- name: Install latest pylint - name: Install latest flake8
run: pip3 install -U pylint run: pip3 install -U flake8
if: matrix.flavour == 'ubuntu-22' if: matrix.flavour == 'ubuntu-22'
- name: Python linting - name: Python linting
run: python3 -m pylint src run: python3 -m flake8 src
working-directory: Nominatim working-directory: Nominatim
if: matrix.flavour == 'ubuntu-22' if: matrix.flavour == 'ubuntu-22'

View File

@@ -60,10 +60,10 @@ are in process of consolidating the style. The following rules apply:
* leave out space between a function name and bracket * leave out space between a function name and bracket
but add one between control statement(if, while, etc.) and bracket but add one between control statement(if, while, etc.) and bracket
The coding style is enforced with pylint. It can be tested with: The coding style is enforced with flake8. It can be tested with:
``` ```
pylint3 --extension-pkg-whitelist=osmium nominatim make lint
``` ```
## Testing ## Testing

View File

@@ -24,7 +24,7 @@ pytest:
pytest test/python pytest test/python
lint: lint:
pylint src flake8 src
bdd: bdd:
cd test/bdd; behave -DREMOVE_TEMPLATE=1 cd test/bdd; behave -DREMOVE_TEMPLATE=1

View File

@@ -29,7 +29,7 @@ The Nominatim test suite consists of behavioural tests (using behave) and
unit tests (using pytest). It has the following additional requirements: unit tests (using pytest). It has the following additional requirements:
* [behave test framework](https://behave.readthedocs.io) >= 1.2.6 * [behave test framework](https://behave.readthedocs.io) >= 1.2.6
* [Pylint](https://pylint.org/) (CI always runs the latest version from pip) * [flake8](https://flake8.pycqa.org/en/stable/) (CI always runs the latest version from pip)
* [mypy](http://mypy-lang.org/) (plus typing information for external libs) * [mypy](http://mypy-lang.org/) (plus typing information for external libs)
* [Python Typing Extensions](https://github.com/python/typing_extensions) (for Python < 3.9) * [Python Typing Extensions](https://github.com/python/typing_extensions) (for Python < 3.9)
* [pytest](https://pytest.org) * [pytest](https://pytest.org)
@@ -55,7 +55,6 @@ the vendored version of osm2pgsql, you need to set the PATH accordingly.
### Installing prerequisites on Ubuntu/Debian ### Installing prerequisites on Ubuntu/Debian
The Python tools should always be run with the most recent version. The Python tools should always be run with the most recent version.
In particular, pylint tends to have a lot of breaking changes between versions.
The easiest way, to handle these Python dependencies is to run your The easiest way, to handle these Python dependencies is to run your
development from within a virtual environment. development from within a virtual environment.
@@ -70,7 +69,7 @@ virtualenv ~/nominatim-dev-venv
~/nominatim-dev-venv/bin/pip install\ ~/nominatim-dev-venv/bin/pip install\
psutil psycopg[binary] PyICU SQLAlchemy \ psutil psycopg[binary] PyICU SQLAlchemy \
python-dotenv jinja2 pyYAML datrie behave \ python-dotenv jinja2 pyYAML datrie behave \
mkdocs mkdocstrings mkdocs-gen-files pytest pytest-asyncio pylint \ mkdocs mkdocstrings mkdocs-gen-files pytest pytest-asyncio flake8 \
types-jinja2 types-markupsafe types-psutil types-psycopg2 \ types-jinja2 types-markupsafe types-psutil types-psycopg2 \
types-pygments types-pyyaml types-requests types-ujson \ types-pygments types-pyyaml types-requests types-ujson \
types-urllib3 typing-extensions unicorn falcon starlette \ types-urllib3 typing-extensions unicorn falcon starlette \