detect-secrets icon indicating copy to clipboard operation
detect-secrets copied to clipboard

detect-secret-hooks failing with latest version upgrade

Open ferdose opened this issue 3 years ago • 2 comments

git ls-files

+ xargs /home/jenkins/.local/bin/detect-secrets-hook --baseline .secrets.baseline

Traceback (most recent call last):

  File "/home/jenkins/.local/bin/detect-secrets-hook", line 11, in <module>

    sys.exit(main())

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/pre_commit_hook.py", line 30, in main

    secrets.scan_file(filename)

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/core/secrets_collection.py", line 42, in scan_file

    for secret in scan.scan_file(filename):

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/core/scan.py", line 132, in scan_file

    if not get_plugins():   # pragma: no cover

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/settings.py", line 222, in get_plugins

    for classname in get_settings().plugins

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/settings.py", line 222, in <listcomp>

    for classname in get_settings().plugins

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/core/plugins/initialize.py", line 34, in from_plugin_classname

    for plugin_type in get_mapping_from_secret_type_to_class().values():

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/core/plugins/util.py", line 28, in get_mapping_from_secret_type_to_class

    filter=lambda x: not _is_valid_plugin(x),

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/util/importlib.py", line 24, in import_types_from_package

    module = import_module(module_path)

  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 994, in _gcd_import

  File "<frozen importlib._bootstrap>", line 971, in _find_and_load

  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 678, in exec_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  File "/home/jenkins/.local/lib/python3.6/site-packages/detect_secrets/plugins/common/initialize.py", line 3, in <module>

    **from detect_secrets.core.usage import PluginOptions

ImportError: cannot import name 'PluginOptions'**

script returned exit code 123

ferdose avatar Feb 26 '21 10:02 ferdose

Uh, are you running two different versions of detect-secrets? This stack trace is bizarre, since it starts off as the latest version, then it gets to the dynamic import line (source), and it suddenly tries to use old code: https://github.com/Yelp/detect-secrets/blob/v0.14.3/detect_secrets/plugins/common/initialize.py#L3

Something definitely funky with your setup.

domanchi avatar Feb 26 '21 15:02 domanchi

@ferdose Hello. is this still an issue?

jpdakran avatar Jun 29 '22 20:06 jpdakran

We’re going to close this issue as it hasn’t received any update in a very long time. Feel free to re-open it if you think it’s still relevant.

lorenzodb1 avatar May 16 '24 17:05 lorenzodb1