Add pre-commit

This commit is contained in:
Jordan Cook 2023-07-10 18:48:43 -05:00
parent 673d10b823
commit 445827690a
14 changed files with 45 additions and 11 deletions

22
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
hooks:
- id: blacken-docs
args: [--skip-errors, --skip-string-normalization]
- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
hooks:
- id: isort

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 Jordan Cook
Copyright (c) 2023 Jordan Cook
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -3,7 +3,7 @@ SOURCE_DIR = pages
BUILD_DIR = _build/html
TAGS_DIR = pages/tags
all: clean docs linkcheck size publish
all: clean lint docs linkcheck size publish
clean:
rm -rf $(BUILD_DIR) $(TAGS_DIR)
@ -11,6 +11,9 @@ clean:
docs:
sphinx-build $(SOURCE_DIR) $(BUILD_DIR)
lint:
pre-commit run --all
linkcheck:
sphinx-build -b linkcheck $(SOURCE_DIR) $(BUILD_DIR)

View File

@ -116,4 +116,3 @@ insects, spiders, and other tiny curiosities.
```
[_Artomyces pyxidatus_ (Crown-tipped Coral Fungus)](https://flickr.com/photos/jcook83/48921844066)
:::

View File

@ -86,4 +86,3 @@ and photograph some plants in a small indoor garden.
```
[_Dioscorea elephantipes_ (Elephant's Foot)](https://flickr.com/photos/jcook83/50552435987)
:::

8
pyproject.toml Normal file
View File

@ -0,0 +1,8 @@
[tool.black]
skip-string-normalization = true
line-length = 100
[tool.isort]
profile = 'black'
line_length = 100
skip_gitignore = true

View File

@ -7,3 +7,6 @@ sphinx-copybutton>=0.5
sphinx-design>=0.4
sphinx-notfound-page>=0.8
sphinx-tags>=0.2
# dev tools; not required for doc builds
pre-commit~=3.0