mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
refactor: replace black with ruff-format
This commit is contained in:
parent
912c7d395c
commit
52ead9336d
2 changed files with 15 additions and 50 deletions
|
@ -2,23 +2,21 @@ default_language_version:
|
|||
# force all unspecified python hooks to run python3
|
||||
python: python3.10
|
||||
|
||||
ci:
|
||||
autofix_prs: false
|
||||
#ci:
|
||||
# autofix_prs: false
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
entry: black xonsh xontrib tests xompletions
|
||||
pass_filenames: false
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: 'v0.3.5'
|
||||
rev: 'v0.3.7'
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [., --fix, --exit-non-zero-on-fix]
|
||||
pass_filenames: false
|
||||
- id: ruff-format
|
||||
args: ["xonsh", "xontrib", "tests", "xompletions"]
|
||||
pass_filenames: false
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: 'v1.9.0' # Use the sha / tag you want to point at
|
||||
hooks:
|
||||
|
|
|
@ -146,43 +146,7 @@ xonsh-uname = "xonsh.xoreutils.uname:main"
|
|||
xonsh-uptime = "xonsh.xoreutils.uptime:main"
|
||||
|
||||
|
||||
[tool.black]
|
||||
# better to keep default line-length than to match flake8
|
||||
exclude = '''
|
||||
( # exclude entire contents of these top level directories...
|
||||
/( \.eggs
|
||||
| \.git
|
||||
| \.hg
|
||||
| \.mypy
|
||||
| _cache
|
||||
| \.nox
|
||||
| \.tox
|
||||
| \.venv
|
||||
| _build
|
||||
| buck-out
|
||||
| build
|
||||
| dist
|
||||
)/
|
||||
|
||||
)
|
||||
|
|
||||
( # and these additional random rules
|
||||
/( __pycache__
|
||||
| \.circleci
|
||||
| \.github
|
||||
| \.vscode
|
||||
| \.pytest_cache
|
||||
| ply
|
||||
)/
|
||||
)
|
||||
'''
|
||||
|
||||
extend_exclude = '''
|
||||
((xonsh/parser_table.py)|(xonsh/completion_parser_table.py))
|
||||
'''
|
||||
|
||||
|
||||
[tool.ruff.isort]
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = ["xonsh", "xontrib", "xompletions", "tests"]
|
||||
known-third-party = ["ply", "pytest"]
|
||||
|
||||
|
@ -190,7 +154,7 @@ known-third-party = ["ply", "pytest"]
|
|||
src = [
|
||||
"xonsh", "xontrib", "xompletions", "tests"
|
||||
]
|
||||
exclude = [
|
||||
extend-exclude = [
|
||||
"docs/",
|
||||
"*/ply/",
|
||||
"parser*_table.py",
|
||||
|
@ -204,6 +168,9 @@ exclude = [
|
|||
".venv*/",
|
||||
".local.out*/",
|
||||
]
|
||||
line-length = 180
|
||||
|
||||
[tool.ruff.lint]
|
||||
ignore = [
|
||||
"D100", # Missing docstring in public module
|
||||
"D101", # Missing docstring in public class
|
||||
|
@ -231,7 +198,6 @@ ignore = [
|
|||
"E402", # Module level import not at top of file
|
||||
"E731", # Do not assign a lambda expression, use a def
|
||||
]
|
||||
line-length = 180
|
||||
select = [
|
||||
"B", # https://beta.ruff.rs/docs/rules/#flake8-bugbear-b
|
||||
"D", # https://beta.ruff.rs/docs/rules/#pydocstyle-d
|
||||
|
@ -239,15 +205,16 @@ select = [
|
|||
"F", # https://beta.ruff.rs/docs/rules/#pyflakes-f
|
||||
"I", # https://beta.ruff.rs/docs/rules/#isort-i
|
||||
"T10", # https://beta.ruff.rs/docs/rules/#flake8-debugger-t10
|
||||
"TID", # https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
|
||||
"YTT", # https://beta.ruff.rs/docs/rules/#flake8-2020-ytt
|
||||
"W", # https://beta.ruff.rs/docs/rules/#pycodestyle-e-w
|
||||
"UP", # https://beta.ruff.rs/docs/rules/#pyupgrade-up
|
||||
]
|
||||
|
||||
[tool.ruff.pydocstyle]
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "numpy"
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"xonsh/timings.py" = ["F401"]
|
||||
"xonsh/history.py" = ["F821"]
|
||||
"xonsh/lexer.py" = ["E741"]
|
||||
|
|
Loading…
Add table
Reference in a new issue