Skip to content

feat: Add pre-commit.com hook config to allow easy usage with pre-commit configs#143

Open
rickeylev wants to merge 1 commit intogoogle:masterfrom
rickeylev:precommit-hook-config
Open

feat: Add pre-commit.com hook config to allow easy usage with pre-commit configs#143
rickeylev wants to merge 1 commit intogoogle:masterfrom
rickeylev:precommit-hook-config

Conversation

@rickeylev
Copy link

This allows easily using addlicense with pre-commit.com hook configs to automatically run
when committing.

An example example .pre-commit-config.yaml for a user would look like:

- repo: https://github.com/google/addlicense
    rev: <git tag>
    hooks:
      - id: addlicense
        args: [-l, apache, -c, "Copyright Owner"]

And under the hood, pre-commit will go install the addlicense program and run it on the affected files with the specified args.

This allows easily using addlicense with pre-commit hooks by adding e.g.

```
- repo: https://github.com/google/addlicense
    rev: <version>
    hooks:
      - id: addlicense
```

to their `.pre-commit-config.yaml` file.
@Spill-Tea
Copy link
Contributor

I was just going to create a pull request for the same thing. It would be nice to be able to use addlicense repo as a pre-commit hook, instead of creating a mirror fork to maintain independently. Right now, I am just hacking things and injecting my own .pre-commit-hooks.yaml file on the downloaded source after installing with pre-commit to at least support locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants