mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
Add python static type checking in CI checks (#11518)
- Enable pyright and pylint (https://github.com/microsoft/pyright) in CI - Enable pyright, pylint and bandit by default in VS code Pylint has some good style checks. pyright is Microsoft's static type checker.
This commit is contained in:
parent
c556f5f22f
commit
d9c9adb78b
3 changed files with 27 additions and 8 deletions
24
.github/workflows/lint.yml
vendored
24
.github/workflows/lint.yml
vendored
|
|
@ -13,7 +13,8 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: reviewdog/action-black@v3
|
||||
- name: black
|
||||
uses: reviewdog/action-black@v3
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
# Change reviewdog reporter if you need [github-pr-check, github-check, github-pr-review].
|
||||
|
|
@ -22,7 +23,8 @@ jobs:
|
|||
# GitHub Status Check won't become failure with a warning.
|
||||
level: error
|
||||
filter_mode: file
|
||||
- uses: reviewdog/action-flake8@v3
|
||||
- name: flake8
|
||||
uses: reviewdog/action-flake8@v3
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-check
|
||||
|
|
@ -50,14 +52,22 @@ jobs:
|
|||
reporter: github-pr-check
|
||||
level: info
|
||||
filter_mode: file
|
||||
- name: markdownlint
|
||||
uses: reviewdog/action-markdownlint@v0.7
|
||||
- name: pyright
|
||||
uses: jordemort/action-pyright@v1
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-check
|
||||
level: info
|
||||
filter_mode: file
|
||||
markdownlint_flags: ". --disable MD013 MD041 MD033 MD034"
|
||||
level: warning
|
||||
filter_mode: diff_context
|
||||
lib: true
|
||||
- name: pylint
|
||||
uses: dciborow/action-pylint@0.0.7
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
reporter: github-pr-check
|
||||
level: warning
|
||||
filter_mode: diff_context
|
||||
glob_pattern: "**/*.py"
|
||||
|
||||
lint-python-format:
|
||||
# Separated black/isort from other Python linters because we want this job to
|
||||
|
|
|
|||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -29,8 +29,10 @@
|
|||
],
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.flake8Enabled": true,
|
||||
"python.linting.pylintEnabled": true,
|
||||
"python.linting.pydocstyleEnabled": true,
|
||||
"python.linting.pydocstyleArgs": [
|
||||
"--convention=google"
|
||||
]
|
||||
],
|
||||
"python.linting.banditEnabled": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,3 +15,10 @@ extend_skip_glob = [
|
|||
|
||||
[tool.pydocstyle]
|
||||
convention = "google"
|
||||
|
||||
[tool.pylint.'MESSAGES CONTROL']
|
||||
disable = ["format", "line-too-long", "import-error", "no-name-in-module"]
|
||||
|
||||
[tool.pyright]
|
||||
exclude = ["onnxruntime/core/flatbuffers/*"]
|
||||
reportMissingImports = false
|
||||
|
|
|
|||
Loading…
Reference in a new issue