Add precommit hooks from the precommit package, and modify to include an additional hook to ensure package version is incremented on every commit (via the increment_dev_version function). This function can also be used to update a local '.pre-commit-config.yaml' file to reflect the latest version at the specified 'url'.
add_precommit_hooks( url = "https://github.com/mpadge/mpmisc", branch = "master", location = "inst/precommit" )
url | The location of a repository containing the desired '.pre-commit-hooks.yaml' file to be installed in the local repository. |
---|---|
branch | The branch of the remote repository from which the
|
location | Local location to store precommit hooks. Default is relative path within current directory, but it is advised to set an absolute path to a more general location (such as '~/bin/precommit'). |
This function must be run within a package directory, and requires the precommit package to be installed.
The function downloads a pre-commit hook file in 'inst/precommit/description', and notes that this file should be moved to a more general location, and the '.pre-commit-hooks.yaml' file updated accordingly. It may also be necessary to change the permissions of the 'description' pre-commit hook, for example (on *nix systems) via 'sudo chmod u_x description'.