Skip to content

Commit

Permalink
ruff format (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio authored Jan 21, 2024
1 parent 5e8d177 commit de45abf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 41 deletions.
14 changes: 5 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,23 @@ repos:
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/psf/black
rev: 23.12.0
hooks:
- id: black
args:
- --safe
- --quiet
files: ^((xknxproject|test)/.+)?[^/]+\.py$
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
files: ^(xknxproject|examples|docs)/.+\.py$
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.8'
rev: 'v0.1.11'
hooks:
- id: ruff
# in CI it is directly run by tox to allow dependency upgrade checks
stages: [pre-commit]
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format
files: ^((xknxproject|test)/.+)?[^/]+\.py$
# in CI it is directly run by tox to allow dependency upgrade checks
stages: [pre-commit]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand Down
48 changes: 19 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,34 @@ requires = ["setuptools>=62.3"]
build-backend = "setuptools.build_meta"

[project]
name = "xknxproject"
authors = [
{name = "Marvin Wichmann", email = "[email protected]"},
{name = "Matthias Alphart", email = "[email protected]"},
name = "xknxproject"
authors = [
{ name = "Marvin Wichmann", email = "[email protected]" },
{ name = "Matthias Alphart", email = "[email protected]" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
]
dependencies = [
"pyzipper>=0.3.6",
"striprtf>=0.0.26",
]
description = "A library to gather information from ETS project files used for KNX"
dynamic = ["version"]
keywords = ["KNX", "ETS", "Home Assistant"]
license = {file = "LICENSE"}
readme = "README.md"
dependencies = ["pyzipper>=0.3.6", "striprtf>=0.0.26"]
description = "A library to gather information from ETS project files used for KNX"
dynamic = ["version"]
keywords = ["KNX", "ETS", "Home Assistant"]
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.9.0"

[project.urls]
homepage = "https://github.com/XKNX/xknxproject"


[tool.setuptools.dynamic]
version = {attr = "xknxproject.__version__.__version__"}
version = { attr = "xknxproject.__version__.__version__" }

[tool.setuptools.packages.find]
include = ["xknxproject*"]

[tool.black]
exclude = "generated"


[tool.mypy]
python_version = "3.9"
Expand All @@ -54,7 +48,7 @@ reports = "no"

[tool.pylint.message_control]
# Reasons disabled:
# format - handled by black
# format - handled by ruff
# locally-disabled - it spams too much
# duplicate-code - unavoidable
# cyclic-import - doesn't test if both import on load
Expand Down Expand Up @@ -90,14 +84,12 @@ disable = [
"too-many-boolean-expressions",
"unused-argument",
"wrong-import-order",
]
]
# disabled for tests via command line options in Makefile:
# - no-self-use
# - protected-access
# - abstract-class-instantiated
enable = [
"use-symbolic-message-instead",
]
enable = ["use-symbolic-message-instead"]

[tool.pylint.format]
expected-line-ending-format = "LF"
Expand Down Expand Up @@ -129,9 +121,7 @@ ignore = [
"D212",
"E501", # line too long
]
extend-exclude = [
"script",
]
extend-exclude = ["script"]

[tool.ruff.isort]
force-sort-within-sections = true
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[flake8]
exclude = .venv,.git,.tox,bin,lib,deps,build
# black requires this
max-line-length = 88
# D202 No blank lines allowed after function docstring
# E203: Whitespace before ':'
# E501: line too long
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ commands =
pre-commit run codespell {posargs: --all-files}
pre-commit run flake8 {posargs: --all-files}
pre-commit run pyupgrade {posargs: --all-files}
pre-commit run black {posargs: --all-files}
pre-commit run check-json {posargs: --all-files}
pre-commit run trailing-whitespace {posargs: --all-files}

Expand All @@ -37,6 +36,7 @@ commands =
basepython = python3
commands =
ruff check {posargs:.}
ruff format {posargs:.}

[testenv:typing]
basepython = python3
Expand Down

0 comments on commit de45abf

Please sign in to comment.