Skip to content

Commit

Permalink
Lint checks added
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiky30 committed Jan 23, 2024
1 parent 318571e commit 902f9e0
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
python-version: 3.11

- name: Pre-commit checks
# Note: The pre-commit version is duplicated in the pyproject.toml
run: |
pip install pre-commit==3.6.0
pre-commit run --all-files
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.11

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: end-of-file-fixer
- id: detect-private-key
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
72 changes: 72 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,75 @@ classifiers = [
[project.urls]
"Homepage" = "https://github.com/Aiky30/shed-pi"
"Bug Tracker" = "https://github.com/Aiky30/shed-pi/issues"

[tool.black]
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| build
| dist
)/
'''

[tool.ruff]
# Official documentation on ruff rules can be viewed here: https://beta.ruff.rs/docs/rules/
# Please note that some pydocstyle rules do not work for the PEP257 docstring format this repo uses. Please view the
# official documentation for more information: https://www.pydocstyle.org/en/5.0.1/error_codes.html#default-conventions
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort
"N", # pep8-naming
#"D101", # pydocstyle: Missing docstring in public class
#"D102", # pydocstyle: Missing docstring in public method
#"D103", # pydocstyle: Missing docstring in public function
"D201", # pydocstyle: No blank lines allowed before function docstring (found {num_lines})
"D202", # pydocstyle: No blank lines allowed after function docstring (found {num_lines})
"D204", # pydocstyle: 1 blank line required after class docstring
"D206", # pydocstyle: Docstring should be indented with spaces, not tabs
"D207", # pydocstyle: Docstring is under-indented
"D208", # pydocstyle: Docstring is over-indented
"D209", # pydocstyle: Multi-line docstring closing quotes should be on a separate line
"D300", # pydocstyle: Use triple double quotes """
"D403", # pydocstyle: First word of the first line should be properly capitalized
#"ANN001", # flake8-annotations: Missing type annotation for function argument {name}
#"ANN002", # flake8-annotations: Missing type annotation for *{name}
#"ANN003", # flake8-annotations: Missing type annotation for **{name}
#"ANN201", # flake8-annotations: Missing return type annotation for public function {name}
#"ANN202", # flake8-annotations: Missing return type annotation for private function {name}
#"ANN204", # flake8-annotations: Missing return type annotation for special method {name}
#"ANN205", # flake8-annotations: Missing return type annotation for staticmethod {name}
#"ANN206", # flake8-annotations: Missing return type annotation for classmethod {name}
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
#"T20", # flake8-print
"Q", # flake8-quotes
"SLF", # flake8-self
"SIM", # flake8-simplify
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"RUF", # ruff-specific rules
]
exclude = [
".git",
".pytest_cache",
".ruff_cache",
".venv",
".gitignore",
".github",
"migrations"
]
force-exclude = true
line-length = 120
target-version = "py311"

0 comments on commit 902f9e0

Please sign in to comment.