Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

NotImplementedError thrown on cz check with cz_customize commitizen #273

Closed
@ivabrajer

Description

@ivabrajer

Description

For custom made commitizen (customization done via configuration file) it is not possible to manually verify commit message at all. It is something that I noticed while playing with git hook configuration via pre-commit and using commitizen for commit-msg git hook. Since it didn't work with pre-commit, I tried it as standalone tool and got the same error. Therefore I don't think it's related to some bug inside pre-commit.

Steps to reproduce

  1. Install latest commitizen version (in my case inside previously created virtualenv with pipenv) with pip install -U commitizen
  2. Take example schema from documentation: https://commitizen-tools.github.io/commitizen/customization/ and save it inside some test git repo root folder as .cz.toml file
  3. Run the following command: cz -n cz_customize check -m "test test"

Current behavior

Exception is thrown:

Traceback (most recent call last):
  File "/home/ibrajer/Documents/envs/test-repo-XNs3ZnQ3/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/ibrajer/Documents/envs/test-repo-XNs3ZnQ3/lib/python3.8/site-packages/commitizen/cli.py", line 283, in main
    args.func(conf, vars(args))()
  File "/home/ibrajer/Documents/envs/test-repo-XNs3ZnQ3/lib/python3.8/site-packages/commitizen/commands/check.py", line 59, in __call__
    pattern = self.cz.schema_pattern()
  File "/home/ibrajer/Documents/envs/test-repo-XNs3ZnQ3/lib/python3.8/site-packages/commitizen/cz/base.py", line 73, in schema_pattern
    raise NotImplementedError("Not Implemented yet")
NotImplementedError: Not Implemented yet

Desired behavior

It should work since it works with other commitizens. I tried changing name to cz_conventional_commits and cz_jira in cz check command, everything worked fine without experiencing NotImplementedError exception.

I checked the source code and I believe that the problem might be in CustomizeCommitsCz class not overriding schema_pattern() method from base class. So when the following line in invoked in Check class for this particular commitizen type it results with NotImplementedError exception:

pattern = self.cz.schema_pattern()

Please check on your side and let me know if I'm doing something wrong here.
Thanks in advance!

Environment

cz version: 2.4.0
Python version: 3.8.0
pipenv version: 2018.11.26
OS: Ubuntu 18.04.4 LTS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions