Skip to content

Commit

Permalink
style: 使用 ruff 格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Sep 2, 2023
1 parent abd610b commit 545de27
Show file tree
Hide file tree
Showing 28 changed files with 3,466 additions and 731 deletions.
48 changes: 24 additions & 24 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
autolabeler:
- label: 'bug'
- label: "bug"
branch:
- '/fix\/.+/'
- label: 'change'
- label: "change"
branch:
- '/change\/.+/'
- label: 'enhancement'
- label: "enhancement"
branch:
- '/feature\/.+/'
- '/feat\/.+/'
categories:
- title: 'Added'
- title: "Added"
labels:
- 'enhancement'
- 'feature'
- title: 'Changed'
- "enhancement"
- "feature"
- title: "Changed"
labels:
- 'improve'
- 'change'
- title: 'Deprecated'
- "improve"
- "change"
- title: "Deprecated"
labels:
- 'deprecation'
- title: 'Removed'
- "deprecation"
- title: "Removed"
labels:
- 'removed'
- title: 'Fixed'
- "removed"
- title: "Fixed"
labels:
- 'bug'
- 'fix'
- title: 'Security'
- "bug"
- "fix"
- title: "Security"
labels:
- 'security'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
- "security"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
- "major"
minor:
labels:
- 'minor'
- "minor"
patch:
labels:
- 'patch'
- "patch"
default: patch
template: |
$CHANGES
30 changes: 14 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,28 @@ ci:
autoupdate_schedule: weekly
autoupdate_commit_msg: "chore: auto update by pre-commit hooks"
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.286
hooks:
- id: pyupgrade
args: [--py311-plus]

- repo: https://github.com/hadialqattan/pycln
rev: v2.2.0
hooks:
- id: pycln
args: [--config, pyproject.toml]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
hooks:
- id: prettier
types_or: [markdown]
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
stages: [commit]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
stages: [commit]

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
stages: [commit]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
hooks:
- id: prettier
types_or: [javascript, jsx, ts, tsx, markdown, yaml, json]
stages: [commit]
14 changes: 4 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,18 @@
"type": "python",
"request": "launch",
"module": "pytest",
"args": [
"-s"
],
"args": ["-s"],
"console": "integratedTerminal",
"justMyCode": false,
"justMyCode": false
},
{
"name": "CoolQBot Test - Single",
"type": "python",
"request": "launch",
"module": "pytest",
"args": [
"-s",
"-k",
"${selectedText}"
],
"args": ["-s", "-k", "${selectedText}"],
"console": "integratedTerminal",
"justMyCode": false,
"justMyCode": false
}
]
}
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ asyncio_mode = "auto"
[tool.pyright]
typeCheckingMode = "basic"

[tool.ruff]
select = ["E", "W", "F", "UP", "C", "T", "PYI", "Q"]
ignore = ["E402", "E501", "E711", "C901", "UP037"]

[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0"]
Loading

0 comments on commit 545de27

Please sign in to comment.