Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
chore: Add commit hooks for testing and linting #149
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: Add commit hooks for testing and linting #149
Changes from 9 commits
25f9d5c
19728a9
3147952
40906ec
3714ccb
9d8bc12
0243e20
074e8eb
b08d0df
a7cbb03
5605966
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add this to a postinstal script potentially, so it gets run automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on recommendation from husky I did not add the prepare script to the pre- or post-install steps. Package managers seem to have discouraged this recently. Unless we have a strong opinion, I'd stick with the recommendation from husky. What do you think?
If a contributor forgets this step, they should still be able to contribute. They'll see failures in the PR builds if the violate the linting or tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm always a fan of a few manual steps as possible, not a massive problem, but it's an extra step people need to read/act on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recommendation from package managers appears sensible on the grounds of better security.
I think that if we do a good job of documenting the setup of the dev environment on the
Contributing.md
document, and remind the user to lint & test both in that document and in the PR checklist it should be enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our PR builds already lint and test the contributor's code. We can add a checklist step indicating that they should lint&test, but the checklist step is not required to make them aware of failures. I'm not inclined to add a checklist step, as this would repeat work that our PR checks already do. I'm open to adding it, if there's another reason :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. I don't have a good answer though, I think we are all in agreement that the main branch is already protected against untested/un-linted code.
On the other hand we want to favor automation as much as possible, so the happy path here would be that a contributor installs and runs the hooks which in turn would mean these steps of the workflow would pass.
There's a non-zero chance that some contributors will forget to install (and perhaps run) these hooks and in case their code is not linted the workflow will fail. Its not at all a big deal since the contributor will see the error, fix it and commit again.
My reasoning was that having an additional check on the list that says "lint your code (this is done automatically via husky [link to relevant script/explanation])" could help avoid some frustration for some, especially those who are new to all this kind of tooling.
Either way all this is a supposition on my part, am more than happy to not add the item and reconsider if this ever becomes a problem :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand now, great idea! I'll work that in :)