(filepath: str | None = None)
| 32 | |
| 33 | |
| 34 | def read_cfg(filepath: str | None = None) -> BaseConfig: |
| 35 | if filepath is not None: |
| 36 | conf_path = Path(filepath) |
| 37 | if not conf_path.is_file(): |
| 38 | raise ConfigFileNotFound() |
| 39 | conf = _create_config_from_path(conf_path) |
| 40 | if not conf.contains_commitizen_section(): |
| 41 | raise ConfigFileIsEmpty() |
| 42 | return conf |
| 43 | |
| 44 | config_candidates = _resolve_config_candidates() |
| 45 | if len(config_candidates) > 1: |
| 46 | out.warn( |
| 47 | f"Multiple config files detected: {', '.join(str(conf.path) for conf in config_candidates)}. " |
| 48 | f"Using config file: '{config_candidates[0].path}'." |
| 49 | ) |
| 50 | |
| 51 | return config_candidates[0] if config_candidates else BaseConfig() |
nothing calls this directly
no test coverage detected
searching dependent graphs…