datacontract / datacontract-cli

CLI to manage your datacontract.yaml files
https://cli.datacontract.com
Other
352 stars 60 forks source link

Feature Request: datacontract-cli as pre-commit hook #279

Closed burakince closed 5 days ago

burakince commented 5 days ago

Hi everyone,

I'd like to provide some context before diving into the details. pre-commit is an open-source project that simplifies defining git pre-commit hooks. Our project is already utilizing a defined pre-commit hook, which you can view here.

This feature request proposes that datacontract-cli should be described as a pre-commit hook for the lint subcommand. To achieve this, we need to create a .pre-commit-hooks.yaml file. For more detailed information, please refer to the guidelines here.

Here is an example of how the usage could look:

Example .pre-commit-config.yaml definition:

repos:
  - repo: https://github.com/datacontract/datacontract-cli
    rev: "v0.10.9"
    hooks:
      - id: datacontract-linting

This repository should contain at least the following file and configuration:

Example .pre-commit-hooks.yaml definition:

- id: datacontract-linting
  name: Data Contract Linter
  description: This hook lints the data contract.
  entry: datacontract lint
  files: "datacontract*.yaml"
  language: python
  types: [yaml]

Thank you all for your assistance.

Best regards,
Burak Ince