📦 deps(standards): vendor playbook
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
max_line_length = 80
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
[flake8]
|
||||
# 最大行长度(Google Style Guide 推荐 80)
|
||||
max-line-length = 80
|
||||
|
||||
# 忽略的错误代码(与 black 等工具对齐)
|
||||
ignore =
|
||||
E203, # whitespace before ':' (与 black 冲突)
|
||||
W503, # line break before binary operator (已过时的规则)
|
||||
|
||||
exclude =
|
||||
.git,
|
||||
__pycache__,
|
||||
.venv,
|
||||
venv,
|
||||
build,
|
||||
dist,
|
||||
*.egg-info,
|
||||
.tox,
|
||||
.pytest_cache
|
||||
|
||||
max-complexity = 10
|
||||
show-source = True
|
||||
show-pep8 = True
|
||||
count = True
|
||||
|
||||
docstring-convention = google
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ["--line-length", "80"]
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
[MASTER]
|
||||
jobs=0
|
||||
ignore=CVS,.git,__pycache__,.venv,venv
|
||||
init-hook='import sys; sys.path.append(".")'
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=
|
||||
C0103, # 变量名不符合命名规范(允许简短的变量名)
|
||||
C0114, # 缺少模块文档字符串
|
||||
R0913, # 参数过多
|
||||
R0902, # 实例属性过多
|
||||
W0511, # TODO 注释
|
||||
|
||||
enable=
|
||||
E,
|
||||
W,
|
||||
|
||||
[REPORTS]
|
||||
output-format=colorized
|
||||
reports=no
|
||||
|
||||
[BASIC]
|
||||
argument-naming-style=snake_case
|
||||
attr-naming-style=snake_case
|
||||
class-attribute-naming-style=any
|
||||
class-naming-style=PascalCase
|
||||
const-naming-style=UPPER_CASE
|
||||
function-naming-style=snake_case
|
||||
method-naming-style=snake_case
|
||||
module-naming-style=snake_case
|
||||
variable-naming-style=snake_case
|
||||
|
||||
good-names=i,j,k,ex,Run,_,x,y,z,fd,id
|
||||
docstring-min-length=5
|
||||
|
||||
[FORMAT]
|
||||
max-line-length=80
|
||||
max-module-lines=1000
|
||||
indent-string=' '
|
||||
indent-after-paren=4
|
||||
|
||||
[DESIGN]
|
||||
max-args=7
|
||||
max-attributes=10
|
||||
max-branches=15
|
||||
max-locals=20
|
||||
max-returns=6
|
||||
max-statements=50
|
||||
min-public-methods=1
|
||||
|
||||
[IMPORTS]
|
||||
import-graph=
|
||||
ext-import-graph=
|
||||
int-import-graph=
|
||||
|
||||
[CLASSES]
|
||||
valid-metaclass-classmethod-first-arg=cls
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
[EXCEPTIONS]
|
||||
overgeneral-exceptions=
|
||||
builtins.BaseException,
|
||||
builtins.Exception
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.rulers": [80],
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "explicit"
|
||||
}
|
||||
},
|
||||
"python.analysis.typeCheckingMode": "basic",
|
||||
"python.analysis.autoImportCompletions": true,
|
||||
"python.formatting.provider": "none"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
[tool.black]
|
||||
# Black 代码格式化工具配置(模板)
|
||||
line-length = 80
|
||||
target-version = ["py313"]
|
||||
exclude = '''
|
||||
/(
|
||||
\.git
|
||||
| \.venv
|
||||
| venv
|
||||
| build
|
||||
| dist
|
||||
| __pycache__
|
||||
| \.egg-info
|
||||
)/
|
||||
'''
|
||||
|
||||
[tool.isort]
|
||||
# isort 导入排序工具配置(模板)
|
||||
profile = "google"
|
||||
line_length = 80
|
||||
multi_line_output = 3
|
||||
lines_after_imports = 2
|
||||
|
||||
# 按项目需要填写/维护:
|
||||
known_third_party = []
|
||||
known_first_party = []
|
||||
|
||||
skip = [".venv", "venv", "build", "dist"]
|
||||
|
||||
[tool.mypy]
|
||||
# MyPy 类型检查配置(可选,模板)
|
||||
python_version = "3.13"
|
||||
warn_unused_ignores = true
|
||||
warn_redundant_casts = true
|
||||
warn_return_any = true
|
||||
disallow_untyped_defs = false
|
||||
disallow_untyped_calls = false
|
||||
ignore_missing_imports = true
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
# pytest 测试配置(模板)
|
||||
testpaths = ["tests"]
|
||||
python_files = ["test_*.py", "*_test.py"]
|
||||
python_classes = ["Test*"]
|
||||
python_functions = ["test_*"]
|
||||
addopts = "-v --tb=short --strict-markers"
|
||||
markers = [
|
||||
"slow: marks tests as slow",
|
||||
"integration: marks tests as integration tests",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user