PEP8,Black,YAPF,PyLint,Flake8.这几个插件,那个用的人多,主流些?谢谢
1
williamfzc 2023-10-12 15:12:33 +08:00 1
black +1
|
2
lithiumii 2023-10-12 15:13:23 +08:00 via Android
black 越来越多了,但是有些人特别讨厌
|
3
knightdf 2023-10-12 15:13:49 +08:00
我用 yapf
|
4
zcf0508 2023-10-12 15:14:19 +08:00 via Android
还有 ruff
|
5
jiayouzl OP @knightdf 请教一下,用 yapf 如何在注释#格式化后在#后面加一个空格?我找了半天没发现有这个配置选项. Black 默认有的.谢谢
|
6
Rang666 2023-10-12 16:23:54 +08:00 via iPhone
black ,ruff 只做代码检查和 import 排序
|
8
justS 2023-10-12 16:29:14 +08:00
Black `--line-length=120`
isort 排序 imports 再加上 pre-commit 和 CI 检查 |
9
ZX576 2023-10-12 17:29:45 +08:00
black + ruff
|
10
qW7bo2FbzbC0 2023-10-12 17:34:40 +08:00
python way, PEP8
|
11
so1n 2023-10-12 17:51:27 +08:00
我现在都是这样配置
```yaml repos: - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.0.0 hooks: - id: mypy additional_dependencies: [ types-protobuf>=4.21.0.0] - repo: https://github.com/PyCQA/isort rev: 5.9.3 hooks: - id: isort - repo: https://github.com/psf/black rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 rev: 3.9.2 hooks: - id: flake8 - repo: https://github.com/myint/autoflake rev: v2.0.1 hooks: - id: autoflake args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable', '--ignore-init-module-imports'] ``` |
12
julyclyde 2023-10-12 19:37:21 +08:00
是不是只有 black 会直接给改成符合格式标准的?其他的都是只检查?
|
13
jiayouzl OP 谢了各位
|