Added pre-commit config file (#1508)

* Added .pre-commit-config.yaml file

* Initial pass of pre-commit with its default rules and flake8

* Revert "Initial pass of pre-commit with its default rules and flake8"

This reverts commit 86d39e964e8122580d675f4639ae2d15b85c02e2.

* Made pre-commit only act on code files

* Added sql to the pre-commit file pattern

* Initial pass of pre-commit
This commit is contained in:
Ricardo Garcia Silva
2024-01-30 17:37:16 +00:00
committed by GitHub
parent c5353d889a
commit 8e7f8fc26d
6 changed files with 48 additions and 12 deletions
-3
View File
@@ -120,9 +120,6 @@ pygeoapi/db.sqlite3
# Backup files
*~
# Pre-commit hooks config file
.pre-commit-config.yaml
# Pycharm project files
.idea
+19
View File
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
files: '\.(py|sh|sql)$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
+19
View File
@@ -106,3 +106,22 @@ Set the variable for the Spatialite library under OSX:
.. _`GitHub Actions setup`: https://github.com/geopython/pygeoapi/blob/master/.github/workflows/main.yml
Using pre-commit
----------------
You may optionally use `pre-commit`_ in order to check for linting and other static issues
before committing changes. Pygeoapi's repo includes a ``.pre-commit.yml``
file, check the pre-commit docs on how to set it up - in a nutshell:
- pre-commit is mentioned in pygeoapi's ``requirements-dev.txt`` file, so it will be included
when you pip install those
- run ``pre-commit install`` once in order to install its git commit hooks.
- optionally, run ``pre-commit run --all-files``, which will run all pre-commit hooks for all files in the repo.
This also prepares the pre-commit environment.
- from now on, whenever you do a ``git commit``, the pre-commit hooks will run and the commit
will only be done if all checks pass
.. _pre-commit:
+2
View File
@@ -25,3 +25,5 @@ wheel
pyOpenSSL
ndg-httpsclient
pyasn1
pre-commit
-1
View File
@@ -15030,4 +15030,3 @@ REFRESH MATERIALIZED VIEW osm.hotosm_bdi_drains;
--
-- PostgreSQL database dump complete
--