You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to find examples of this issue in the repository before but did not find any useful hits. This issue has been plaguing my team the last month or so. We were originally using a full secrets baseline, but the line number tracking resulted in a lot of activity, and that lot of activity resulted in a lot of merge conflicts due to the timestamp and stuff.
So I switched us to the slim baseline to reduce the activity that the file sees, but since doing so, we've been facing this issue quite a bit: AttributeError: 'PotentialSecret' object has no attribute 'line_number'.
Detect secrets...........................................................Failed
- hook id: detect-secrets
- exit code: 1
Traceback (most recent call last):
File "/home/runner/.cache/pre-commit/repozmyk2bs_/py_env-python3.9/bin/detect-secrets-hook", line 8, in <module>
sys.exit(main())
File "/home/runner/.cache/pre-commit/repozmyk2bs_/py_env-python3.9/lib/python3.9/site-packages/detect_secrets/pre_commit_hook.py", line 61, in main
baseline.save_to_file(args.baseline, filename=args.baseline_filename)
File "/home/runner/.cache/pre-commit/repozmyk2bs_/py_env-python3.9/lib/python3.9/site-packages/detect_secrets/core/baseline.py", line 109, in save_to_file
output = format_for_output(secrets)
File "/home/runner/.cache/pre-commit/repozmyk2bs_/py_env-python3.9/lib/python3.9/site-packages/detect_secrets/core/baseline.py", line 74, in format_for_output
'results': secrets.json(),
File "/home/runner/.cache/pre-commit/repozmyk2bs_/py_env-python3.9/lib/python3.9/site-packages/detect_secrets/core/secrets_collection.py", line 198, in json
for filename, secret in self:
File "/home/runner/.cache/pre-commit/repozmyk2bs_/py_env-python3.9/lib/python3.9/site-packages/detect_secrets/core/secrets_collection.py", line 217, in __iter__
for secret in sorted(secrets, key=lambda x: (x.line_number, x.secret_hash, x.type)):
File "/home/runner/.cache/pre-commit/repozmyk2bs_/py_env-python3.9/lib/python3.9/site-packages/detect_secrets/core/secrets_collection.py", line 217, in <lambda>
for secret in sorted(secrets, key=lambda x: (x.line_number, x.secret_hash, x.type)):
AttributeError: 'PotentialSecret' object has no attribute 'line_number'
Reproduce
I am unable to reliably reproduce this. It often happens even when there have been no changes to the baseline in that commit. Typically simply rerunning the commit (or in this case the github workflow that is calling pre-commit) will run the same exact code, with no other changes in the repo, but not hit this error.
I know intermittent and unreliably reproducible are the best types of bugs, sorry!
The text was updated successfully, but these errors were encountered:
js-truework
added a commit
to js-truework/detect-secrets
that referenced
this issue
Jul 27, 2021
This is a relatively naive approach to solving the issue in Yelp#471. I looked at the PotentialSecret class and it very clearly has a default value of 0 for `line_number`. But alas, intermittently it does not. So this should safely fall back to 0 if `line_number` isn't present.
Summary
Hello,
I've tried to find examples of this issue in the repository before but did not find any useful hits. This issue has been plaguing my team the last month or so. We were originally using a full secrets baseline, but the line number tracking resulted in a lot of activity, and that lot of activity resulted in a lot of merge conflicts due to the timestamp and stuff.
So I switched us to the slim baseline to reduce the activity that the file sees, but since doing so, we've been facing this issue quite a bit:
AttributeError: 'PotentialSecret' object has no attribute 'line_number'
.Baseline Configuration
Traceback
Reproduce
I am unable to reliably reproduce this. It often happens even when there have been no changes to the baseline in that commit. Typically simply rerunning the commit (or in this case the github workflow that is calling pre-commit) will run the same exact code, with no other changes in the repo, but not hit this error.
I know intermittent and unreliably reproducible are the best types of bugs, sorry!
The text was updated successfully, but these errors were encountered: