OpenCTI-Platform / connectors

OpenCTI Connectors
https://www.opencti.io
Apache License 2.0
366 stars 398 forks source link

[isort] isort version needs to be updated in .pre-commit-config.yaml #2638

Closed Powlinett closed 2 weeks ago

Powlinett commented 2 weeks ago

Description

Pre-commit hook is not working with isort v5.10.2, but works if isort is updated to 5.12.0 as in client-python and opencti repositories.

Environment

  1. OS (where OpenCTI server runs): Windows 11
  2. OpenCTI version: -
  3. OpenCTI client: -
  4. Other environment details: Git Bash

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. enable pre-commit hook
  2. commit a change
  3. the pre-commit hook fails with a RuntimeError: The Poetry configuration is invalid: - data.extras.pipfile_deprecated_finder[2] must match pattern ^[a-zA-Z-_.0-9]+$

Expected Output

[INFO] Initializing environment for https://github.com/pycqa/isort.
[WARNING] Unexpected key(s) present on https://github.com/pycqa/isort => isort: arts
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
black................................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
Check Yaml...............................................................Passed
isort (python).......................................(no files to check)Skipped

Actual Output

      Traceback (most recent call last):
        File "C:\Users\$USER\.cache\pre-commit\repox8qjgr7j\py_env-python3\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\$USER\.cache\pre-commit\repox8qjgr7j\py_env-python3\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\$USER\.cache\pre-commit\repox8qjgr7j\py_env-python3\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 149, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "C:\Users\$USER\AppData\Local\Temp\pip-build-env-z0wjymwc\overlay\Lib\site-packages\poetry\core\masonry\api.py", line 42, in prepare_metadata_for_build_wheel
          poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
        File "C:\Users\$USER\AppData\Local\Temp\pip-build-env-z0wjymwc\overlay\Lib\site-packages\poetry\core\factory.py", line 60, in create_poetry
          raise RuntimeError("The Poetry configuration is invalid:\n" + message)
      RuntimeError: The Poetry configuration is invalid:
        - data.extras.pipfile_deprecated_finder[2] must match pattern ^[a-zA-Z-_.0-9]+$

      [end of output]

      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed

    Encountered error while generating package metadata.

    See above for output.

    note: This is an issue with the package mentioned above, not pip.

Additional information

Screenshots (optional)