evilmartians/lefthook

Can't exclude multiple files.

Florian-crg opened this issue ยท 4 comments

๐Ÿ”ง Summary

We cannot exclude multiple files.

Lefthook version

1.3.0

Steps to reproduce

Add multiple files to the exclude property.

Expected results

To exclude all files listed below the exclude property.

Actual results

Error: 1 error(s) decoding:

  • '[linter].exclude' expected type 'string', got unconvertible type '[]interface {}', value: '[file_1.ts file_2.js]'

Possible Solution

This might not be implemented. Though while looking the documentation it seems that it should.

https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#exclude

# lefthook.yml

pre-commit:
  commands:
    lint:
      glob: "*.rb"
      exclude:
        - config/routes.rb
        - config/application.rb
        - config/initializers/*.rb
        - spec/rails_helper.rb
      run: bundle exec rubocop --force-exclusion {staged_files}

@Florian-crg , you probably need to upgrade to 1.7 version (>=1.7.7) where this feature was introduced

Thanks for the inforamtion. I'd love to upgrade lefthook. Though it is not as simple as I thought.

I first tired to upgrade the package. Which worked in a way as I was it installed the latest version. The problem is that lefthook seems stuck in 1.3.0.

So I tried to remove it, even after remove I still works, any steps I am missing?

Screenshot 2024-08-13 at 09 16 50

@Florian-crg , try figuring out where the binary is which lefthook, you may have it installed with npm or go install. The path will show you the installation source.

Yes that what I did, which lefthook output /usr/local/bin/lefthook. I do not have go installed, and to be sure it was not installed with something else I tried to globally remove it using, ruby, npm and yarn.

I'll deep dive to force the uninstallation and figure it out. I was just wondering if there was maybe something I missed to remove the package correctly.

Thanks for your help! ๐Ÿ™

EDIT: I found it, it was not fully removed from brew I will delete it another way.