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

run -v should provide file search information for easy troubleshooting #2179

Closed
DanKaplanSES opened this issue Jan 1, 2022 · 2 comments
Closed
Labels

Comments

@DanKaplanSES
Copy link

I am trying to write something similar to this config file so I can run a prettier in a subdirectory:

-   repo: local
    hooks:
    -   id: go-unit-tests
        name: run go test s(go test)
        language: system
        entry: bash -c 'cd subdir && exec go test ./...'
        pass_filenames: false
        types: [go]
        files: ^subdir/

Here's my version:

repos:
    - repo: local
      hooks:
          - id: firebase-formatter
            name: Firebase Formatter
            language: system
            entry: bash -c 'cd firebase/functions && echo "$PWD"'
            pass_filenames: false
            types: [ts]
            files: ^firebase/functions/

Here's my command line:

➜  backend git:(chore/prettier--#179125952) ✗ pre-commit run -v firebase-formatter
Firebase Formatter...................................(no files to check)Skipped
- hook id: firebase-formatter

I've tried variations of this configuration file, but it always outputs the same thing. How can I troubleshoot this further? It would be helpful if the verbose flag could tell me how it searched. Output like this would help a lot:

➜  backend git:(chore/prettier--#179125952) ✗ pre-commit run -v firebase-formatter
Looking for ts files in firebase/functions.........................(nothing found)
Looking for ts files in firebase/functions/src.........................(nothing found)
Looking for ts files in firebase/functions/src/foo.........................(nothing found)
Firebase Formatter...................................(no files to check)Skipped
@asottile
Copy link
Member

asottile commented Jan 1, 2022

in the future please use the template, it is there so I can help you faster and you can provide the necessary information

the identity hook is intended for this purpose -- it will print the arguments passed to it

@DanKaplanSES
Copy link
Author

DanKaplanSES commented Jan 1, 2022

I apologize for that, I didn't consider this a "bug" and i looked at other issues first and they didn't seem to follow it either, so I thought I was doing the right thing by not using the template. Thanks for the help

repos:
    - repo: meta
      hooks:
          - id: identity
            name: Firebase Formatter
            language: system
            entry: bash -c 'cd firebase/functions && echo "$PWD"'
            pass_filenames: false
            types: [ts]
            files: ^firebase/functions/.*
    - repo: local
      hooks:
          - id: firebase-formatter
            name: Firebase Formatter
            language: system
            entry: bash -c 'cd firebase/functions && echo "$PWD"'
            pass_filenames: false
            types: [ts]
            files: ^firebase/functions/.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants