Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
e575df33
Unverified
Commit
e575df33
authored
Oct 31, 2023
by
Cade Daniel
Committed by
GitHub
Oct 31, 2023
Browse files
[Small] Formatter only checks lints in changed files (#1528)
parent
0ce8647d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
format.sh
format.sh
+35
-1
tests/__init__.py
tests/__init__.py
+0
-0
No files found.
format.sh
View file @
e575df33
...
@@ -93,9 +93,43 @@ echo 'vLLM yapf: Done'
...
@@ -93,9 +93,43 @@ echo 'vLLM yapf: Done'
# echo 'vLLM mypy:'
# echo 'vLLM mypy:'
# mypy
# mypy
# Lint specified files
lint
()
{
pylint
"
$@
"
}
# Lint files that differ from main branch. Ignores dirs that are not slated
# for autolint yet.
lint_changed
()
{
# The `if` guard ensures that the list of filenames is not empty, which
# could cause pylint to receive 0 positional arguments, making it hang
# waiting for STDIN.
#
# `diff-filter=ACM` and $MERGEBASE is to ensure we only lint files that
# exist on both branches.
MERGEBASE
=
"
$(
git merge-base origin/main HEAD
)
"
if
!
git diff
--diff-filter
=
ACM
--quiet
--exit-code
"
$MERGEBASE
"
--
'*.py'
'*.pyi'
&>/dev/null
;
then
git diff
--name-only
--diff-filter
=
ACM
"
$MERGEBASE
"
--
'*.py'
'*.pyi'
| xargs
\
pylint
fi
}
# Run Pylint
# Run Pylint
echo
'vLLM Pylint:'
echo
'vLLM Pylint:'
pylint vllm tests
## This flag lints individual files. --files *must* be the first command line
## arg to use this option.
if
[[
"
$1
"
==
'--files'
]]
;
then
lint
"
${
@
:2
}
"
# If `--all` is passed, then any further arguments are ignored and the
# entire python directory is linted.
elif
[[
"
$1
"
==
'--all'
]]
;
then
lint vllm tests
else
# Format only the files that changed in last commit.
lint_changed
fi
if
!
git diff
--quiet
&>/dev/null
;
then
if
!
git diff
--quiet
&>/dev/null
;
then
echo
'Reformatted files. Please review and stage the changes.'
echo
'Reformatted files. Please review and stage the changes.'
...
...
tests/__init__.py
0 → 100644
View file @
e575df33
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment