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

Adding convenience function to get default settings #392

Merged
merged 2 commits into from
Jan 26, 2021

Conversation

domanchi
Copy link
Contributor

Summary

One of the primary motivations of the v1 redesign is to enable developers to more easily extend and integrate this tool into their ecosystem. However, the new Settings object lends itself to a gotcha: by default, it starts off uninitialized and as such, it's easy to fall into the trap of scanning without any plugins enabled.

This PR attempts to make this easier. I've added instructions in the README, but now, developers can just do:

from detect_secrets import SecretsCollection
from detect_secrets.settings import default_settings

secrets = SecretsCollection()
with default_settings():
    results = secrets.scan_file(...)

This abstracts away the pain of figuring out which plugins they want to initialize themselves.

Testing

Automated.

@domanchi domanchi merged commit 049b11c into pre-v1-launch Jan 26, 2021
@domanchi domanchi deleted the pre-v1-adding-default-settings branch January 26, 2021 19:26
jimmyhlee94 pushed a commit to jimmyhlee94/detect-secrets that referenced this pull request Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants