Pylint Errors Due to Compatibility Issues with Pylint3.9 #346
-
|
Description: Currently, this repository runs CI checks using In core/testenvmanager/dataset/dataset.py:119:4: R0917: Too many positional arguments (8/5) (too-many-positional-arguments)
core/testenvmanager/dataset/dataset.py:206:4: R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
core/testenvmanager/dataset/dataset.py:213:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)
core/testenvmanager/dataset/dataset.py:246:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)
core/testenvmanager/dataset/dataset.py:285:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)
core/testenvmanager/dataset/dataset.py:329:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)
core/testenvmanager/dataset/dataset.py:368:4: R0917: Too many positional arguments (6/5) (too-many-positional-arguments)Long-term solution: Refactor the affected function definitions to reduce the number of positional arguments. Short-term solution: Add the following directive to disable the # pylint: disable=too-many-positional-argumentsProblem: Adding this directive causes Question: I'm not sure how to resolve this issue in the short term. One possible solution is to keep only |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
dataset/split_dataset.py related pr: #143 |
Beta Was this translation helpful? Give feedback.
-
Cause analysisPylint introduced a new code style error This feature only exists in Pylint with Possible SolutionsSolution 1: Disable R0917 Check✅ Can Solve Solution 2: Increase
|
Beta Was this translation helpful? Give feedback.
-
|
As for solution 3 of split_dataset.py, the function parameters could be looked over further. For example, parameters of "ratio" and "type" seem can be refined, considering the existing parameter of "method". |
Beta Was this translation helpful? Give feedback.
Cause analysis
Pylint introduced a new code style error
R0917:too-many-positional-argumentsin 2023, which will throw an error when the number of function parameters exceeds the default value5. See details at PylintDocs/R0917This feature only exists in Pylint with
python>=3.9, so Pylint withpython=3.7,3.8will not raise this error.Possible Solutions
Solution 1: Disable R0917 Check
✅ Can Solve
⚠️ It will not be monitored when there are truly too many positional arguments.
Solution 2: Increase
max-positional-argumentsto A Bigger Number✅ Can Solve
❓The upper limit still needs to be discussed. ( temporarily set to
10in #158 )Solution 3: Refactor
dataset.pyto Comply With the New Style…