open-plan-tool / gui

Energy Planning Application
Other
8 stars 4 forks source link

Feature/add pre commit hook for linting #217

Closed 4lm closed 2 weeks ago

4lm commented 2 years ago

This PR is based on unmerged PR #197.

Closes #215.

@Bachibouzouk, please review this PR and merge on approval. But first, PR #197 needs to be fixed as spoken by you and merged because this PR depends on it.

This PR uses pre-commit for installing and managing Git hooks.

Initial installation:

The config can be found in .pre-commit-config.yaml in the root folder.

Hooks run before every commit.

Run changed files manually:

Run all files manually (recommended after installing a new hook):

Please note: I configured that hooks shall fail fast. This can result in running the commit (or pre-commit) multiple times. If we realize that this behavior is different from what we want to see, we can change it in the config in the future.

paulapreuss commented 1 month ago

@Bachibouzouk what is the situation with this PR / issue? I think it would be nice to get the pre-commit hooks set up once before starting back up with development, then it is out of the way :)

Bachibouzouk commented 1 month ago

Thanks @paulapreuss for taclking this, I think it make sense to tackle precommit at this stage

Bachibouzouk commented 1 month ago

I think this PR needs rebase

paulapreuss commented 2 weeks ago

@Bachibouzouk I rebased this on main, added some hooks that were not listed but we are using in CP Nigeria and updated the black version to the most current one (24.8). Feel free to have a look and let me know if this is good to go or you would like to handle anything differently.

Bachibouzouk commented 2 weeks ago

I rebased this on main

@paulapreuss - are you sure? When I checked out the branch the history did not build on top of main rather on top of fix/storage-sub-components-name. I did rebase locally onto main and there were no conflicts. Maybe your version of main was outdated?

paulapreuss commented 2 weeks ago

I rebased this on main

@paulapreuss - are you sure? When I checked out the branch the history did not build on top of main rather on top of fix/storage-sub-components-name. I did rebase locally onto main and there were no conflicts. Maybe your version of main was outdated?

You're right, apparently I had not pulled the most recent changes. I'll rebase it again.