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
pre-commit hook argument for schemafile doesn't support ~/ #9
Comments
you can try to replace |
right, there shall be |
I think there's a fair case to be made that the current behavior is correct. The shell -- or whatever tool is calling
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.4.0
hooks:
- id: check-jsonschema
files: foo.json
entry: bash -c 'check-jsonschema --schemafile "$HOME/.cache/jsonschema_validate/github-workflow" "$@"' -- I will warn you to be cautious in general relying on uncontrolled data in people's homedirs. It strikes me as likely to cause issues -- but your workflow, your rules. 😄 As an alternative workaround, there's always the "escape valve" of adding a local script hook and putting whatever logic you want into a bash script. Just pass If neither of these work, we can consider |
@sirosen thank you so much for the well thought out reply! Your suggestions seem promising. The issue I have now with |
I haven't heard more about this, but I'm confident that this can be solved without a change in That said, I'm looking back at this and think I'm being too rigid. (I often find it frustrating when maintainers choose "purity" rather being pragmatic and helping me. Now I'm being that guy. 😂 )
|
I've released v0.5.0 . It adds a call to
and see the 0.5.0 was a fairly extensive refactor, aimed at making more of the code testable. There are also some new flags ( |
If we have a schemafile in the user's home directory, I can pass
~/schemafile.json
when invokingcheck-jsonschema
from the command line without error, but if I passargs: ["--schemafile", "~/schemafile.json"]
to the pre-commit hook, I get aFileNotFoundError
, because it does not expand the ~/ operator. Looks like the call toopen
could use aos.path.expanduser
on the path being opened? This allows multiple developers with different usernames to have the schemafile in their home directory, without having to have the username hard-coded in the pre-commit yaml file.The text was updated successfully, but these errors were encountered: