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

Method _parse_setting

commitizen/config/yaml_config.py:40–56  ·  view source on GitHub ↗

We expect to have a section in cz.yaml looking like ``` commitizen: name: cz_conventional_commits ```

(self, data: bytes | str)

Source from the content-addressed store, hash-verified

38 return config_doc is not None and config_doc.get("commitizen") is not None
39
40 def _parse_setting(self, data: bytes | str) -> None:
41 """We expect to have a section in cz.yaml looking like
42
43 ```
44 commitizen:
45 name: cz_conventional_commits
46 ```
47 """
48 try:
49 doc = yaml.safe_load(data)
50 except yaml.YAMLError as e:
51 raise InvalidConfigurationError(f"Failed to parse {self.path}: {e}")
52
53 try:
54 self.settings.update(doc["commitizen"])
55 except (KeyError, TypeError):
56 pass
57
58 def set_key(self, key: str, value: object) -> Self:
59 with self.path.open("rb") as yaml_file:

Callers 1

__init__Method · 0.95

Calls 2

updateMethod · 0.80

Tested by

no test coverage detected