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

Feature Request: Add support for the pre-commit framework #22

Closed
dontirun opened this issue Jun 22, 2020 · 8 comments
Closed

Feature Request: Add support for the pre-commit framework #22

dontirun opened this issue Jun 22, 2020 · 8 comments
Labels
enhancement New feature or request needs-research

Comments

@dontirun
Copy link

The pre-commit framework is a commonly used tool to create git hooks for code validation. Other AWS tools such as cfn-python-lint provide support for the framework

@dontirun dontirun changed the title Add support for the pre-commit framework Jun 22, 2020
@nathanataws nathanataws added the enhancement New feature or request label Jun 23, 2020
@nathanataws
Copy link
Contributor

This is very reasonable ask. We're looking at integrations right now. We'll pull this into that discussion.

@johnttompkins
Copy link
Contributor

Looks like pre-commit natively supports rust as a buildable language plugin. If this is the case, this should be straightforward to offer.

@benbridts
Copy link
Contributor

There are still some hurdles (at least the last time I tried):

  • You need to have rust installed (not much to do about that, and you can install cfn-guard yourself and use the system "language")
  • pre-commit passes all matching files on one invocation (or at least does so by default). I couldn't get it to invoke cfn-guard multiple times (that's why I created [Enhancement] Run cfn-guard check without parameters #62 )
priyap286 pushed a commit that referenced this issue May 17, 2021
@barnesrobert
Copy link

+1 to this issue. Pre-commits are a vital way of remediating latent vulnerabilities before they're committed.

@kgrvamsi
Copy link

Do we have any update on this Feature request to support pre-commit hooks?

@kgrvamsi
Copy link

if the project already have a .pre-commit-confg.yaml i see the below config works

  - repo: local
    hooks:
      - id: cfn-guard
        name: Run Cfn Guard
        language: system
        entry: "cfn-guard validate -r ./cfn-rules/cloudformation/aws/ --data ./cdk.out/"
        pass_filenames: false
       
@joshfried-aws
Copy link
Contributor

Hi @kgrvamsi we do not have any updates here yet.

dannyvassallo added a commit to dannyvassallo/cloudformation-guard that referenced this issue Jul 9, 2024
dannyvassallo added a commit that referenced this issue Jul 9, 2024
* feat(pre-commit-hook): Initial implementation in python
* feat(pre-commit-hook): Use filenames from hook, update api, and add more tests #22
@dannyvassallo
Copy link
Contributor

@kgrvamsi the initial implementation with documentation has been merged to the main branch of the repo. I'm going to close this issue and we can track anything that comes up in the future in a new one. Thanks to everyone for their patience on this and we hope you enjoy using the new hook!

dannyvassallo added a commit to dannyvassallo/cloudformation-guard that referenced this issue Jul 10, 2024
…ation#22 (aws-cloudformation#524)

* feat(pre-commit-hook): Initial implementation in python
* feat(pre-commit-hook): Use filenames from hook, update api, and add more tests aws-cloudformation#22
dannyvassallo added a commit to dannyvassallo/cloudformation-guard that referenced this issue Jul 10, 2024
commit a81cfd2
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:43:07 2024 -0400

    remove logging

commit 45dfeed
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:40:38 2024 -0400

    parse

commit bf83583
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:36:58 2024 -0400

    check os

commit fc503d9
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:27:58 2024 -0400

    more logging

commit 53bdc22
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:14:48 2024 -0400

    logging

commit c309a19
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:11:37 2024 -0400

    rollback again

commit cf23601
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:08:51 2024 -0400

    do nothing

commit 47c50d7
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 12:01:07 2024 -0400

    update and bundle

commit 9eea059
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 11:54:50 2024 -0400

    rollback

commit de8928f
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 11:52:45 2024 -0400

    rules

commit 47411b6
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 11:48:40 2024 -0400

    Update index.js

commit fa8e7b7
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 11:45:37 2024 -0400

    Update index.ts

commit a4c06b1
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 11:43:20 2024 -0400

    try escaping file paths

commit 45d4cf9
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Wed Jul 10 11:31:47 2024 -0400

    new bundle

commit 2ab135b
Author: Dan Vassallo <dannyvassallo@users.noreply.github.com>
Date:   Tue Jul 9 16:28:08 2024 -0400

    fix(github-action): Handle nested repos after checkout on PR (aws-cloudformation#526)

    * fix(github-action): Handle nested reposafter checkout on PR

commit db8e206
Author: Dan Vassallo <dannyvassallo@users.noreply.github.com>
Date:   Tue Jul 9 16:21:19 2024 -0400

    feat(pre-commit-hook): Update documentation and tag (aws-cloudformation#530)

    * feat(pre-commit-hook): Update documentation and tag

commit 8b1606c
Author: Dan Vassallo <dannyvassallo@users.noreply.github.com>
Date:   Tue Jul 9 13:58:48 2024 -0400

    feat(pre-commit-hook): Initial implementation in python aws-cloudformation#22 (aws-cloudformation#524)

    * feat(pre-commit-hook): Initial implementation in python
    * feat(pre-commit-hook): Use filenames from hook, update api, and add more tests aws-cloudformation#22

commit 3b5d369
Author: Dan Vassallo <dannyvassallo@users.noreply.github.com>
Date:   Tue Jul 9 13:29:33 2024 -0400

    fix(fuzzer): Update Errors to use formatted vec string (aws-cloudformation#528)

    * fix(fuzzer): Update Errors to use formatted vec string

commit 9040ac2
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 16:03:45 2024 -0400

    try different replacement

commit e446ab4
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 15:45:33 2024 -0400

    update guard lib

commit 697a222
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 15:37:52 2024 -0400

    Update typescript_library.yml

commit 7dd62ea
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 15:37:01 2024 -0400

    bundle

commit 7e57559
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 15:29:41 2024 -0400

    Update typescript_library.yml

commit be8ad39
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 14:07:20 2024 -0400

    catch validation error

commit d730eab
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 12:06:28 2024 -0400

    package bundle

commit 8dd2d90
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 12:00:46 2024 -0400

    Update utils.ts

commit e56ed47
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 11:35:36 2024 -0400

    Format readme for linter

commit 5173867
Author: Dan Vassallo <danielvassallo87@gmail.com>
Date:   Tue Jul 2 11:21:39 2024 -0400

    fix(github-action): Handle nested reposafter checkout on PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-research
10 participants