feat: Added functionality to specify a custom scan when using the scan command #565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
secureli-XXX
Changes
This PR improves the
scan
action by adding new functionality allowing users to specify a custom scan id instead of only being able to specify pre-commit hook ids. For example, you can now dosecureli scan -t check-pii
to run the pii scan.A new service was introduced, CustomScannersService to help orchestrate which custom scans should be run. Either a specific scan if an Id is specified, all custom scans if no id is specified, or a None result is returned if the specified id doesn't match a value in the new CustomScanId enum.
There was also some refactoring done. modules/core/core_services/scanner.py is now modules/core/core_services/hook_scanner.py to more accurately describe its function. The pii scanner and custom_regex_scanner directories have been moved into a new directory; secureli/modules/custom_scanners/
Testing
Added unit tests and performed manual testing to confirm that pre-commit hooks can be specified, custom scans can be specified, and when no id is specified, then all scans are done
Clean Code Checklist