univ-of-utah-marriott-library-apple / python-jamf

`python-jamf` is a library for connecting to a Jamf Server. It maps Jamf Pro records to a Record class. It is the basis for the `jctl` tool to automate patch management & packages and many other items.
MIT License
56 stars 17 forks source link

Add pre-commit configuration and corresponding GH Actions job #73

Closed homebysix closed 2 years ago

homebysix commented 2 years ago

This pull request creates a pre-commit configuration and GitHub Actions job that runs it upon submitting PRs or pushing to main. The configuration includes two major formatting automations:

The above two changes will result in a new commit being made to the codebase automatically once merged. The changes will be to style only, and should not affect function at all. Here is a preview of that commit.

I've included a few other relatively minor checks. The codebase already complies with all of these, so no changes are needed for these.

Once this is merged, it may be helpful to add a section to the jctl Contribute wiki page, between the "Clone the Forked Repository" and "Create a Feature Branch" sections:

### Install and enable pre-commit

Pre-commit is a framework that automatically runs linting and consistency checks before changes
are committed to the repository locally. For contributors who will be working in Python code, we
recommend [installing pre-commit](https://pre-commit.com/#install) and running `pre-commit install`
in the repo to activate these checks.

(Note that even if contributors don't install pre-commit locally, GH Actions will run the checks upon submitting PRs and fix what it can.)

On the AutoPkg project, we made a similar change recently, and it's worked well.

homebysix commented 2 years ago

Also: if you like this new automation, I can submit a similar PR to jctl.

uurazzle commented 2 years ago

Also, added the Install and enable pre-commit section to the wiki. Thanks for your contribution.