forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy action-mypy to review this PR
Signed-off-by: Bernhard Kaindl <bernhardkaindl7@gmail.com>
- Loading branch information
1 parent
06db91c
commit 51dd206
Showing
5 changed files
with
231 additions
and
5 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Python Code Review | ||
on: [pull_request] | ||
|
||
# Cancel a currently running workflow from the same PR, branch or tag when | ||
# a new workflow is triggered: | ||
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre | ||
concurrency: | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
|
||
jobs: | ||
python-code-review: | ||
name: Python Code Review | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: tsuyoshicho/action-mypy@v3.13.0 | ||
with: | ||
filter_mode: file | ||
setup_method: install | ||
setup_command: pip install mypy mock | ||
mypy_flags: | | ||
--scripts-are-modules | ||
--check-untyped-defs | ||
--allow-redefinition | ||
--ignore-missing-imports | ||
--no-pretty | ||
--warn-unreachable | ||
--exclude ocaml/ | ||
--exclude scripts/examples | ||
--exclude scripts/examples/python/monitor-unwanted-domains.py | ||
--exclude scripts/scalability-tests/ping-master.py | ||
--exclude scripts/backup-sr-metadata.py | ||
--exclude scripts/restore-sr-metadata.py | ||
--exclude scripts/nbd_client_manager.py | ||
--config-file .mypy.ini | ||
target: | | ||
scripts/perfmon | ||
scripts/hfx_filename | ||
scripts/mail-alarm | ||
scripts/host-display | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-pr-review | ||
|
||
- uses: dciborow/action-pylint@0.1.1 | ||
with: | ||
filter_mode: file | ||
glob_pattern: "scripts/*" | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-pr-review | ||
|
||
- uses: reviewdog/action-actionlint@v1 | ||
name: GitHub Action linter from https://github.com/reviewdog/action-actionlint | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
level: error | ||
reporter: github-pr-review |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[mypy-XenAPI.*] | ||
# TODO/FIXME: | ||
disable_error_code = union-attr | ||
[mypy] | ||
# TODO/FIXME: | ||
exclude = (?x)( | ||
^ocaml/ | ||
| scripts/.*usb_scan.py | ||
| scripts/examples | ||
| scripts/examples/python/monitor-unwanted-domains.py | ||
| scripts/scalability-tests/ping-master.py | ||
| scripts/backup-sr-metadata.py | ||
| scripts/restore-sr-metadata.py | ||
| scripts/nbd_client_manager.py | ||
) | ||
# Python scripts that don't end in .py must be given here: | ||
files = | ||
# TODO/FIXME: Test more scripts by default after those are fixed: | ||
scripts/hfx_filename, | ||
scripts/perfmon, | ||
scripts/mail-alarm, | ||
scripts/host-display, | ||
# TODO/FIXME: | ||
disable_error_code = | ||
attr-defined, | ||
import-not-found, | ||
import-untyped, | ||
type-arg, | ||
var-annotated, | ||
mypy_path = scripts/examples/python:.:scripts:scripts/plugins:scripts/examples | ||
pretty = true | ||
error_summary = true | ||
strict_equality = true | ||
show_error_codes = true | ||
show_error_context = true | ||
# Check the contents of untyped functions in all modules by default: | ||
check_untyped_defs = true | ||
scripts_are_modules = true | ||
# TODO/FIXME: mypy does not support targetting 3.6 anymore: | ||
python_version = 3.8 | ||
warn_return_any = true | ||
warn_unreachable = true | ||
warn_unused_configs = true | ||
warn_redundant_casts = true | ||
disallow_any_explicit = false | ||
disallow_any_generics = true | ||
disallow_any_unimported = true | ||
disallow_subclassing_any = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
[MAIN] | ||
|
||
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the | ||
# number of processors available to use, and will cap the count on Windows to | ||
# avoid hangs. | ||
jobs=2 | ||
|
||
# Pickle collected data for later comparisons. | ||
persistent=yes | ||
|
||
# Discover python modules and packages in the file system subtree. | ||
recursive=yes | ||
|
||
# Add paths to the list of the source roots. Supports globbing patterns. The | ||
# source root is an absolute path or a path relative to the current working | ||
# directory used to determine a package namespace for modules located under the | ||
# source root. | ||
source-roots= | ||
ocaml/xapi-storage/python, | ||
scripts, | ||
scripts/examples/python, | ||
|
||
# When enabled, pylint would attempt to guess common misconfiguration and emit | ||
# user-friendly hints instead of false-positive error messages. | ||
suggestion-mode=yes | ||
|
||
# In verbose mode, extra non-checker-related info will be displayed. | ||
verbose=yes | ||
|
||
[MESSAGES CONTROL] | ||
|
||
# Disable the message, report, category or checker with the given id(s). You | ||
# can either give multiple identifiers separated by comma (,) or put this | ||
# option multiple times (only on the command line, not in the configuration | ||
# file where it should appear only once). You can also use "--disable=all" to | ||
# disable everything first and then re-enable specific checks. For example, if | ||
# you want to run only the similarities checker, you can use "--disable=all | ||
# --enable=similarities". If you want to run only the classes checker, but have | ||
# no Warning level messages displayed, use "--disable=all --enable=classes | ||
# --disable=W". | ||
disable= | ||
bad-option-value, # old pylint for py2: ignore newer (unknown) pylint options | ||
bad-continuation, # old pylint warns about some modern black formatting | ||
bad-indentation, | ||
consider-using-dict-comprehension, | ||
consider-using-f-string, | ||
consider-using-with, | ||
import-error, | ||
import-outside-toplevel, | ||
invalid-name, | ||
missing-final-newline, | ||
missing-function-docstring, | ||
multiple-imports, | ||
redefined-outer-name, | ||
trailing-whitespace, # enable this soon, after citical PRs are merged | ||
useless-option-value, # new pylint has abaondoned these old options | ||
|
||
[FORMAT] | ||
|
||
# Maximum number of characters on a single line. | ||
max-line-length=98 | ||
|
||
[BASIC] | ||
|
||
# Good variable names which should always be accepted, separated by a comma. | ||
good-names=a, | ||
b, | ||
c, | ||
f, | ||
i, | ||
j, | ||
k, | ||
ex, | ||
Run, | ||
_ |