Skip to content

Commit

Permalink
Update pre-commit config and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
b-j-mills committed Feb 7, 2024
1 parent 18e4e43 commit 42140b5
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .config/black.toml

This file was deleted.

17 changes: 8 additions & 9 deletions .config/pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ default_language_version:
python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-ast
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
args: [--config, .config/black.toml]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.292
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
hooks:
# Run the linter.
- id: ruff
args: [--config, .config/ruff.toml, --fix, --exit-non-zero-on-fix]
args: [--config, .config/ruff.toml, --fix]
# Run the formatter.
- id: ruff-format
args: [--config, .config/ruff.toml]
- repo: https://github.com/jazzband/pip-tools
rev: 7.3.0
hooks:
Expand Down
9 changes: 3 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,10 @@ python = ["3.11"]

[tool.hatch.envs.lint]
detached = true
dependencies = [
"black",
"ruff",
]
dependencies = ["ruff"]

[tool.hatch.envs.lint.scripts]
style = [
"ruff --config .config/ruff.toml {args:.}",
"black --config .config/black.toml --check --diff {args:.}",
"ruff check --config .config/ruff.toml --diff {args:.}",
"ruff format --config .config/ruff.toml --diff {args:.}",
]
1 change: 1 addition & 0 deletions src/hapi_schema/db_admin1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Admin1 table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down
1 change: 1 addition & 0 deletions src/hapi_schema/db_admin2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Admin2 table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down
3 changes: 2 additions & 1 deletion src/hapi_schema/db_food_security.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Population table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down Expand Up @@ -79,7 +80,7 @@ class DBFoodSecurity(Base):
DBAdmin1.is_unspecified.label("admin1_is_unspecified"),
DBAdmin2.code.label("admin2_code"),
DBAdmin2.name.label("admin2_name"),
DBAdmin2.is_unspecified.label("admin2_is_unspecified")
DBAdmin2.is_unspecified.label("admin2_is_unspecified"),
).select_from(
# Join pop to admin2 to admin1 to loc
DBFoodSecurity.__table__.join(
Expand Down
1 change: 1 addition & 0 deletions src/hapi_schema/db_humanitarian_needs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""HumanitarianNeeds table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down
1 change: 1 addition & 0 deletions src/hapi_schema/db_location.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Location table and view."""

from datetime import datetime

from sqlalchemy import DateTime, Integer, String, select, text
Expand Down
1 change: 1 addition & 0 deletions src/hapi_schema/db_national_risk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""NationalRisk table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down
3 changes: 2 additions & 1 deletion src/hapi_schema/db_operational_presence.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""OperationalPresence table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down Expand Up @@ -79,7 +80,7 @@ class DBOperationalPresence(Base):
DBOrg.name.label("org_name"),
DBOrg.org_type_code.label("org_type_code"),
DBOrgType.description.label("org_type_description"),
DBSector.name.label("sector_name")
DBSector.name.label("sector_name"),
).select_from(
# Join op to admin2 to admin1 to loc
DBOperationalPresence.__table__.join(
Expand Down
1 change: 1 addition & 0 deletions src/hapi_schema/db_org.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Org table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down
1 change: 1 addition & 0 deletions src/hapi_schema/db_population.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Population table and view."""

from datetime import datetime

from sqlalchemy import (
Expand Down
1 change: 1 addition & 0 deletions src/hapi_schema/db_sector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sector table and view."""

from datetime import datetime

from sqlalchemy import DateTime, String, select, text
Expand Down
2 changes: 1 addition & 1 deletion tests/test_org_type_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def test_org_type_view(run_view_test):
"""Check that org type has all fields."""
dict(code="433", description="Donor"),
(dict(code="433", description="Donor"),)
view_org_type = build_view(view_params_org_type.__dict__)
run_view_test(
view=view_org_type,
Expand Down

0 comments on commit 42140b5

Please sign in to comment.