MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / _validate_arguments

Method _validate_arguments

commitizen/commands/bump.py:175–197  ·  view source on GitHub ↗
(self, current_version: VersionProtocol)

Source from the content-addressed store, hash-verified

173 return cast("Increment", str(increment))
174
175 def _validate_arguments(self, current_version: VersionProtocol) -> None:
176 errors: list[str] = []
177 if self.arguments["manual_version"]:
178 for val, option in (
179 (self.arguments["increment"], "--increment"),
180 (self.arguments["prerelease"], "--prerelease"),
181 (self.arguments["devrelease"] is not None, "--devrelease"),
182 (self.arguments["local_version"], "--local-version"),
183 (self.arguments["build_metadata"], "--build-metadata"),
184 (self.arguments["major_version_zero"], "--major-version-zero"),
185 ):
186 if val:
187 errors.append(f"{option} cannot be combined with MANUAL_VERSION")
188
189 if self.arguments["major_version_zero"] and current_version.release[0]:
190 errors.append(
191 f"--major-version-zero is meaningless for current version {current_version}"
192 )
193 if self.arguments["build_metadata"] and self.arguments["local_version"]:
194 errors.append("--local-version cannot be combined with --build-metadata")
195
196 if errors:
197 raise NotAllowed("\n".join(errors))
198
199 def _resolve_increment_and_new_version(
200 self, current_version: VersionProtocol, current_tag: git.GitTag | None

Callers 1

__call__Method · 0.95

Calls 1

NotAllowedClass · 0.90

Tested by

no test coverage detected