`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
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:
Python Black: The project already uses Black manually; adding a pre-commit and CI config makes this formatting easier for contributors to adopt and ensures standard style for submitted pull requests
iSort: Sorts Python imports in a consistent way, slightly reducing chances of merge conflict
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.
check-added-large-files: Helps prevent accidentally committing binary or image files to the repo by limiting new files to 100KB.
fix-byte-order-marker: Ensures files have consistent byte order markers (e.g. after being edited by a contributor using Windows)
check-case-conflict: Ensures no files are committed that would cause a conflict on case-insensitive file systems
check-docstring-first: Ensures Python docstrings are in the proper place
check-merge-conflict: Ensures no merge conflict markers are present in committed files
mixed-line-ending: Forbids CRLF line endings
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.
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.
check-added-large-files
: Helps prevent accidentally committing binary or image files to the repo by limiting new files to 100KB.fix-byte-order-marker
: Ensures files have consistent byte order markers (e.g. after being edited by a contributor using Windows)check-case-conflict
: Ensures no files are committed that would cause a conflict on case-insensitive file systemscheck-docstring-first
: Ensures Python docstrings are in the proper placecheck-merge-conflict
: Ensures no merge conflict markers are present in committed filesmixed-line-ending
: ForbidsCRLF
line endingsOnce 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:
(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.