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

add pre-commit config #63

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

KrisThielemans
Copy link
Contributor

@KrisThielemans KrisThielemans commented Nov 7, 2024

Copied from https://github.com/SyneRBI/PETRIC/blob/main/.pre-commit-config.yaml, but deleted mypy as yardl generates files that throw up errors with mypy and is using pyright instead.

Obviously, this will change formatting in various files, which we'll need to commit.

@KrisThielemans
Copy link
Contributor Author

I had a quick look at adding

- repo: https://github.com/microsoft/pyright
  rev: 1.1.388
  hooks:
  - id: myright

but that fails with

$ pre-commit run --all
[INFO] Initializing environment for https://github.com/microsoft/pyright.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', 'v1.1.388')
return code: 1
stdout: (none)
stderr:
    error: pathspec 'v1.1.388' did not match any file(s) known to git.
Check the log at /home/sirfuser/.cache/pre-commit/pre-commit.log
(prd) sirfuser@vagrant:~/devel/PETSIRD$ pre-commit run --all
[INFO] Initializing environment for https://github.com/microsoft/pyright.
An error has occurred: InvalidManifestError: 
=====> /home/sirfuser/.cache/pre-commit/repoa021nr1x/.pre-commit-hooks.yaml is not a file

In any case, this is likely to fail on a bare repo anyway, as the types are only available after generation.

@KrisThielemans
Copy link
Contributor Author

I have no idea if changes are required in the devcontainer.

Currently using Ubuntu 22.04 version
@KrisThielemans
Copy link
Contributor Author

KrisThielemans commented Nov 7, 2024

Are settings in https://github.com/ETSInitiative/PETSIRD/blob/main/.devcontainer/devcontainer.json independent of this? (That'd be a pain). (Possibly also relevant microsoft/vscode-python#10165)

@KrisThielemans
Copy link
Contributor Author

Once done, I suggest we use https://pre-commit.ci/

@KrisThielemans KrisThielemans added the enhancement New feature or request label Nov 7, 2024
@KrisThielemans KrisThielemans merged commit bb1fc20 into ETSInitiative:main Nov 8, 2024
1 check passed
@KrisThielemans KrisThielemans deleted the pre-commit-hooks branch November 8, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant