Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit hooks #133

Closed
skycaptain opened this issue Nov 8, 2020 · 3 comments
Closed

Add pre-commit hooks #133

skycaptain opened this issue Nov 8, 2020 · 3 comments
Labels
feature a feature which should be implemented help wanted

Comments

@skycaptain
Copy link

skycaptain commented Nov 8, 2020

pre-commit is a very common tool to execute and manage pre-commit hooks. It would be great to have the ability to use editorconfig-checker as a pre-commit hook using this tool. I've prepared a mirror using pre-commit-mirror-maker and your Python wrapper, still it would be great to have this directly in upstream.

EDIT: I just learned that the Python wrapper is not even needed, since pre-commit supports installing Go repositories directly. However, one might still consider using the Python wrapper as this would install the binary directly without the need of having Go installed, right?

@mstruebing
Copy link
Member

Thank you very much for your issue @skycaptain 👍

To describe what this wrapper does: it downloads a precompiled binary from the releases of the core, so if you are using this wrapper it is not needed to have Go installed, that's right.

Could you describe what needs to be done that this tool is able to be used the way you would want to?

@skycaptain
Copy link
Author

@mstruebing Thanks for the explanation.

pre-commit has documentation on what needs to be done to add a new hook: https://pre-commit.com/#creating-new-hooks. In short a new file .pre-commit-hooks.yaml with some metadata has to added to the project's root, e.g. for the Python wrapper:

-   id: editorconfig-checker
    name: editorconfig-checker
    description: '`editorconfig-checker` is a tool to check if your files consider your .editorconfig-rules.'
    entry: editorconfig-checker
    language: python
    types: [python]
    require_serial: true

A user can then add your project to their .pre-commit-config.yaml like this:

repos:
-   repo: https://github.com/editorconfig-checker/editorconfig-checker.python
    rev: 2.1.0
    hooks:
    -   id: editorconfig-checker

The rev field is matching your Git tags you're already using.

@mstruebing
Copy link
Member

Would you mind to open a pull request which includes that feature in https://github.com/editorconfig-checker/editorconfig-checker.python?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature which should be implemented help wanted
Projects
None yet
Development

No branches or pull requests

2 participants