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 (add a small file called .pre-commit-hooks.yaml) #252

Closed
chrisdlangton opened this issue Apr 26, 2022 · 7 comments · Fixed by #256
Closed

support pre-commit (add a small file called .pre-commit-hooks.yaml) #252

chrisdlangton opened this issue Apr 26, 2022 · 7 comments · Fixed by #256
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@chrisdlangton
Copy link

Is your feature request related to a problem? Please describe.

no

Describe the solution you'd like

add a small file called .pre-commit-hooks.yaml in the root of the project, follow this

Describe alternatives you've considered

using pre-commit running pip-audit globally installed on the system (not ideal for teams)

Additional context

join a massive ecosystem of easy-to-use hooks

@chrisdlangton chrisdlangton added the enhancement New feature or request label Apr 26, 2022
@woodruffw woodruffw added help wanted Extra attention is needed good first issue Good for newcomers labels Apr 26, 2022
@tal66
Copy link

tal66 commented Apr 28, 2022

hi, I can do this

@woodruffw
Copy link
Member

@tal66 please do!

@tal66 tal66 mentioned this issue Apr 28, 2022
@tal66
Copy link

tal66 commented Apr 29, 2022

hi, so would this be good for you? :

- id: pip-audit
  name: pip-audit
  description: "Audits Python environments and dependency trees for known vulnerabilities"
  entry: pip-audit
  language: python

i put it on the main branch in my fork, and it seems to work with a dummy client that uses this config:

repos:
-   repo: https://github.com/tal66/pip-audit
    rev: v2.1.1-3-g03a3d4c
    hooks:
    -   id: pip-audit

@cooperlees
Copy link
Contributor

cooperlees commented Apr 30, 2022

- id: pip-audit
  name: pip-audit
  description: "Audits Python environments and dependency trees for known vulnerabilities"
  entry: pip-audit
  language: python

I think we should also pass pass_filenames: false and have users supply the args. For example:

i put it on the main branch in my fork, and it seems to work with a dummy client that uses this config:

repos:
-   repo: https://github.com/tal66/pip-audit
    rev: v2.1.1-3-g03a3d4c
    hooks:
    -   id: pip-audit

Something like:

      args: ["-r", "requirements.txt"]
      # Or
      args: ["."]

Since i tested this I just put up the PR here #256. Thanks for starting the work tho!

@tal66
Copy link

tal66 commented Apr 30, 2022

cooperlees, are you a part of their team?

@woodruffw
Copy link
Member

He's not, but all changes are welcome. Thanks @cooperlees!

@cooperlees
Copy link
Contributor

FWIW - pre-commit.ci does not like how pip-audit uses pip: pre-commit/pre-commit#2368

Will see if we need to document that it's not supported there or see if it can be fixed.

  • I feel it will work in my own action. I will do a PR updating docs if needed.

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 help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants