Skip to content
Draft
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
37 changes: 21 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
repos:
- repo: https://github.com/kynan/nbstripout.git
rev: 0.9.0
hooks:
- id: nbstripout
description: "Strips outputs from Jupyter notebooks."
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
description: "Avoid committing large files."
args: ["--maxkb=2000", "--enforce-all"]
- repo: https://github.com/fastai/nbdev
rev: 3.0.14
hooks:
- id: nbdev-clean
args: [--fname=examples]
- repo: https://github.com/kynan/nbstripout.git
rev: 0.9.0
hooks:
- id: nbstripout
description: "Strips outputs from Jupyter notebooks."
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
description: "Avoid committing large files."
args: ["--maxkb=2000", "--enforce-all"]
- repo: https://github.com/fastai/nbdev
rev: 3.0.14
hooks:
- id: nbdev-clean
args: [--fname=examples]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
hooks:
- id: ruff-format
- id: ruff-check
13 changes: 11 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ Make sure the environment is activated before running the following commands.

### Running Checks and Tests

Before committing code, make sure all tests and checks pass:
Before committing code, make sure the checks pass. A typical workflow is:

```
make format
make static-checks
```

and if you want to run all the tests:
`make format` fixes formatting and lint issues, and `make static-checks` validates
formatting, linting, markdown formatting, and type checking.

If you only want the hook-based file checks, run:

```
pre-commit run --all-files
```

To run all the tests:

```
make test
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,12 @@ format: add-header
# run format check
.PHONY: format-check
format-check:
# Check code formatting
ruff format --check .
# Check linting issues
ruff check .
# Run pre-commit hooks
pre-commit run --all-files
# Check markdown formatting
mdformat --check ${MDFORMAT_FILES}
# Check code in markdown files
pytest docs/format_code.py::test_format_check_code_in_docs
# Run pre-commit hooks
pre-commit run --all-files

# run type check
.PHONY: type-check
Expand Down
Loading