MCPcopy Index your code
hub / github.com/commitizen-tools/commitizen / _parse_setting

Method _parse_setting

commitizen/config/json_config.py:51–70  ·  view source on GitHub ↗

We expect to have a section in .cz.json looking like ``` { "commitizen": { "name": "cz_conventional_commits" } } ```

(self, data: bytes | str)

Source from the content-addressed store, hash-verified

49 return self
50
51 def _parse_setting(self, data: bytes | str) -> None:
52 """We expect to have a section in .cz.json looking like
53
54 ```
55 {
56 "commitizen": {
57 "name": "cz_conventional_commits"
58 }
59 }
60 ```
61 """
62 try:
63 doc = json.loads(data)
64 except json.JSONDecodeError as e:
65 raise InvalidConfigurationError(f"Failed to parse {self.path}: {e}")
66
67 try:
68 self.settings.update(doc["commitizen"])
69 except KeyError:
70 pass

Callers 1

__init__Method · 0.95

Calls 2

updateMethod · 0.80

Tested by

no test coverage detected