I am trying to set up a GitHub Actions workflow (definition below) checking for pylint requirements. I fixed this all on my local machine. Then I noticed getting a too-many-positional-arguments
on the workflow. But my local machine doesn't know that specific error.
Now I tried to fix this by using pylint: disable=too-many-positional-arguments
. Resulting in the following pylint error.
usc_sign_in_bot/db_helpers.py:345:0: W0012: Unknown option value for 'disable', expected a valid pylint message and got 'too-many-positional-arguments' (unknown-option-value)
Also adding the R0917
error message to the .pylintrc
(also defined below) disable menu, does not help as it just gets a local error about not knowing the message to disable.
Both github & local have pylint==3.3.1
installed.
I think it's some kind of version mismatch but i am not sure how that would happen as the pylint versions are both the same and both use the same .pylintrc
. Does anyone know where this mismatch comes from?
.github/workflows/pylint
:
name: pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
pip install pytest pylint==3.3.1
- name: Analysing the code with pylint
run: |
pylint usc_sign_in_bot/
pylint tests/
.pylintrc
:
[MAIN]
# Specify a configuration file.
load-plugins=pylint.extensions.docstyle
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
jobs=0
# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
[MESSAGES CONTROL]
# Disable the message, report, category or checker with the given id(s).
disable=C0199,E0401,E0611
# Disable the score feature, we want it right
score=no
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=100
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[DESIGN]
# Maximum number of arguments for function / method.
max-args=10
[DOCSTRING]
# Require all classes and methods to have a docstring.
docstring-min-length=10
[CONVENTION]
# Ensure docstrings are present for all modules, classes, methods, and functions.
good-names=i,j,k,ex,Run,_
[REPORTS]
# Tweak the output format. You can have a full report with `yes`.
reports=no
[TYPECHECK]
generated-members=numpy.*,torch.*
[EXCEPTIONS]
# This option represents a list of qualified names for which no member or method should be checked.
ignored-classes=NotImplementedError
I also experienced a similar issue, try setting max-positional-arguments=10
in your .pylintrc.
Also, have a look at https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/too-many-positional-arguments.html
Problematic code:
# +1: [too-many-positional-arguments]
def calculate_drag_force(velocity, area, density, drag_coefficient):
return 0.5 * drag_coefficient * density * area * velocity**2
drag_force = calculate_drag_force(30, 2.5, 1.225, 0.47)
Correct code:
def calculate_drag_force(*, velocity, area, density, drag_coefficient):
return 0.5 * drag_coefficient * density * area * velocity**2
drag_force = calculate_drag_force(
velocity=30, area=2.5, density=1.225, drag_coefficient=0.47