Use a stricter semantic version check for some version fields #225
No reviewers
Labels
No Label
Priority
Critical
Priority
High
Priority
Low
Priority
Normal
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Type
Breaking
Type
Documentation
Type
Enhancement
Type
Feature
Type
Report
Type
Security
Type
Suggestion
Type
Testing
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: infrastructure/extensions-website#225
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix-semver-versions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This applies to:
The only field which still takes a full semantic version is the
version
field itself.See related discussion:
blender/blender#124885
@ -537,3 +537,3 @@
class SchemaVersionValidator(VersionValidator):
class NonSemVerVersionValidator(VersionValidator):
this is a confusing name, especially when the docstring says that it is a semantic version.
a better name may be
SemVerNoLabelValidator
, or something similar@ -540,0 +544,4 @@
@staticmethod
def is_version_string(version):
import re
this import should be at the top of the file
@ -540,0 +550,4 @@
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# Define the regex pattern for major.minor.patch (do not include any additional label).
pattern = r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)'
missing
$
anchorI would also declare this as a package "constant" at the top of the file, so that it is compiled once, and not on every validation
@ -540,0 +553,4 @@
pattern = r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)'
# Make sure we match the entire string with the pattern.
return bool(re.fullmatch(pattern, version))
this is unusual, why not use the
$
anchor in the regex and do a regular match?@ -540,0 +567,4 @@
# Play safe and first guarantee that the string can be validated as a Version type
# which is expected throghout the rest of the code.
if super().validate(name=name, value=value, manifest=manifest):
this is not needed, we need to fully rely on the check below
Ready for another round
looks good!