This commit is contained in:
Avram Lubkin 2022-11-16 10:09:18 -05:00 коммит произвёл Chi Song
Родитель e28a982601
Коммит 6bd5fc0187
4 изменённых файлов: 152 добавлений и 1 удалений

Просмотреть файл

@ -31,6 +31,11 @@ jobs:
python-version: '3.8'
nox-session: flake8
- os: ubuntu-latest
python-version: '3.10'
nox-session: pylint
additional-sys-deps: libvirt-dev
- os: ubuntu-latest
python-version: '3.8'
nox-session: mypy
@ -57,7 +62,7 @@ jobs:
- name: Install system dependencies
run: |
sudo apt install libgirepository1.0-dev
sudo apt install libgirepository1.0-dev ${{ matrix.additional-sys-deps }}
if: startsWith(matrix.os, 'ubuntu')
- name: Install Nox

Просмотреть файл

@ -30,6 +30,7 @@ from lisa.util.process import Process
# uses to prevent read conflict on log files
if platform.system() == "Windows":
# pylint: disable=import-error
import msvcrt
try:

Просмотреть файл

@ -91,6 +91,33 @@ def flake8(session: nox.Session) -> None:
session.run("flake8")
@nox.session(python=CURRENT_PYTHON, tags=["lint", "all"])
def pylint(session: nox.Session) -> None:
"""Run pylint"""
session.install(
*DEPENDENCIES,
*NOX_DEPENDENCIES,
*OPTIONAL_DEPENDENCIES["aws"],
*OPTIONAL_DEPENDENCIES["azure"],
*OPTIONAL_DEPENDENCIES["libvirt"],
*OPTIONAL_DEPENDENCIES["typing"],
"pylint",
)
session.run(
"pylint",
"lisa",
"microsoft",
"examples",
"selftests",
"docs/tools",
"docs",
"noxfile.py",
)
# --- Typing ---
@nox.session(python=CURRENT_PYTHON, tags=["typing", "all"])
def mypy(session: nox.Session) -> None:
"""Run mypy"""
@ -192,6 +219,7 @@ def dev(session: nox.Session) -> None:
"mypy",
"black",
"isort",
"pylint",
*OPTIONAL_DEPENDENCIES["flake8"],
*OPTIONAL_DEPENDENCIES["typing"],
*NOX_DEPENDENCIES,

117
pylintrc Normal file
Просмотреть файл

@ -0,0 +1,117 @@
[FORMAT]
# Regexp for a line that is allowed to be longer than the limit.
# URLs and pure strings
ignore-long-lines=^\s*(# )?<?https?://\S+>?$|^\s*[f|r]?b?[\"\'\`].+[\"\'\`]$
[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=
# Docstrings
missing-class-docstring,
missing-function-docstring,
missing-module-docstring,
# Imports
consider-using-from-import,
deprecated-module,
import-outside-toplevel,
unused-import,
wrong-import-position,
# Potential bugs
abstract-method,
broad-except,
cell-var-from-loop,
cyclic-import,
eval-used,
expression-not-assigned,
global-variable-not-assigned,
implicit-str-concat,
inconsistent-return-statements,
invalid-overridden-method,
keyword-arg-before-vararg,
missing-timeout,
modified-iterating-list,
no-member,
pointless-statement,
pointless-string-statement,
redefined-argument-from-local,
redefined-builtin,
redefined-outer-name,
super-init-not-called,
unbalanced-tuple-unpacking,
undefined-loop-variable,
unspecified-encoding,
unsubscriptable-object,
used-before-assignment,
# Syntax / Logic
chained-comparison,
consider-iterating-dictionary,
consider-merging-isinstance,
consider-using-dict-items,
consider-using-enumerate,
consider-using-f-string,
consider-using-generator,
consider-using-in,
consider-using-set-comprehension,
consider-using-with,
global-statement,
line-too-long,
logging-fstring-interpolation,
no-else-break,
no-else-raise,
no-else-return,
raise-missing-from,
simplifiable-if-expression,
simplifiable-if-statement,
unidiomatic-typecheck,
unnecessary-comprehension,
unnecessary-ellipsis,
unnecessary-pass,
use-a-generator,
use-dict-literal,
useless-else-on-loop,
useless-object-inheritance,
useless-parent-delegation,
useless-return,
# Refactoring
attribute-defined-outside-init,
duplicate-code,
invalid-name,
protected-access,
too-few-public-methods,
too-many-arguments,
too-many-boolean-expressions,
too-many-branches,
too-many-function-args,
too-many-instance-attributes,
too-many-lines,
too-many-locals,
too-many-nested-blocks,
too-many-public-methods,
too-many-statements,
unused-argument,
# Ignore
fixme,
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
output-format=colorized