The function semver_interval(m::RegexMatch) is poorly designed in the sense that it handles both regex parsing and the splitting of cases based on the content of the version number found. This has led to me duplicating part of the code in an undesirable fashion.
I believe this part
if vertyp === :caret
if major != 0
return VersionRange(v0, VersionBound((v0[1],)))
elseif minor != 0
return VersionRange(v0, VersionBound((v0[1], v0[2])))
else
if n_significant == 1
return VersionRange(v0, VersionBound((0,)))
elseif n_significant == 2
return VersionRange(v0, VersionBound((0, 0,)))
else
return VersionRange(v0, VersionBound((0, 0, v0[3])))
end
end
else
if n_significant == 3 || n_significant == 2
return VersionRange(v0, VersionBound((v0[1], v0[2],)))
else
return VersionRange(v0, VersionBound((v0[1],)))
end
end
should be extracted to a separate method semver_interval(v0::VersionNumber, vertyp::Symbol) that can be called by others wanting to implement semantic versioning.
The function
semver_interval(m::RegexMatch)
is poorly designed in the sense that it handles both regex parsing and the splitting of cases based on the content of the version number found. This has led to me duplicating part of the code in an undesirable fashion.I believe this part
should be extracted to a separate method
semver_interval(v0::VersionNumber, vertyp::Symbol)
that can be called by others wanting to implement semantic versioning.