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

detect-secrets scan --all-files returns ValueError: year 0 is out of range #584

Open
franzramadhan opened this issue Jul 22, 2022 · 0 comments
Labels
bug The issue describes a malfunctioning aspect of the project. good first issue The issue can be tackled by someone who has little to no knowledge about the project. help wanted Indicates that we would like someone that’s not a maintainer to work on the issue. triaged The issue has been reviewed but has not been solved yet.

Comments

@franzramadhan
Copy link

franzramadhan commented Jul 22, 2022

Versions

~ git --version
git version 2.37.1
➜  ~ python --version
Python 3.10.5
➜  ~ detect-secrets --version
1.2.0

Details

I am trying to run detect-secrets scan --all-files . in my existing git repository but got following error.

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/secrets_collection.py", line 313, in _scan_file_and_serialize
    return list(scan.scan_file(filename))
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/scan.py", line 150, in scan_file
    for lines in _get_lines_from_file(filename):
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/scan.py", line 254, in _get_lines_from_file
    lines = get_transformed_file(cast(NamedIO, f))
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/__init__.py", line 31, in get_transformed_file
    return transformer.parse_file(file)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/yaml.py", line 36, in parse_file
    items = sorted(YAMLFileParser(file), key=lambda x: x.line_number)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/yaml.py", line 170, in __iter__
    to_search = deque([self.json()])
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/yaml.py", line 161, in json
    return cast(Dict[str, Any], self.loader.get_single_data())
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 143, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 330, in construct_yaml_timestamp
    return datetime.date(year, month, day)
ValueError: year 0 is out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/bin/detect-secrets", line 33, in <module>
    sys.exit(load_entry_point('detect-secrets==1.2.0', 'console_scripts', 'detect-secrets')())
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/main.py", line 30, in main
    handle_scan_action(args)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/main.py", line 70, in handle_scan_action
    secrets = baseline.create(
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/baseline.py", line 34, in create
    secrets.scan_files(
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/secrets_collection.py", line 67, in scan_files
    for secrets in p.imap_unordered(
  File "/opt/homebrew/Cellar/python@3.10/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 870, in next
    raise value
ValueError: year 0 is out of range

Please let me know if you need further info or logs

@lorenzodb1 lorenzodb1 added the pending The issue still needs to be reviewed by one of the maintainers. label Aug 24, 2022
@lorenzodb1 lorenzodb1 added help wanted Indicates that we would like someone that’s not a maintainer to work on the issue. good first issue The issue can be tackled by someone who has little to no knowledge about the project. triaged The issue has been reviewed but has not been solved yet. bug The issue describes a malfunctioning aspect of the project. and removed pending The issue still needs to be reviewed by one of the maintainers. labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue describes a malfunctioning aspect of the project. good first issue The issue can be tackled by someone who has little to no knowledge about the project. help wanted Indicates that we would like someone that’s not a maintainer to work on the issue. triaged The issue has been reviewed but has not been solved yet.
Projects
None yet
Development

No branches or pull requests

2 participants