Improve code as per Sonar suggestions (#22224)

This commit is contained in:
Michael Telatynski 2022-05-16 16:47:12 +01:00 committed by GitHub
parent 0292f66365
commit ca98529bd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 465 additions and 331 deletions

View file

@ -106,11 +106,10 @@ export default class WebPlatform extends VectorBasePlatform {
}
getNormalizedAppVersion(version: string): string {
// if version looks like semver with leading v, strip it
// (matches scripts/normalize-version.sh)
const semVerRegex = new RegExp("^v[0-9]+.[0-9]+.[0-9]+(-.+)?$");
// if version looks like semver with leading v, strip it (matches scripts/normalize-version.sh)
const semVerRegex = /^v\d+.\d+.\d+(-.+)?$/;
if (semVerRegex.test(version)) {
return version.substr(1);
return version.substring(1);
}
return version;
}