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

ENH: Add GitHub Actions workflow for running "pre-commit" #1170

Merged
merged 1 commit into from
Jan 13, 2024

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Jan 13, 2024

This pull-request adds workflow leveraging pre-commit, a framework for managing and maintaining pre-commit hooks.

Important

For now, this will only report info to developers after the PR is submitted. There are no changes in the hook setup locally yet.

See https://pre-commit.com/ and https://github.com/pre-commit/action

Running the pre-commit locally can be done using the following
command:

pre-commit run --all-files

The hooks enabled in the "pre-commit-config.yaml" configuration
file are:

  • check-added-large-files
    Prevent giant files from being committed.

    Set the size to 1024 to match the value hard-coded in
    https://github.com/Slicer/Slicer/blob/hooks/pre-commit#L125

  • check-case-conflict
    Check for files with names that would conflict on a case-insensitive
    filesystem like MacOS HFS+ or Windows FAT.

  • check-merge-conflict
    Check for files that contain merge conflict strings.

  • check-symlinks
    Checks for symlinks which do not point to anything.


To allow a gradual improvement of the code base while carefully reviewing
each changes, exceptions for all issues reported by locally running the
following command are listed in .flake8 configuration files:

  pre-commit run --all-files

It is based from similar updates integrated in Slicer through Slicer/Slicer#6262 themselves adapted from prior work done by @henryiii in https://github.com/scikit-build/scikit-build and https://scikit-hep.org/developer/style

This commit adds workflow leveraging pre-commit, a framework for
managing and maintaining pre-commit hooks.

See https://pre-commit.com/ and https://github.com/pre-commit/action

Running the pre-commit locally can be done using the following
command:

  pre-commit run --all-files

The hooks enabled in the "pre-commit-config.yaml" configuration
file are:

* check-added-large-files
  Prevent giant files from being committed.

  Set the size to 1024 to match the value hard-coded in
  https://github.com/Slicer/Slicer/blob/hooks/pre-commit#L125

* check-case-conflict
  Check for files with names that would conflict on a case-insensitive
  filesystem like MacOS HFS+ or Windows FAT.

* check-merge-conflict
  Check for files that contain merge conflict strings.

* check-symlinks
  Checks for symlinks which do not point to anything.
@jcfr jcfr force-pushed the ci-github-actions-add-linting branch from 63743ee to f2cbee1 Compare January 13, 2024 16:49
@jcfr jcfr merged commit 753193f into commontk:master Jan 13, 2024
3 of 4 checks passed
@jcfr jcfr deleted the ci-github-actions-add-linting branch January 13, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant