Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: add pre-commit hooks and editorconfig #385

Merged
merged 1 commit into from
Sep 19, 2023
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
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_size = 4

[Makefile]
indent_size = 4
indent_style = tab

[*.md]
indent_size = 4
51 changes: 51 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,55 @@
default_install_hook_types:
- commit-msg
- pre-commit
- pre-push

repos:
# Generic hooks that apply to a lot of files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

# The following only check that the files are parseable and does _not_
# modify the formatting.
- id: check-toml
- id: check-xml
- id: check-yaml

- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
hooks:
# As above, this only checks for valid JSON files. This implementation
# allows for comments within JSON files.
- id: check-json5

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
stages: [pre-push]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.289
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
stages: [pre-push]

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
stages: [pre-push]

- repo: https://github.com/commitizen-tools/commitizen
rev: master
hooks:
Expand Down