diff --git a/qgispluginci/cli.py b/qgispluginci/cli.py index 26c0b423..d27bd19a 100755 --- a/qgispluginci/cli.py +++ b/qgispluginci/cli.py @@ -34,6 +34,12 @@ def cli(): version=__version__, ) + parser.add_argument( + "--no-validation", + action="store_true", + help="Turn off validation of the version to be released or packaged", + ) + subparsers = parser.add_subparsers( title="commands", description="qgis-plugin-ci command", dest="command" ) @@ -71,11 +77,6 @@ def cli(): action="append", help="An additional asset path to add. Can be specified multiple times.", ) - package_parser.add_argument( - "--no-validation", - action="store_true", - help="Turn off validation of `release version`", - ) # changelog changelog_parser = subparsers.add_parser( diff --git a/qgispluginci/parameters.py b/qgispluginci/parameters.py index 0ac68abf..b0eeaf06 100644 --- a/qgispluginci/parameters.py +++ b/qgispluginci/parameters.py @@ -252,23 +252,22 @@ def validate_args(args: Namespace): Raise an exception just in case: - the user didn't opt-out of validation using the `--no-validation` flag; and - the value of `release_version` matches no supported pattern. - In any case, warn the user if the value of `release_version` doesn't match the semver pattern. """ if not hasattr(args, "release_version") or not args.release_version: return + if args.no_validation: + logging.warning("Disabled release version validation.") + return + patterns = Parameters.get_release_version_patterns() semver_compliance = re.match(patterns.pop("semver"), args.release_version) if not semver_compliance: logging.warning( - f"Be aware that '{args.release_version}' is not a semver-compliant version." + f"Be aware that '{args.release_version}' is not a semver-compliant version. It might still comply with acceptable practices." ) - if args.no_validation: - logging.warning("Disabled release version validation.") - return - if semver_compliance or any( re.match(other_pattern, args.release_version) for other_pattern in patterns.values()