Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update pre-commit config #2683

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
args: ["--exclude=lmdeploy/turbomind/triton_models/*,lmdeploy/pytorch/modeling/*", "--max-line-length=79"]
args: ["--exclude=lmdeploy/pytorch/modeling/*"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接删掉是否会出现代码极长这种,可能会比较难看?要不要设置一个比较大的,比如 vscode 的 editor.rulers 推荐的分别是 80 和 120。

Copy link
Collaborator

@RunningLeon RunningLeon Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新环境里试了下,pre-commit 还是会报E501,貌似pep8默认要求就是79

lmdeploy/pytorch/models/deepseek_v2.py:11:80: E501 line too long (114 > 79 characters)
lmdeploy/pytorch/models/deepseek_v2.py:21:80: E501 line too long (121 > 79 characters)
lmdeploy/pytorch/models/deepseek_v2.py:23:1: E302 expected 2 blank lines, found 1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I checked, that's modified by yapf instead of flake8. I will investigate more

- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
Expand All @@ -12,14 +12,9 @@ repos:
rev: v0.32.0
hooks:
- id: yapf
name: yapf
description: 'Formatter for Python code'
entry: yapf
language: python
args: ['-i', '--style={based_on_style: pep8, column_limit: 79}']

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-yaml
Expand Down
Loading