Skip to content

Commit

Permalink
chore(cicd): use ruff as formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
dynobo committed Nov 3, 2023
1 parent dcbfe03 commit e100277
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
run: poetry install
- name: Ruff
run: poetry run ruff check .
- name: Black
run: poetry run black --check .
- name: Ruff format
run: poetry run ruff format --check --diff .
- name: Mypy
run: poetry run mypy
- name: Pytest
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ repos:
entry: poetry run mdformat --wrap 88
types: [markdown]

- id: black
name: black
- id: ruff-format
name: ruff-format
stages: [commit]
language: system
entry: poetry run black keyhint/ tests/
entry: poetry run ruff format .
types: [python]

- id: pip-audit
Expand Down
68 changes: 61 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ classifiers = [
keyhint = "keyhint.app:main"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.11"
PyGObject = "^3.42.2"
PyYAML = "^6.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.1"
rope = "^1.7.0"
black = "^23.1.0"
pytest-cov = "^4.0.0"
pre-commit = "^3.0.4"
coveralls = "^3.3.1"
Expand All @@ -48,16 +47,71 @@ viztracer = "^0.15.6"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
profile = "black"
multi_line_output = 3

[tool.mypy]

files = ["keyhint/**/*.py", "tests/**/*.py"]
ignore_missing_imports = true
follow_imports_for_stubs = true

[tool.ruff]
target-version = "py311"
line-length = 88
exclude = [".venv"]
select = [
"F", # Pyflakes
"E", # pycodestyle
"I", # Isort
"D", # pydocstyle
"W", # warning
"UP", # pyupgrad
"N", # pep8-naming
"C90", # mccabe
"TRY", # tryceratops (exception handling)
"ANN", # flake8-annotations
"S", # flake8-bandits
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A", # flake8-builtins
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"PTH", # flake8-use-pathlib
"G", # flake8-logging-format
"PL", # pylint
"RUF", # meta rules (unused noqa)
"PL", # meta rules (unused noqa)
"PERF", # perflint
]
ignore = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in __init__
"ANN101", # Missing type annotation for `self` in method
"TRY003", # Avoid specifying long messages outside the exception class
"ISC001", # Rule conflicts with ruff's formaatter
]

[tool.ruff.per-file-ignores]
"tests/**/*" = ["PLR2004", "PLR0913", "S101", "TID252", "ANN", "D"]

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.isort]
known-first-party = ["normcap"]

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"


[tool.tbump]

[tool.tbump.version]
Expand Down

0 comments on commit e100277

Please sign in to comment.