Skip to content
Merged
Show file tree
Hide file tree
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
36 changes: 2 additions & 34 deletions .github/workflows/static-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,10 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Check requirements.txt exists
id: check_req
run: |
if [ -f requirements.txt ]; then
echo "requirements_exists=true" >> $GITHUB_OUTPUT
else
echo "requirements_exists=false" >> $GITHUB_OUTPUT
fi
if [ -f pyproject.toml ]; then
echo "pyproject_exists=true" >> $GITHUB_OUTPUT
else
echo "pyproject_exists=false" >> $GITHUB_OUTPUT
fi
- name: Install dependencies by requirements.txt
- name: Install pylint
id: install_deps_req
if: ${{ steps.check_req.outputs.requirements_exists == 'true' }}
run: |
python -m pip install --upgrade pylint
python -m pip install --upgrade isort
python -m pip install -r requirements.txt
echo "dependencies_installed=true" >> $GITHUB_OUTPUT
- name: Analysing the code with pylint
if: ${{ steps.check_req.outputs.requirements_exists == 'true' }}
run: |
isort $(git ls-files '*.py') --check-only --diff
pylint $(git ls-files '*.py')
- name: Install dependencies by uv
id: install_deps_uv
if: ${{ steps.check_req.outputs.pyproject_exists == 'true' }}
run: |
python -m pip install uv
uv sync
uv pip install pylint
uv pip install isort
- name: Analysing the code with pylint
if: ${{ steps.check_req.outputs.pyproject_exists == 'true' }}
run: |
uv run isort $(git ls-files '*.py') --check-only --diff
uv run pylint $(git ls-files '*.py')
grep -r -l "# LINT_ME" **/*.py|xargs pylint
100 changes: 67 additions & 33 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension-pkg-allow-list=
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
# for backward compatibility.)
extension-pkg-whitelist=cv2
extension-pkg-whitelist=

# Return non-zero exit code if any of these messages/categories are detected,
# even if score is above --fail-under value. Syntax same as enable. Messages
Expand Down Expand Up @@ -59,15 +59,16 @@ ignore-paths=
# Emacs file locks
ignore-patterns=^\.#

# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=cv2
# List of module names for which member attributes should not be checked and
# will not be imported (useful for modules/projects where namespaces are
# manipulated during runtime and thus existing member attributes cannot be
# deduced by static analysis). It supports qualified module names, as well as
# Unix pattern matching.
ignored-modules=

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
init-hook='import sys; sys.path.append(".")'
#init-hook=

# 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
Expand All @@ -86,9 +87,13 @@ load-plugins=
# Pickle collected data for later comparisons.
persistent=yes

# Resolve imports to .pyi stubs if available. May reduce no-member messages and
# increase not-an-iterable messages.
prefer-stubs=no

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.10
py-version=3.12

# Discover python modules and packages in the file system subtree.
recursive=no
Expand All @@ -99,10 +104,6 @@ recursive=no
# source root.
source-roots=

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
Expand Down Expand Up @@ -229,6 +230,11 @@ name-group=
# not require a docstring.
no-docstring-rgx=^_

# Regular expression matching correct parameter specification variable names.
# If left empty, parameter specification variable names will be checked with
# the set naming style.
#paramspec-rgx=

# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
# These decorators are taken in consideration only for invalid-name.
Expand All @@ -242,13 +248,17 @@ property-classes=abc.abstractproperty
# variable names will be checked with the set naming style.
#typevar-rgx=

# Regular expression matching correct type variable tuple names. If left empty,
# type variable tuple names will be checked with the set naming style.
#typevartuple-rgx=

# Naming style matching correct variable names.
variable-naming-style=snake_case

# Regular expression matching correct variable names. Overrides variable-
# naming-style. If left empty, variable names will be checked with the set
# naming style.
variable-rgx=(_?[a-z][A-Za-z0-9]{0,30})|([A-Z0-9]{1,30})
#variable-rgx=


[CLASSES]
Expand Down Expand Up @@ -285,10 +295,10 @@ exclude-too-few-public-methods=
ignored-parents=

# Maximum number of arguments for function / method.
max-args=7
max-args=5

# Maximum number of attributes for a class (see R0902).
max-attributes=20
max-attributes=7

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5
Expand All @@ -302,17 +312,20 @@ max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of positional arguments for function / method.
max-positional-arguments=5

# Maximum number of public methods for a class (see R0904).
max-public-methods=20

# Maximum number of return / yield for function / method body.
max-returns=6

# Maximum number of statements in function / method body.
max-statements=300
max-statements=50

# Minimum number of public methods for a class (see R0903).
min-public-methods=1
min-public-methods=2


[EXCEPTIONS]
Expand All @@ -336,11 +349,13 @@ indent-after-paren=4
# tab).
indent-string=' '

# Maximum number of characters on a single line.
max-line-length=150
# Maximum number of characters on a single line. Pylint's default of 100 is
# based on PEP 8's guidance that teams may choose line lengths up to 99
# characters.
max-line-length=100

# Maximum number of lines in a module.
max-module-lines=2000
max-module-lines=1000

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
Expand Down Expand Up @@ -421,18 +436,30 @@ confidence=HIGH,
# --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=too-many-arguments,
too-many-locals,
too-many-branches,
protected-access

disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
use-implicit-booleaness-not-comparison-to-string,
use-implicit-booleaness-not-comparison-to-zero,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=

[MASTER]
# A comma-separated list of package or module names
# from where C extensions may#be loaded. Extensions
# are loading into the active Python interpreter and
# may run arbitrary code .
extension-pkg-allow-list=torch,transformers


[METHOD_ARGS]

Expand All @@ -443,9 +470,13 @@ timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.

[MISCELLANEOUS]

# Whether or not to search for fixme's in docstrings.
check-fixme-in-docstring=no

# List of note tags to take in consideration, separated by a comma.
notes=FIXME,
XXX
XXX,
TODO

# Regular expression of note tags to take in consideration.
notes-rgx=
Expand All @@ -465,7 +496,7 @@ never-returning-functions=sys.exit,argparse.parse_error
# Let 'consider-using-join' be raised when the separator to join on would be
# non-empty (resulting in expected fixes of the type: ``"- " + " -
# ".join(items)``)
# suggest-join-with-non-empty-separator=yes
suggest-join-with-non-empty-separator=yes


[REPORTS]
Expand All @@ -481,10 +512,10 @@ evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor
# used to format the message information. See doc for all details.
msg-template=

# Set the output format. Available formats are: text, parseable, colorized,
# json2 (improved json format), json (old json format) and msvs (visual
# studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
# Set the output format. Available formats are: 'text', 'parseable',
# 'colorized', 'json2' (improved json format), 'json' (old json format), msvs
# (visual studio) and 'github' (GitHub actions). You can also give a reporter
# class, e.g. mypackage.mymodule.MyReporterClass.
#output-format=

# Tells whether to display a full report or only the messages.
Expand Down Expand Up @@ -582,11 +613,14 @@ ignored-checks-for-mixins=no-member,
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace


ignored-modules=torch,torch.distributed,transformers,transformers.hf_argparser

# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes

# The minimum edit distance a name should have in order to be considered a
# The maximum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1

Expand Down Expand Up @@ -630,4 +664,4 @@ init-import=no

# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.15
Loading