Skip to content

Commit

Permalink
[CodeStyle] add pre-commit hook for ruff and isort (PaddlePaddl…
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooo-create authored Oct 23, 2023
1 parent d3bd986 commit a450a49
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ repos:
entry: python .pre-commit-hooks/convert_markdown_into_html.py
language: system
files: .+README(\.cn)?\.md$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --no-cache]
95 changes: 95 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,98 @@
exclude = "build"
line-length = 80
skip-string-normalization = true

[tool.ruff]
target-version = "py37"
select = [
# Pycodestyle
"E",
"W",

# Pyflakes
"F",

# Isort
"I",

# Comprehensions
"C4",

# Pyupgrade
"UP",

# NumPy-specific rules
"NPY001",
"NPY003",

# Bugbear
"B002",
"B003",
"B004",
"B009",
"B010",
"B011",
"B012",
"B013",
"B014",
"B015",
"B016",
"B017",
"B018",
"B019",
"B020",
"B021",
"B022",
"B025",
"B029",
"B032",

# Pylint
"PLE",
"PLC0414",
"PLC3002",
"PLR0206",
"PLR0402",
"PLR1701",
"PLR1711",
"PLR1722",
"PLW3301",

# Pygrep-hooks
"PGH004",
]
unfixable = [
"NPY001"
]
ignore = [
"E402",
"E501",
"E722",
"E731",
"E741",
"F841",
"UP015",
"UP038",
# need to remove
"F541",
"I001",
"UP032",
"F401",
"UP025",
"W291",
"PLR1722",
"C403",
"C405",
"UP004",
"UP008",
"C414",
"C416",
"C419",
"E401",
"E711",
"E712",
"F811",
"F821",
"PLR1701",
"UP031"
]

0 comments on commit a450a49

Please sign in to comment.