All Projects → Lucas-C → pre-commit-hooks-safety

Lucas-C / pre-commit-hooks-safety

Licence: MIT license
A pre-commit hook to check your Python dependencies against safety-db

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pre-commit-hooks-safety

pre-commit-opa
Pre-commit git hooks for Open Policy Agent (OPA) and Rego development
Stars: ✭ 53 (-23.19%)
Mutual labels:  pre-commit, git-hooks
Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
Stars: ✭ 394 (+471.01%)
Mutual labels:  pre-commit, git-hooks
detect-secrets
A developer-friendly secrets detection tool for CI and pre-commit hooks based on Yelp's detect-secrets
Stars: ✭ 43 (-37.68%)
Mutual labels:  pre-commit, git-hooks
pre-commit-hooks
git pre-commit hooks
Stars: ✭ 71 (+2.9%)
Mutual labels:  pre-commit, git-hooks
mdformat
CommonMark compliant Markdown formatter
Stars: ✭ 90 (+30.43%)
Mutual labels:  pre-commit
slackbridge
Bridge between IRC and Slack running on Kubernetes
Stars: ✭ 12 (-82.61%)
Mutual labels:  pre-commit
seed-isort-config
Statically populate the `known_third_party` `isort` setting.
Stars: ✭ 67 (-2.9%)
Mutual labels:  pre-commit
check-jsonschema
A CLI and set of pre-commit hooks for jsonschema validation with built-in support for GitHub Workflows, Renovate, Azure Pipelines, and more!
Stars: ✭ 51 (-26.09%)
Mutual labels:  pre-commit
Pre Commit Hooks
Some out-of-the-box hooks for pre-commit
Stars: ✭ 2,605 (+3675.36%)
Mutual labels:  pre-commit
pre-commit-dbt
🎣 List of `pre-commit` hooks to ensure the quality of your `dbt` projects.
Stars: ✭ 149 (+115.94%)
Mutual labels:  pre-commit
Pre Commit
A framework for managing and maintaining multi-language pre-commit hooks.
Stars: ✭ 7,024 (+10079.71%)
Mutual labels:  pre-commit
NextCommunity.github.io
Join FREE: Community of open-source programmers and software engineers.
Stars: ✭ 29 (-57.97%)
Mutual labels:  pre-commit
create-react-redux-app
React boilerplate based on create-react-app
Stars: ✭ 49 (-28.99%)
Mutual labels:  pre-commit
pre-commit-hooks
Standardizing our code quality tooling 🛠️
Stars: ✭ 44 (-36.23%)
Mutual labels:  pre-commit
ready
A program to run tasks before a commit.
Stars: ✭ 16 (-76.81%)
Mutual labels:  pre-commit
hulks
Olist custom linting hooks 💚 👽
Stars: ✭ 25 (-63.77%)
Mutual labels:  pre-commit
conventional-pre-commit
A pre-commit hook that checks commit messages for Conventional Commits formatting
Stars: ✭ 66 (-4.35%)
Mutual labels:  pre-commit
commithelper
A tool to create and lint commit messages
Stars: ✭ 35 (-49.28%)
Mutual labels:  git-hooks
blackbricks
Black for Databricks notebooks
Stars: ✭ 40 (-42.03%)
Mutual labels:  pre-commit
Husky
Git hooks made easy 🐶 woof!
Stars: ✭ 25,056 (+36213.04%)
Mutual labels:  pre-commit

build status

A pre-commit hook to check your Python dependencies against safety-db.

It checks all files containing requirements in their name in the repo.

Releases details: CHANGELOG.md

Note that telemetry data will be sent with every Safety call. These data are anonymous and not sensitive. This includes the Python version, the Safety command used (check/license/review), and the Safety options used (without their values). Users can disable this functionality by adding the --disable-telemetry flag.

Usage

-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety
    rev: v1.3.1
    hooks:
    -   id: python-safety-dependencies-check

How to Use Arguments

There are a few different arguements that this hook will accept.

The first is the files arguement. Simply put which file your dependancies are listed in.

-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety
    rev: v1.3.1
    hooks:
    -   id: python-safety-dependencies-check
        files: pyproject.toml

The next is the --ignore flag. This will ignore a comma seperated list of known security issues. For example

-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety
    rev: v1.3.1
    hooks:
    -   id: python-safety-dependencies-check
        args: ["--ignore=39153,39652"]

You can also select between --full-report and --short-report. By default safety will use the --full-report flag so you can omit it for cleaner code.

-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety
    rev: v1.3.1
    hooks:
    -   id: python-safety-dependencies-check
        files: pyproject.toml
        args: ["--short-report"]

This will remove the extra detail about what vulnerability was fixed. This can be useful if multiple issues are found and you want to read through less text. Of course these can be used in any combination with each other as needed.

For more information look at the pre-commit documentation. There you can find some more thorough examples. You may for example want to use always_run: true in order to systematically run this hook, even when no dependency files have been modified.

Alternative local hook

You'll need to pip install safety beforehand:

-   repo: local
    hooks:
    -   id: python-safety-dependencies-check
        name: safety
        entry: safety
        args: [check, --full-report, --file]
        language: system
        files: requirements

Development

Setup

pip install -r dev-requirements.txt
pre-commit install

Releasing

  1. Bump version in this README.md file, setup.py, .pre-commit-config.yaml & CHANGELOG.md
  2. git commit -nam "Release $version" && git push && git tag $version && git push --tags
  3. Create a GitHub release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].