Skip to content

Old API

Krzysztof Czarnecki edited this page Oct 26, 2021 · 2 revisions

Old API

Why the change?

To enable validation with pre-commit hooks on top of autogenerated messages we needed to modify the basic form of the configuration scripts.

Although the old API should still work in the future versions, its use is strongly discouraged and the entire documentation has been refactored to reflect this change. Old API will not support validation via Git Hooks.

Old API example

Take a look at the following:

from mkcommit import CommitMessage, to_stdout
from mkcommit.suites import semantic

c = CommitMessage(semantic.default_short(), semantic.default_long())

if __name__ == "__main__":
    to_stdout(c)

Since this script is not using a commit function, when it's imported by mkcommit it will automatically execute. This means all the ask calls will be triggered, hence using this as a hook would not be possible.

Clone this wiki locally