Add ruff to pre-commit Hooks (#3488)

This commit is contained in:
Aditya 2023-01-06 20:49:49 +05:30 committed by GitHub
parent d48fa71ec5
commit bbb9fcaaa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -79,3 +79,15 @@ repos:
args:
- --diff
- --check
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.212'
hooks:
- id: ruff
name: ruff
files: ^(telegram|examples)/.*\.py$
additional_dependencies:
- httpx~=0.23.0
- tornado~=6.2
- APScheduler~=3.9.1
- cachetools~=5.2.0
- aiolimiter~=1.0.0

View file

@ -344,7 +344,7 @@ class TGConstXRefRole(PyXRefRole):
return title, target
except Exception as exc:
sphinx_logger.exception(
f"%s:%d: WARNING: Did not convert reference %s due to an exception.",
"%s:%d: WARNING: Did not convert reference %s due to an exception.",
refnode.source,
refnode.line,
refnode.rawsource,
@ -509,7 +509,7 @@ def _git_branch() -> str:
return output.decode().strip()
except Exception as exc:
sphinx_logger.exception(
f"Failed to get a description of the current commit. Falling back to `master`.",
"Failed to get a description of the current commit. Falling back to `master`.",
exc_info=exc,
)
return "master"

View file

@ -5,3 +5,6 @@ target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
[tool.isort] # black config
profile = "black"
line_length = 99
[tool.ruff]
line-length = 99