saltstack/salt-extension

pylint pre-commit hook race condition

lkubb opened this issue · 0 comments

lkubb commented

pre-commit runs hook invocations for files in parallel. The lint-code-pre-commit and lint-tests-pre-commit sessions install requirements, including the current project. This leads to a race condition where the hook (almost) never actually works without SKIP_REQUIREMENTS_INSTALL=1:

  • error: [Errno 2] No such file or directory: 'build/bdist.linux-x86_64/wheel/saltext/pushover/modules/__init__.py'

  • error: [Errno 13] Permission denied: 'build/bdist.linux-x86_64/wheel/saltext.saltext_namecheap-0.1.dev1+g41c96eb.d20231031-py3.7.egg-info'

  • error: [Errno 2] No such file or directory: 'build/bdist.linux-x86_64/wheel/saltext.saltext_mysql-0.1.dev1+ga006706-py3.8.egg-info'

This can be fixed by

  • not installing the libraries in the nox session and disabling related warnings (which they are already I think)
  • or setting require_serial: true in the hook (and relying on pylint's parallelism via jobs=0)

I will submit the latter fix as part of the compound PR.

Edit: This might be the cause of #17, but I'm not sure since it does not describe the specific error.