diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.4.0 + hooks: + - id: trailing-whitespace + - id: flake8 + - id: check-json + - id: check-yaml + +- repo: https://github.com/codespell-project/codespell + rev: v1.16.0 + hooks: + - id: codespell + exclude: TODO + args: [-L iff] + +- repo: local + hooks: + - id: mypy + name: mypy + entry: mypy + args: [swh] + pass_filenames: false + language: system + types: [python] + +# unfortunately, we are far from being able to enable this... +#- repo: https://github.com/PyCQA/pydocstyle.git +# rev: 4.0.0 +# hooks: +# - id: pydocstyle +# name: pydocstyle +# description: pydocstyle is a static analysis tool for checking compliance with Python docstring conventions. +# entry: pydocstyle --convention=google +# language: python +# types: [python] + +# black requires py3.6+ +#- repo: https://github.com/python/black +# rev: 19.3b0 +# hooks: +# - id: black +# language_version: python3 +#- repo: https://github.com/asottile/blacken-docs +# rev: v1.0.0-1 +# hooks: +# - id: blacken-docs +# additional_dependencies: [black==19.3b0] diff --git a/mypy.ini b/mypy.ini --- a/mypy.ini +++ b/mypy.ini @@ -2,7 +2,7 @@ namespace_packages = True # due to the conditional import logic on swh.journal, in some cases a specific -# type: ignore is neede, in other it isn't... +# type: ignore is needed, in other it isn't... warn_unused_ignores = False # support for sqlalchemy magic: see https://github.com/dropbox/sqlalchemy-stubs diff --git a/sql/clusters.dot b/sql/clusters.dot --- a/sql/clusters.dot +++ b/sql/clusters.dot @@ -3,7 +3,7 @@ style = rounded; bgcolor = gray95; color = gray; - + subgraph cluster_meta { label = <schema versioning
version: @@VERSION@@>; dbversion; diff --git a/sql/upgrades/032.sql b/sql/upgrades/032.sql --- a/sql/upgrades/032.sql +++ b/sql/upgrades/032.sql @@ -1,7 +1,7 @@ -- SWH DB schema upgrade -- from_version: 30 -- to_version: 32 --- description: Reading data improvment on directory and release data. +-- description: Reading data improvement on directory and release data. insert into dbversion(version, release, description) values(32, now(), 'Work In Progress'); diff --git a/sql/upgrades/049.sql b/sql/upgrades/049.sql --- a/sql/upgrades/049.sql +++ b/sql/upgrades/049.sql @@ -83,7 +83,7 @@ and (select visit from origin_visit where origin = origin_id order by date desc - limit 1) = any(visits); + limit 1) = any(visits); $$; create or replace function update_occurrence() returns void diff --git a/sql/upgrades/137.sql b/sql/upgrades/137.sql --- a/sql/upgrades/137.sql +++ b/sql/upgrades/137.sql @@ -89,7 +89,7 @@ comment on column person.fullname is 'Full name (raw name)'; -- comment for columns of revision -comment on table revision is 'Revision represents the state of a source code tree at a +comment on table revision is 'Revision represents the state of a source code tree at a specific point in time'; comment on column revision.id is 'Git id of sha1 checksum'; comment on column revision.date is 'Timestamp when revision was authored'; diff --git a/swh/storage/sql/30-swh-schema.sql b/swh/storage/sql/30-swh-schema.sql --- a/swh/storage/sql/30-swh-schema.sql +++ b/swh/storage/sql/30-swh-schema.sql @@ -239,7 +239,7 @@ committer_date_neg_utc_offset boolean ); -comment on table revision is 'Revision represents the state of a source code tree at a +comment on table revision is 'Revision represents the state of a source code tree at a specific point in time'; comment on column revision.id is 'Git id of sha1 checksum'; comment on column revision.date is 'Timestamp when revision was authored'; diff --git a/swh/storage/sql/40-swh-func.sql b/swh/storage/sql/40-swh-func.sql --- a/swh/storage/sql/40-swh-func.sql +++ b/swh/storage/sql/40-swh-func.sql @@ -10,7 +10,7 @@ -- TBLNAME -- -- Args: --- tblname: name of the table to mimick +-- tblname: name of the table to mimic create or replace function swh_mktemp(tblname regclass) returns void language plpgsql @@ -33,7 +33,7 @@ -- This is used to create the tmp_directory_entry_ tables. -- -- Args: --- tblname: name of the table to mimick +-- tblname: name of the table to mimic create or replace function swh_mktemp_dir_entry(tblname regclass) returns void language plpgsql diff --git a/swh/storage/tests/conftest.py b/swh/storage/tests/conftest.py --- a/swh/storage/tests/conftest.py +++ b/swh/storage/tests/conftest.py @@ -118,7 +118,7 @@ # This version of the DatabaseJanitor implement a different setup/teardown -# behavior than than the stock one: instead of droping, creating and +# behavior than than the stock one: instead of dropping, creating and # initializing the database for each test, it create and initialize the db only # once, then it truncate the tables. This is needed to have acceptable test # performances.