Skip to content

Set up pre-commit for running hooks and tasks such as linting.#11

Open
jacksonj04 wants to merge 4 commits intomainfrom
afl-27-set-up-pre-commit-git-hook-to-run-linting-script
Open

Set up pre-commit for running hooks and tasks such as linting.#11
jacksonj04 wants to merge 4 commits intomainfrom
afl-27-set-up-pre-commit-git-hook-to-run-linting-script

Conversation

@jacksonj04
Copy link
Copy Markdown
Member

@jacksonj04 jacksonj04 commented Mar 21, 2024

pre-commit is a cross-language framework for managing pre-commit hooks. This PR adds the necessary configuration and documentation changes, and then whips existing files into shape.

Specifically, this is configured to:

  • Make sure lines don't have trailing whitespace
  • Make sure the last line in a file is empty
  • Check JSON and YAML files are syntactically valid
  • Prevent files over 500kb (configurable) from being committed
  • Run the prettier code formatter over scss, yaml, markdown and js files
  • Run dotnet format across the codebase

Developers can install pre-commit in several ways, including through pip, homebrew and conda. Once that's done, running pre-commit install in the directory will set up the necessary git hooks.

[pre-commit](https://pre-commit.com/) is a cross-language framework for managing pre-commit hooks. This sample file sets up some very basic checks to enforce things like no trailing whitespace, and the last line in a file being blank.
@jacksonj04 jacksonj04 marked this pull request as ready for review March 28, 2024 14:32
@jacksonj04
Copy link
Copy Markdown
Member Author

@dynamictulip @lookupdaily @jkempster34 we should investigate doing this with something like https://alirezanet.github.io/Husky.Net/

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