This pre-commit hook requires the serialVersionUID to be changed if the containing file was changed. If a change is not required, simply add or remove an empty comment in the line of the serialVersionUID.
- install pre-commit on your machine
- Add the following lines to your
.pre-commit-config.yaml(if not already present):- repo: https://github.com/exasol/serial-version-uid-change-pre-commit-hook rev: master hooks: - id: serial-version-uid
- Install the hooks using:
pre-commit install
- Now
git commitwill fail if a check does not pass. You can also run the checks manual by executingpre-commit.
This script does only check on a file system level. Accordingly, it may produce false positives in case a single file contains multiple classes (e.g a nested Exception class).