Skip to content

Run hadolint in pre-commit without docker or system installation

License

Notifications You must be signed in to change notification settings

AleksaC/hadolint-py

Repository files navigation

hadolint-py

Add new versions Run tests License

A python package that provides a pip-installable hadolint binary.

The mechanism by which the binary is downloaded is basically copied from shellcheck-py.

Getting started

Installation

The package hasn't been published to PyPI yet, and may never be, as its primary purpose doesn't require it. However you can install it through git:

pip install git+https://github.com/AleksaC/[email protected]

To install another version simply replace the v2.12.0 with the version you want.

With pre-commit

This package was primarily built to provide a convenient way of running hadolint as a pre-commit hook, since haskell isn't supported by pre-commit. An alternative to this solution is to create a docker hook since hadolint provides a docker image, but I think that it has unnecessary amount of overhead.

Example .pre-commit-config.yaml with rules DL3025 and DL3018 excluded:

repos:
  - repo: https://github.com/AleksaC/hadolint-py
    rev: v2.12.1b3
    hooks:
      - id: hadolint
        args: [--ignore, DL3025, --ignore, DL3018]

Contact 🙋‍♂️