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

support pre-commit #60

Closed
Niccolum opened this issue Dec 15, 2022 · 2 comments · Fixed by #669
Closed

support pre-commit #60

Niccolum opened this issue Dec 15, 2022 · 2 comments · Fixed by #669
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Niccolum
Copy link

Hello,

Can you support pre-commit-hook - just add .pre-commit-hook.yaml to repo and, if possible, use git tags for versioning.

Thanks

@oliverchang
Copy link
Collaborator

@andrewpollock I think you had thoughts on this before right?

@oliverchang oliverchang added the enhancement New feature or request label Jan 6, 2023
@andrewpollock
Copy link
Contributor

Yep, pointed you at my previous thoughts off-issue.

@another-rex another-rex added the good first issue Good for newcomers label Sep 5, 2023
hayleycd pushed a commit that referenced this issue Dec 1, 2023
This change exposes a pre-commit hook for people to use that would run
osv-scanner when commiting code to their codebase.

Resolves #60.

I manually tested this change by modifying the `.pre-commit-config.yaml`
file from the [pipdeptree](https://github.com/tox-dev/pipdeptree)
project to the following:
```yml
repos:
  - repo: https://github.com/kemzeb/osv-scanner
    rev: 321d06b
    hooks:
      - id: osv-scanner
        args: ["-r", "."]
```

...where I ran pre-commit locally by doing the following:

Install the pre-commit script:
```console
pre-commit install 
```

Run while using all the files in the pipdeptree repo, while also
providing verbose output produced by osv-scanner (I truncated the output
but wanted to make aware that the `-v` option is available):
``` console
pre-commit run -av
osv-scanner..............................................................Passed
- hook id: osv-scanner
- duration: 0.47s
.... // verbose output here
```

Let me know if there is an interest in using any of the other pre-commit
hook [configurations ](https://pre-commit.com/#creating-new-hooks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants