1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ci: fix v test-cleancode

This commit is contained in:
Delyan Angelov
2021-01-25 11:26:20 +02:00
parent 94fd3ff431
commit 728344ff65
49 changed files with 353 additions and 356 deletions

View File

@@ -57,7 +57,7 @@ fn (c Comparator) satisfies(ver Version) bool {
}
fn parse_range(input string) ?Range {
raw_comparator_sets := input.split(comparator_set_sep)
raw_comparator_sets := input.split(semver.comparator_set_sep)
mut comparator_sets := []ComparatorSet{}
for raw_comp_set in raw_comparator_sets {
if can_expand(raw_comp_set) {
@@ -72,7 +72,7 @@ fn parse_range(input string) ?Range {
}
fn parse_comparator_set(input string) ?ComparatorSet {
raw_comparators := input.split(comparator_sep)
raw_comparators := input.split(semver.comparator_sep)
if raw_comparators.len > 2 {
return error('Invalid format of comparator set for input "$input"')
}
@@ -113,7 +113,7 @@ fn parse_comparator(input string) ?Comparator {
fn parse_xrange(input string) ?Version {
mut raw_ver := parse(input).complete()
for typ in versions {
if raw_ver.raw_ints[typ].index_any(x_range_symbols) == -1 {
if raw_ver.raw_ints[typ].index_any(semver.x_range_symbols) == -1 {
continue
}
match typ {
@@ -139,8 +139,8 @@ fn parse_xrange(input string) ?Version {
}
fn can_expand(input string) bool {
return input[0] == `~` || input[0] == `^` || input.contains(hyphen_range_sep)
|| input.index_any(x_range_symbols) > -1
return input[0] == `~` || input[0] == `^` || input.contains(semver.hyphen_range_sep)
|| input.index_any(semver.x_range_symbols) > -1
}
fn expand_comparator_set(input string) ?ComparatorSet {
@@ -149,7 +149,7 @@ fn expand_comparator_set(input string) ?ComparatorSet {
`^` { return expand_caret(input[1..]) }
else {}
}
if input.contains(hyphen_range_sep) {
if input.contains(semver.hyphen_range_sep) {
return expand_hyphen(input)
}
return expand_xrange(input)
@@ -178,7 +178,7 @@ fn expand_caret(raw_version string) ?ComparatorSet {
}
fn expand_hyphen(raw_range string) ?ComparatorSet {
raw_versions := raw_range.split(hyphen_range_sep)
raw_versions := raw_range.split(semver.hyphen_range_sep)
if raw_versions.len != 2 {
return none
}