forked from TissueImageAnalytics/tiatoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
96 lines (96 loc) · 4.57 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
repos:
- repo: local
hooks:
- id: pytest-changed-files
name: pytest-changed-files
entry: pytest
files: tests/.*\btest_\w*.py
require_serial: true
language: system
stages: [push]
- id: notebook-check-ast
name: check notebook ast
entry: python pre-commit/notebook_check_ast.py
types_or: [jupyter]
language: python
- id: notebook-markdown-format
name: notebook markdown format
entry: python pre-commit/notebook_markdown_format.py
require_serial: true
types_or: [jupyter]
language: python
additional_dependencies:
- mdformat
- mdformat-black
- mdformat-myst
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
# Optionally add plugins
additional_dependencies:
- mdformat-gfm # GitHub flavoured markdown
- mdformat-black # Black formatting for python verbatim blocks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast # Simply checks whether the files parse as valid Python.
- id: fix-byte-order-marker # Removes utf-8 byte order marker.
- id: check-json # Checks JSON files for parseable syntax.
- id: check-merge-conflict # Checks for files that contain merge conflict strings.
- id: check-symlinks # Checks for symlinks which do not point to anything.
- id: check-toml # Checks TOML files for parseable syntax.
- id: check-xml # Checks XML files for parseable syntax.
- id: check-yaml # Checks YAML files for parseable syntax.
- id: destroyed-symlinks # Detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to.
- id: detect-private-key # Detects the presence of private keys.
- id: end-of-file-fixer # Ensures that a file is either empty, or ends with one newline.
- id: mixed-line-ending # Replaces or checks mixed line endings.
- id: requirements-txt-fixer # Sorts entries in requirements.txt.
- id: trailing-whitespace # Trims trailing whitespace.
exclude: 'setup.cfg'
- id: file-contents-sorter # Sorts the lines in specified files (defaults to alphabetical).
files: whitelist.txt
- id: debug-statements # Checks for debugger imports and py37+ `breakpoint()` calls in python source.
- id: pretty-format-json # Sets a standard for formatting JSON files.
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks # Detect common mistake of using single backticks when writing rst.
- 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.
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0 # Replace with any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.+
additional_dependencies: ['click==8.0.4'] # Currently >8.0.4 breaks black
- id: black-jupyter
language: python
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies: [
flake8-bugbear, # Detect potential bugs
flake8-builtins, # Check for built-ins being used as variables
flake8-cognitive-complexity, # Check max function complexity
flake8-comprehensions, # Suggestions for better list/set/dict comprehensions
flake8-eradicate, # Find dead/commented out code
flake8-expression-complexity, # Check max expression complexity
flake8-fixme, # Check for FIXME, TODO, and XXX left in comments
flake8-isort, # Check import ordering
flake8-logging-format, # Validate (lack of) logging format strings
flake8-mutable, # Check for mutable default arguments
flake8-pie, # Misc. linting rules
flake8-pytest-style, # Check against pytest style guide
flake8-return, # Check return statements
flake8-simplify, # Suggestions to simplify code
flake8-spellcheck, # Spelling checker
flake8-use-fstring, # Encourages use of f-strings vs old style
pep8-naming, # Check PEP8 class naming
]