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 setup #106

Merged
merged 1 commit into from
Dec 17, 2023
Merged

Conversation

mdeweerd
Copy link
Contributor

I propose the addition of a pre-commit setup which helps to format documentation and code, and make some static code checks upon commit.
That helps improve code quality.

I've adjusted some markdown files so that verbatim lines will not suffer from markdown file formatting.

pip install pre-commit
# Run specific hooks
pre-commit run -a codespell
pre-commit run -a cpplint
# Run all hooks (that would run on commit)
pre-commit run -a
# To run on every commit
pre-commit install

I've disabled most notifications.

@NorthernMan54
Copy link
Owner

Sorry am not familiar with pre-commit, is it significantly different than the existing GitHub actions ?

@mdeweerd
Copy link
Contributor Author

pre-commit is a tool that helps you run other tools locally upon commit.
It helps you to avoid committing code that would fail in the workflow, still needs formatting or other code corrections.

It is similar to a workflow because it can run some of the same tools, and in certain projects pre-commit is also run in the workflow (on selected pre-commit hooks).

In the workflow you generally do not allow changes to your code, while locally with pre-commit you will generally allow them. So when you use pre-commit, you normally do more locally.

pre-commit does more here because of the other checks. for instance, it also helps check spelling:

src/rtl_433_ESP.h:89: interupt ==> interrupt
src/rtl_433_ESP.h:226: formated ==> formatted
src/rtl_433_ESP.h:255: formated ==> formatted
src/rtl_433_ESP.h:261: minumum ==> minimum
src/rtl_433_ESP.h:283: interupt ==> interrupt
src/rtl_433_ESP.h:411: avaiable ==> available
`` 

@NorthernMan54
Copy link
Owner

@mdeweerd I just did a commit from GitHub Desktop from this pull request, and didn't see anything ?

@mdeweerd
Copy link
Contributor Author

I am not familiar with Github Desktop. It seems that it is able to run pre-commit (desktop/desktop#13112). So there must be a way to run "pre-commit install" to add the hooks to the git clone.

@mdeweerd mdeweerd force-pushed the pre-commit branch 3 times, most recently from b42f189 to d0b63bc Compare November 27, 2023 21:58
@NorthernMan54 NorthernMan54 changed the base branch from master to Release-0.3.2 December 17, 2023 15:20
@NorthernMan54 NorthernMan54 merged commit be71d74 into NorthernMan54:Release-0.3.2 Dec 17, 2023
2 checks passed
@NorthernMan54
Copy link
Owner

Tks

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

Successfully merging this pull request may close these issues.

2 participants