Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ repos:
pass_filenames: false
language: system # use the project's own pyrefly install so versions stay in sync with pyproject.toml

# interrogate (docstring coverage)
- repo: https://github.com/econchick/interrogate
rev: 1.7.0
hooks:
- id: interrogate
pass_filenames: false # config (incl. exclude paths) lives in pyproject.toml

# sqlfluff
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.5.0
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ lock:
format:
uv run ruff format --check .

lint: lint-python lint-sql
lint: lint-python lint-sql lint-docstrings

lint-python:
uv run ruff check --output-format=github .

lint-sql:
uv run sqlfluff lint .

lint-docstrings:
uv run interrogate

type:
uv run pyrefly check

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ The checks contained in this repo include (in the order in which they run):
* `ruff` checks code for "lint"
* `pyrefly` is used for static type checking
* `sqlfluff` checks and fixes sql formatting and linting
* `interrogate` checks docstring coverage
* `uv` checks on valid and aligned pyproject.toml and uv.lock files
* `commitlint` enforces commit message conforms to [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format

Expand All @@ -114,4 +115,3 @@ If you absolutely must commit without adhering to the prek hooks, then you can u
* [ ] switch from `nox` to `tox` (tox is more widely used and prevents python abuse - e.g. setup.py can become too complicated)
* make sure tox goes fast - https://hynek.me/articles/turbo-charge-tox/
* [ ] switch `coverage` to not report until the end and combine all coverage reports together into one
* [ ] add [`interrogate`](https://github.com/econchick/interrogate) to prek and test suite
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ df = [

[dependency-groups]
dev = [
"interrogate >=1.7.0,<2",
"mkdocs >=1.6.0,<2",
"mkdocs-material >=9.4.5,<10",
"mkdocstrings[python] >=0.25.2,<1",
Expand All @@ -41,6 +42,16 @@ dev = [
packages = ["src/sample"]


#############
# Interrogate
#############
[tool.interrogate]
fail-under = 100
ignore-init-method = true
verbose = 1
exclude = ["tests", "docs", "noxfile.py"]


##########
# Coverage
##########
Expand Down
14 changes: 14 additions & 0 deletions src/sample/sample_with_extra_install.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
A placeholder module for sample content requiring the "df" extra install
"""

try:
import pandas as pd
except ImportError:
Expand All @@ -7,6 +11,16 @@


class SampleWithExtraInstall(Sample):
"""
Sample class requiring the "df" extra install
"""

def sample_extra(self):
"""
Sample method which returns an empty pandas DataFrame

Returns:
df (pandas.DataFrame): empty DataFrame
"""
df = pd.DataFrame()
return df
71 changes: 71 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading