How akashdv25/sensitive_data_detector works
Project type and purpose
• This is an open-source Python library/CLI tool (“Sensitive Data Detector”) whose sole purpose is to scan text-based files (source code, configs, etc.) for sensitive data by applying regex-based detection patterns. It ships as a pip-installable package, provides a function/API (has_sensitive_info) and a console entrypoint, and supports a pre-commit hook integration.
File structure
• Top-level:
• .github/workflows/ci.yml, release.yml → CI & release pipelines
• README.md, LICENSE, requirements.txt, setup.py → packaging & docs
• docs/ → usage/assignment docs
• sensitive_data_detector/ → core package
• tests/ → unit tests
• Inside sensitive_data_detector/:
• config.json → pattern definitions
• load_patterns.py → loads/validates JSON patterns
• file_reader.py → reads file contents
• content_analyze.py → applies regexes to text
• sensitive_check.py → high-level API/CLI glue
• version.py, __init__.py
• CI files reference linting (Black, isort, Flake8), testing (pytest), and release automation.
README for additional insights
• Key call: has_sensitive_info("path/to/file")
• Configurable JSON patterns, pre-commit hook support.
• No external services—pure local processing.
• Testing via pytest, development via pre-commit hooks.