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

Create .pre-commit-config.yaml #15

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Create .pre-commit-config.yaml #15

wants to merge 8 commits into from

Conversation

Kilo59
Copy link
Contributor

@Kilo59 Kilo59 commented Feb 29, 2024

Define a simple pre-commit config file.
These checks...

  1. prevent invalid yaml or json syntax
  2. prevent committing a private key
  3. ensure files end with a new-line
  4. remove trailing whitespace.

I can remove any of these checks, if we don't like them.
The fixes are applied automatically, developers don't need to do anything to take advantage of these fixes.

In the future, we can also use pre-commit to do things like auto-apply prettier formatting.
https://github.com/pre-commit/mirrors-prettier
Or any of a number of supported hooks
https://pre-commit.com/hooks.html

@Kilo59 Kilo59 mentioned this pull request Feb 29, 2024
@Kilo59 Kilo59 self-assigned this Feb 29, 2024
Copy link
Contributor

@NathanFarmer NathanFarmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't use pre-commit locally this will end up adding commits to most PRs. Should we add pre-commit to our devDependencies?

@Kilo59
Copy link
Contributor Author

Kilo59 commented Feb 29, 2024

@NathanFarmer pre-commit isn't an npm/pnpm package. It's a pip/brew package.
There is a `pre-commit package of the same name, but that's a totally different framework.

No developer should actually need to install anything, but I can add instructions for doing that.

Edit

We could have a pre-install script. But that would force an install for pre-commit even if developers don't want to use it locally. The benefit of the pre-commit ci is that developers are free to use it locally or not.
https://pnpm.io/scripts#pnpmdevpreinstall

@Kilo59 Kilo59 requested a review from NathanFarmer February 29, 2024 16:22
@TrangPham
Copy link
Contributor

I'm fine with having this - but I also think we don't need it for this repo. Is there a way to just opt out of pre-commit.ci?

@Kilo59 Kilo59 force-pushed the pre-commit-config branch from 5ce73c7 to 9094ab7 Compare March 14, 2024 01:45
@Kilo59
Copy link
Contributor Author

Kilo59 commented Mar 14, 2024

@TrangPham

Is there a way to just opt out of pre-commit.ci?

Not easily because it's enabled org-wide.
The best way to "opt out" would be just to define a very minimal pre-commit config which this now is.

Although I would recommend using it to do some additional things like apply prettier formatting automatically.

@Kilo59 Kilo59 requested a review from dctalbot August 13, 2024 14:32
Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.80%. Comparing base (a458c7a) to head (cf86daa).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #15   +/-   ##
=======================================
  Coverage   74.80%   74.80%           
=======================================
  Files          38       38           
  Lines         504      504           
  Branches       96       96           
=======================================
  Hits          377      377           
  Misses         90       90           
  Partials       37       37           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

3 participants