-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from consideRatio/pr/add-pre-commit
Add pre-commit for automated formatting
- Loading branch information
Showing
9 changed files
with
284 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[flake8] | ||
# Ignore style and complexity | ||
# E: style errors | ||
# W: style warnings | ||
# C: complexity | ||
# D: docstring warnings (unused pydocstyle extension) | ||
ignore = E, C, W, D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# pre-commit is a tool to perform a predefined set of tasks manually and/or | ||
# automatically before git commits are made. | ||
# | ||
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level | ||
# | ||
# Common tasks | ||
# | ||
# - Run on all files: pre-commit run --all-files | ||
# - Register git hooks: pre-commit install --install-hooks | ||
# | ||
repos: | ||
# Autoformat: Python code, syntax patterns are modernized | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.4.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: | ||
- --py37-plus | ||
|
||
# Autoformat: Python code | ||
- repo: https://github.com/PyCQA/autoflake | ||
rev: v2.1.1 | ||
hooks: | ||
- id: autoflake | ||
# args ref: https://github.com/PyCQA/autoflake#advanced-usage | ||
args: | ||
- --in-place | ||
|
||
# Autoformat: Python code | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
|
||
# Autoformat: Python code | ||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
|
||
# Autoformat: markdown, yaml | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.0.0-alpha.9-for-vscode | ||
hooks: | ||
- id: prettier | ||
|
||
# Misc... | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
# ref: https://github.com/pre-commit/pre-commit-hooks#hooks-available | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
|
||
# Lint: Python code | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: "6.0.0" | ||
hooks: | ||
- id: flake8 | ||
|
||
# pre-commit.ci config reference: https://pre-commit.ci/#configuration | ||
ci: | ||
autoupdate_schedule: monthly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# autoflake is used for autoformatting Python code | ||
# | ||
# ref: https://github.com/PyCQA/autoflake#readme | ||
# | ||
[tool.autoflake] | ||
ignore-init-module-imports = true | ||
remove-all-unused-imports = true | ||
remove-duplicate-keys = true | ||
remove-unused-variables = true | ||
|
||
|
||
# isort is used for autoformatting Python code | ||
# | ||
# ref: https://pycqa.github.io/isort/ | ||
# | ||
[tool.isort] | ||
profile = "black" | ||
|
||
|
||
# black is used for autoformatting Python code | ||
# | ||
# ref: https://black.readthedocs.io/en/stable/ | ||
# | ||
[tool.black] | ||
# target-version should be all supported versions, see | ||
# https://github.com/psf/black/issues/751#issuecomment-473066811 | ||
target_version = [ | ||
"py37", | ||
"py38", | ||
"py39", | ||
"py310", | ||
"py311", | ||
] |
Oops, something went wrong.