yor icon indicating copy to clipboard operation
yor copied to clipboard

[Bug] `git_last_modified_at` commit loop with pre-commit hook usage

Open JayeMcC opened this issue 1 year ago • 1 comments

git_last_modified_at tag was caught in a loop as a pre-commit hook. Every time I went to commit changes it would update the value of git_last_modified_at on some resources preventing the commit and adding more changes.

At the same time the affected resources had their git_commit tag set to "N/A".

My workaround was to skip the git_last_modified_at tag, but even that was awkward. I expected to be able to use the pre-commit format of something like this:

repos:
  - repo: https://github.com/bridgecrewio/yor
    rev: 0.1.196
    hooks:
      - id: yor
        name: yor
        entry: yor tag
        args:
          -  --directory "."
          - --skip-tags "git_last_modified_at"
        language: golang
        types: [terraform]
        pass_filenames: false

But had to jank it with:

  - repo: https://github.com/bridgecrewio/yor
    rev: 0.1.196
    hooks:
      - id: yor
        name: yor
        entry: yor tag --directory "." --skip-tags "git_last_modified_at"
        language: golang
        types: [terraform]
        pass_filenames: false

Setup:

  • Ubuntu: 22.04
  • Terraform: 1.7.3
  • Precommit: 3.7.1

The field isn't that useful to me as I've got git blame once we pull up the file, but I figure I'd mention the experience in case others run into it.

JayeMcC avatar Jul 25 '24 08:07 JayeMcC

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 07 '24 01:09 stale[bot]