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:
committed by
GitHub
parent
c5353d889a
commit
8e7f8fc26d
+1
-4
@@ -120,13 +120,10 @@ pygeoapi/db.sqlite3
|
|||||||
# Backup files
|
# Backup files
|
||||||
*~
|
*~
|
||||||
|
|
||||||
# Pre-commit hooks config file
|
|
||||||
.pre-commit-config.yaml
|
|
||||||
|
|
||||||
# Pycharm project files
|
# Pycharm project files
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
# ES data folder
|
# ES data folder
|
||||||
.pygeoapi/docker/examples/elastic/ES/data
|
.pygeoapi/docker/examples/elastic/ES/data
|
||||||
.pygeoapi/docker/examples/mvt-elastic/ES/data
|
.pygeoapi/docker/examples/mvt-elastic/ES/data
|
||||||
.pygeoapi/docker/examples/mvt-tippecanoe/ES/data
|
.pygeoapi/docker/examples/mvt-tippecanoe/ES/data
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
.. _`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:
|
||||||
|
|||||||
@@ -25,3 +25,5 @@ wheel
|
|||||||
pyOpenSSL
|
pyOpenSSL
|
||||||
ndg-httpsclient
|
ndg-httpsclient
|
||||||
pyasn1
|
pyasn1
|
||||||
|
|
||||||
|
pre-commit
|
||||||
|
|||||||
@@ -42,42 +42,42 @@ COMMENT ON SCHEMA topology IS 'PostGIS Topology schema';
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: hstore; Type: EXTENSION; Schema: -; Owner:
|
-- Name: hstore; Type: EXTENSION; Schema: -; Owner:
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;
|
CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner:
|
-- Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner:
|
||||||
--
|
--
|
||||||
|
|
||||||
COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';
|
COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: postgis; Type: EXTENSION; Schema: -; Owner:
|
-- Name: postgis; Type: EXTENSION; Schema: -; Owner:
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
|
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner:
|
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner:
|
||||||
--
|
--
|
||||||
|
|
||||||
COMMENT ON EXTENSION postgis IS 'PostGIS geometry, geography, and raster spatial types and functions';
|
COMMENT ON EXTENSION postgis IS 'PostGIS geometry, geography, and raster spatial types and functions';
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner:
|
-- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner:
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE EXTENSION IF NOT EXISTS postgis_topology WITH SCHEMA topology;
|
CREATE EXTENSION IF NOT EXISTS postgis_topology WITH SCHEMA topology;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner:
|
-- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner:
|
||||||
--
|
--
|
||||||
|
|
||||||
COMMENT ON EXTENSION postgis_topology IS 'PostGIS topology spatial types and functions';
|
COMMENT ON EXTENSION postgis_topology IS 'PostGIS topology spatial types and functions';
|
||||||
@@ -15030,4 +15030,3 @@ REFRESH MATERIALIZED VIEW osm.hotosm_bdi_drains;
|
|||||||
--
|
--
|
||||||
-- PostgreSQL database dump complete
|
-- PostgreSQL database dump complete
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ CONNECT sys/oracle@XEPDB1 AS SYSDBA;
|
|||||||
|
|
||||||
CREATE USER geo_test IDENTIFIED BY geo_test QUOTA UNLIMITED ON USERS;
|
CREATE USER geo_test IDENTIFIED BY geo_test QUOTA UNLIMITED ON USERS;
|
||||||
|
|
||||||
GRANT CONNECT, RESOURCE, DBA TO geo_test;
|
GRANT CONNECT, RESOURCE, DBA TO geo_test;
|
||||||
|
|||||||
Reference in New Issue
Block a user