Skip to content

Commit

Permalink
πŸ”§: add pre-commit config (#13)
Browse files Browse the repository at this point in the history
* πŸ”§: add pre-commit config

Signed-off-by: nstarman <[email protected]>

* πŸ”§: add rst checks to pre-commit

Signed-off-by: nstarman <[email protected]>

---------

Signed-off-by: nstarman <[email protected]>
  • Loading branch information
nstarman authored Dec 3, 2024
1 parent 696a9e5 commit d210f9e
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI
on:
push:
branches:
- main
- main
tags:
- '*'
- "*"
pull_request:

concurrency:
Expand Down
85 changes: 85 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
ci:
autoupdate_schedule: "quarterly"
autoupdate_commit_msg: "πŸ‘·: update pre-commit hooks"
autofix_commit_msg: "🎨: pre-commit fixes"

default_stages: [pre-commit, pre-push]

repos:
- repo: meta
hooks:
- id: check-useless-excludes

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.3"
hooks:
# Run the linter
- id: ruff
types_or: [python, pyi, jupyter]
args: ["--fix", "--show-fixes"]
# Run the formatter
- id: ruff-format
types_or: [python, pyi, jupyter]

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.19.1"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.3"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.13.0"
hooks:
- id: mypy
files: src
additional_dependencies:
- pytest

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-directive-colons
# Detect mistake of rst directive not ending with double colon.
- id: rst-inline-touching-normal
# Detect mistake of inline code touching normal text in rst.
- id: text-unicode-replacement-char
# Forbid files which have a UTF-8 Unicode replacement character.

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
hooks:
- id: codespell

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.23
hooks:
- id: validate-pyproject

- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
exclude: .pre-commit-config.yaml
2 changes: 1 addition & 1 deletion src/quantity/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _operate(self, other, op, units_helper):
__lt__ = _make_comp("__lt__")
__ne__ = _make_comp("__ne__")

# Atttributes deferred to those of .value
# Attributes deferred to those of .value
dtype = _make_deferred("dtype")
device = _make_deferred("device")
ndim = _make_deferred("ndim")
Expand Down

0 comments on commit d210f9e

Please sign in to comment.