-
Notifications
You must be signed in to change notification settings - Fork 55
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
Chore - Pre-commit #164
Chore - Pre-commit #164
Conversation
@cusma, it seems to me that trimming trailing white spaces does not work as expected, i.e., they are not automatically removed during the commit process (what was my expectation). Instead, the pre-commit process fails if there are trailing white spaces in the files. Any views on this? |
@mhinkkan did you install pre-commit run -a Before pushing the commit? It should validate and fix the code according the formatting and linting rules automatically. Than the |
Also I described the process in the PR body, but I will open a PR to add this small step to the README and the contributing guidelines so the automatic formatting and linting process is clear for all the contributors. |
@cusma: Instead of installing and running pre-commit locally, would it be simpler to run it automatically at GitHub instead (GitHub actions or CI, I'm not too familiar with these...)? |
It could be done, but it would require installing an external GitHub Application (e.g. In my opinion, the combination of running pre-commit hooks locally and check PR's quality in remote with GitHub actions (CI pipeline) is a pretty standard process, as people tend to avoid autogenerated code changes from bots/apps that are not approved/signed by developers (a part from dependencies update proposals, like Dependabot). Running pre-commit automatically in remote kind goes against the design and purpose of pre-commit, which is supposed really to just be installed locally (once, in a cached and project-isolated environment) and invoked automatically (with git hooks) before commits. Anyway, I defer this decision to you as project author and maintainer, happy to help either way. P.S. |
Thanks, let's keep pre-commit local at this point. I added it to optional @all-contributors please add @cusma for infra |
I've put up a pull request to add @cusma! 🎉 |
Intro
Hi all! 👋
This is Cosimo! MSc in Electrical Engineering at Politecnico di Torino. ⚡️
It is my first contribution on the repository. This PR supersedes #149 and #160.
Scope
This PR is not touching any "core" electrical engineering feature, it is just improving the overall quality of the codebase and of the open source project.
The PR adds pre-commit hooks and GH action to the repository:
To run pre-commit:
pre-commit run -a
in the folder containing the.pre-commit-config.yaml
fileGit hooks
I've added the following git hooks to the
.pre-commit-config.yaml
:.yaml
files for parseable syntax (again, in this repo would target mostly GH actions and pre-commit config).toml
files for parseable syntaxGH Action
A
pre-commit.yml
GH actions is added to include pre-commit validation in the CI pipeline.Automatic changes
diff
is autogenerated according code formatting rules.