mirror of
https://github.com/frappe/erpnext.git
synced 2024-06-02 18:31:06 +00:00
chore: switch to ruff for python formatting/linting
This commit is contained in:
parent
8c7213ad7d
commit
8afb7790de
|
@ -55,28 +55,15 @@ repos:
|
||||||
erpnext/templates/includes/.*
|
erpnext/templates/includes/.*
|
||||||
)$
|
)$
|
||||||
|
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: 6.0.0
|
rev: v0.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: ruff
|
||||||
additional_dependencies: [
|
name: "Run ruff linter and apply fixes"
|
||||||
'flake8-bugbear',
|
args: ["--fix"]
|
||||||
'flake8-tuple',
|
|
||||||
]
|
|
||||||
args: ['--config', '.github/helper/.flake8_strict']
|
|
||||||
exclude: ".*setup.py$"
|
|
||||||
|
|
||||||
- repo: https://github.com/adityahase/black
|
- id: ruff-format
|
||||||
rev: 9cb0a69f4d0030cdf687eddf314468b39ed54119
|
name: "Format Python code"
|
||||||
hooks:
|
|
||||||
- id: black
|
|
||||||
additional_dependencies: ['click==8.0.4']
|
|
||||||
|
|
||||||
- repo: https://github.com/PyCQA/isort
|
|
||||||
rev: 5.12.0
|
|
||||||
hooks:
|
|
||||||
- id: isort
|
|
||||||
exclude: ".*setup.py$"
|
|
||||||
|
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
|
|
|
@ -28,17 +28,42 @@ dependencies = [
|
||||||
requires = ["flit_core >=3.4,<4"]
|
requires = ["flit_core >=3.4,<4"]
|
||||||
build-backend = "flit_core.buildapi"
|
build-backend = "flit_core.buildapi"
|
||||||
|
|
||||||
[tool.black]
|
|
||||||
line-length = 99
|
|
||||||
|
|
||||||
[tool.isort]
|
|
||||||
line_length = 99
|
|
||||||
multi_line_output = 3
|
|
||||||
include_trailing_comma = true
|
|
||||||
force_grid_wrap = 0
|
|
||||||
use_parentheses = true
|
|
||||||
ensure_newline_before_comments = true
|
|
||||||
indent = "\t"
|
|
||||||
|
|
||||||
[tool.bench.frappe-dependencies]
|
[tool.bench.frappe-dependencies]
|
||||||
frappe = ">=16.0.0-dev,<17.0.0"
|
frappe = ">=16.0.0-dev,<17.0.0"
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 110
|
||||||
|
target-version = "py310"
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
|
select = [
|
||||||
|
"F",
|
||||||
|
"E",
|
||||||
|
"W",
|
||||||
|
"I",
|
||||||
|
"UP",
|
||||||
|
"B",
|
||||||
|
"RUF",
|
||||||
|
]
|
||||||
|
ignore = [
|
||||||
|
"B017", # assertRaises(Exception) - should be more specific
|
||||||
|
"B018", # useless expression, not assigned to anything
|
||||||
|
"B023", # function doesn't bind loop variable - will have last iteration's value
|
||||||
|
"B904", # raise inside except without from
|
||||||
|
"E101", # indentation contains mixed spaces and tabs
|
||||||
|
"E402", # module level import not at top of file
|
||||||
|
"E501", # line too long
|
||||||
|
"E741", # ambiguous variable name
|
||||||
|
"F401", # "unused" imports
|
||||||
|
"F403", # can't detect undefined names from * import
|
||||||
|
"F405", # can't detect undefined names from * import
|
||||||
|
"F722", # syntax error in forward type annotation
|
||||||
|
"W191", # indentation contains tabs
|
||||||
|
"RUF001", # string contains ambiguous unicode character
|
||||||
|
]
|
||||||
|
typing-modules = ["frappe.types.DF"]
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
quote-style = "double"
|
||||||
|
indent-style = "tab"
|
||||||
|
docstring-code-format = true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user