This repository contains a pre-commit
hook that will check copyrights in source files.
In addition some standard golang
commands (such as gofmt
) can also be used.
The following ids can be used:
check-go-copyright
- this will check the copyright of go files.check-scala-copyright
- this will check the copyright of Scala files.check-python-copyright
- this will check the copyright of Python files.
The copyright script will check the files that are passed in by pre-commit
,
if the file list is empty then it will check locally modified files, which it does as shown below:
git status -s --porcelain
For this script to work there must be a line in the file that matches this regular expression:
.*Copyright IBM Corp\. [0-9]+, {0,1}[0-9]+\. All Rights Reserved..*$
The following are some examples:
// Copyright IBM Corp. 2022. All Rights Reserved.
// Copyright IBM Corp. 2022, 2023. All Rights Reserved.
go-fmt
- this will rungo fmt
on all the go files.
This will use golines to format files for maximum line length.
In the args
section you can specifiy options such as --max-len=120 --tab-len=2
.
Note that the hook will try to install golines
as for now the golang support
in pre-commit
does not support additional_dependencies.