Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-commit check with pylint jobs>1 #491

Open
ondrej-kolman opened this issue Jul 23, 2024 · 2 comments
Open

Pre-commit check with pylint jobs>1 #491

ondrej-kolman opened this issue Jul 23, 2024 · 2 comments
Labels

Comments

@ondrej-kolman
Copy link

ondrej-kolman commented Jul 23, 2024

Module

The name of the module that has a bug.
pylint-odoo/checkers/odoo_addons.py

Describe the bug

A clear and concise description of what the bug is.

When running pylint-odoo with pylint configuration with jobs=3 (anything different from jobs=1) than it ends with error

Traceback (most recent call last):
File "/usr/lib/python3.11/concurrent/futures/process.py", line 261, in _process_worker
r = call_item.fn(*call_item.args, **call_item.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/process.py", line 210, in _process_chunk
return [fn(*args) for args in chunk]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/process.py", line 210, in
return [fn(*args) for args in chunk]
^^^^^^^^^
File "/home/kolmano/.cache/pre-commit/repoh9417f4h/py_env-python3.11/lib/python3.11/site-packages/pylint/lint/parallel.py", line 79, in _worker_check_single_file
_worker_linter.check_single_file_item(file_item)
File "/home/kolmano/.cache/pre-commit/repoh9417f4h/py_env-python3.11/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 738, in check_single_file_item
with self._astroid_module_checker() as check_astroid_module:
File "/usr/lib/python3.11/contextlib.py", line 137, in enter
return next(self.gen)
^^^^^^^^^^^^^^
File "/home/kolmano/.cache/pre-commit/repoh9417f4h/py_env-python3.11/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 946, in _astroid_module_checker
checker.open()
File "/home/kolmano/.cache/pre-commit/repoh9417f4h/py_env-python3.11/lib/python3.11/site-packages/pylint_odoo/checkers/odoo_addons.py", line 650, in open
self.linter.config.deprecated_field_parameters = self.colon_list_to_dict(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kolmano/.cache/pre-commit/repoh9417f4h/py_env-python3.11/lib/python3.11/site-packages/pylint_odoo/checkers/odoo_addons.py", line 682, in colon_list_to_dict
return dict(item.split(":") for item in colon_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: dictionary update sequence element #0 has length 1; 2 is required

To Reproduce

Reproduced on version 9.1.2 and 8.0.20

Steps to reproduce the behavior:

  1. set jobs=3 in .pylintrc configuration file ([MAIN] section)
  2. exec 'pre-commit run --all-files'

Expected behavior
Not to raise error

Additional context
Tested on ubuntu 22

@moylop260
Copy link
Collaborator

Could you share the output of the following commands, please?

python3 -m pylint --version
python3 -c "import pylint_odoo;print(pylint_odoo.__version__)"

@moylop260
Copy link
Collaborator

Could you share the output of the following commands, please?

Forget it, I can reproduced it using the following DockerFile

# docker build -t pylint_jobs_error .
FROM ubuntu:22.04
RUN apt update && \
    apt install -y python3 python3-pip
RUN pip install pylint-odoo

Also, generating the following unittest it is reproduced in the CI:

diff --git a/tests/test_main.py b/tests/test_main.py
index e0cb608..c16e28c 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -144,6 +144,13 @@ class MainTest(unittest.TestCase):
         real_errors = pylint_res.linter.stats.by_msg
         self.assertEqual(self.expected_errors, real_errors)

+    def test_22_jobs(self):
+        """Using jobs could raise new errors"""
+        self.default_extra_params += ["--jobs=2"]
+        pylint_res = self.run_pylint(self.paths_modules, verbose=True)
+        real_errors = pylint_res.linter.stats.by_msg
+        self.assertEqual(self.expected_errors, real_errors)
+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants