This repository currently includes the following pre-commit hooks:
- scanoss-check-undeclared-code
- This hook checks for potential undeclared open source software in the files being committed.
- It is designed to run at the
pre-commit
,pre-push
, andmanual
stages.
To get started with this project, you'll need to install the pre-commit package manager and configure it to use the hooks provided in this repository.
You can install pre-commit using various methods:
-
Using PIP:
pip install pre-commit
-
Using Homebrew:
brew install pre-commit
For more installation options, refer to the pre-commit documentation.
-
In the root of your project repository where you want to use these hooks, create a
.pre-commit-config.yaml
file with the following content:repos: - repo: https://github.com/scanoss/pre-commit-hooks rev: v0 hooks: - id: scanoss-check-undeclared-code
Check the latest release here
-
Verify config:
pre-commit validate-config
-
Install the pre-commit hooks:
pre-commit install
-
(Optional) Run the hooks against all files to ensure everything is in order:
pre-commit run --all-files
Note: This project requires a minimum of Python 3.9.
To develop this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/scanoss/pre-commit-hooks.git cd pre-commit-hooks
-
Create a local branch for isolated development
-
Install dev requirements:
pip install -r requirements-dev.txt
-
Set up the development environment using the Makefile:
make dev_setup
This will install the package in development mode with all necessary dependencies.
-
Set up pre-commit hooks:
pre-commit install
-
Try out the command using:
pre-commit try-repo ../pre-commit-hooks scanoss-check-undeclared-code --verbose
This will attempt to run
scanoss-check-undeclared-code
against thepre-commit-hooks
repo.Note: This checker requires files to be
staged
in order to be considered for processingYou can achieve this using:
git add <file>
-
When you're done with development, you can uninstall using:
make dev_uninstall
-
Contributing
Please following the contributing instructions to share updates with the community.
This project is licensed under MIT. License file can be found here.
To request features or alert about bugs, please do so here.
We welcome contributions to this project! Please clone the repository and submit a pull request with your changes. Ensure that your code passes all pre-commit checks before submitting.
Details of major changes to the library can be found in CHANGELOG.md.