Skip to content

Commit f05802f

Browse files
authored
Merge pull request #384 from per1234/full-depends-constraints-support
Support full constraint syntax of library.properties `depends` field
2 parents fb7be8a + 264f66a commit f05802f

File tree

18 files changed

+155
-41
lines changed

18 files changed

+155
-41
lines changed

.licenses/go/go.bug.st/relaxed-semver.dep.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: go.bug.st/relaxed-semver
3-
version: v0.0.0-20190922224835-391e10178d18
3+
version: v0.9.0
44
type: go
55
summary:
66
homepage: https://pkg.go.dev/go.bug.st/relaxed-semver
@@ -9,7 +9,7 @@ licenses:
99
- sources: LICENSE
1010
text: |2+
1111
12-
Copyright (c) 2018, Cristian Maglie.
12+
Copyright (c) 2018-2022, Cristian Maglie.
1313
All rights reserved.
1414
1515
Redistribution and use in source and binary forms, with or without

docsgen/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ require (
7676
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
7777
go.bug.st/cleanup v1.0.0 // indirect
7878
go.bug.st/downloader/v2 v2.1.0 // indirect
79-
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 // indirect
79+
go.bug.st/relaxed-semver v0.9.0 // indirect
8080
go.opentelemetry.io/contrib v0.20.0 // indirect
8181
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.20.0 // indirect
8282
go.opentelemetry.io/otel v0.20.0 // indirect

docsgen/go.sum

+2-1
Original file line numberDiff line numberDiff line change
@@ -1248,8 +1248,9 @@ go.bug.st/cleanup v1.0.0 h1:XVj1HZxkBXeq3gMT7ijWUpHyIC1j8XAoNSyQ06CskgA=
12481248
go.bug.st/cleanup v1.0.0/go.mod h1:EqVmTg2IBk4znLbPD28xne3abjsJftMdqqJEjhn70bk=
12491249
go.bug.st/downloader/v2 v2.1.0 h1:VqGOrJrjgz8c0c8ExvF9dvvcpcrbo2IrI+rOoXKD6nQ=
12501250
go.bug.st/downloader/v2 v2.1.0/go.mod h1:VZW2V1iGKV8rJL2ZEGIDzzBeKowYv34AedJz13RzVII=
1251-
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 h1:F1qxtaFuewctYc/SsHRn+Q7Dtwi+yJGPgVq8YLtQz98=
12521251
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18/go.mod h1:Cx1VqMtEhE9pIkEyUj3LVVVPkv89dgW8aCKrRPDR/uE=
1252+
go.bug.st/relaxed-semver v0.9.0 h1:qt0T8W70VCurvsbxRK25fQwiTOFjkzwC/fDOpyPnchQ=
1253+
go.bug.st/relaxed-semver v0.9.0/go.mod h1:ug0/W/RPYUjliE70Ghxg77RDHmPxqpo7SHV16ijss7Q=
12531254
go.bug.st/serial v1.1.1/go.mod h1:VmYBeyJWp5BnJ0tw2NUJHZdJTGl2ecBGABHlzRK1knY=
12541255
go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45/go.mod h1:dRSl/CVCTf56CkXgJMDOdSwNfo2g1orOGE/gBGdvjZw=
12551256
go.elastic.co/apm v1.8.0/go.mod h1:tCw6CkOJgkWnzEthFN9HUP1uL3Gjc/Ur6m7gRPLaoH0=

etc/schemas/arduino-library-properties-definitions-schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,8 @@
493493
"type": "string"
494494
},
495495
{
496-
"$comment": "Based on #/definitions/propertiesObjects/name/base/definitions/patternObjects/allowedCharacters and general-definitions-schema.json#/definitions/patternObjects/relaxedSemver",
497-
"pattern": "^((((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\( *(<|<=|=|>=|>)(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))?(\\.(0|[1-9]\\d*))?(-((0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))? *\\) *)?), *)*((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\( *(<|<=|=|>=|>)(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))?(\\.(0|[1-9]\\d*))?(-((0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))? *\\) *)?))?$"
496+
"$comment": "Based on #/definitions/propertiesObjects/name/base/definitions/patternObjects/allowedCharacters",
497+
"pattern": "^((((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\(.*\\) *)?), *)*((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\(.*\\) *)?))?$"
498498
}
499499
]
500500
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/stretchr/testify v1.7.1
2121
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb
2222
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
23-
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18
23+
go.bug.st/relaxed-semver v0.9.0
2424
)
2525

2626
require (

go.sum

+2-1
Original file line numberDiff line numberDiff line change
@@ -1278,8 +1278,9 @@ go.bug.st/cleanup v1.0.0 h1:XVj1HZxkBXeq3gMT7ijWUpHyIC1j8XAoNSyQ06CskgA=
12781278
go.bug.st/cleanup v1.0.0/go.mod h1:EqVmTg2IBk4znLbPD28xne3abjsJftMdqqJEjhn70bk=
12791279
go.bug.st/downloader/v2 v2.1.0 h1:VqGOrJrjgz8c0c8ExvF9dvvcpcrbo2IrI+rOoXKD6nQ=
12801280
go.bug.st/downloader/v2 v2.1.0/go.mod h1:VZW2V1iGKV8rJL2ZEGIDzzBeKowYv34AedJz13RzVII=
1281-
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 h1:F1qxtaFuewctYc/SsHRn+Q7Dtwi+yJGPgVq8YLtQz98=
12821281
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18/go.mod h1:Cx1VqMtEhE9pIkEyUj3LVVVPkv89dgW8aCKrRPDR/uE=
1282+
go.bug.st/relaxed-semver v0.9.0 h1:qt0T8W70VCurvsbxRK25fQwiTOFjkzwC/fDOpyPnchQ=
1283+
go.bug.st/relaxed-semver v0.9.0/go.mod h1:ug0/W/RPYUjliE70Ghxg77RDHmPxqpo7SHV16ijss7Q=
12831284
go.bug.st/serial v1.1.1/go.mod h1:VmYBeyJWp5BnJ0tw2NUJHZdJTGl2ecBGABHlzRK1knY=
12841285
go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45/go.mod h1:dRSl/CVCTf56CkXgJMDOdSwNfo2g1orOGE/gBGdvjZw=
12851286
go.elastic.co/apm v1.8.0/go.mod h1:tCw6CkOJgkWnzEthFN9HUP1uL3Gjc/Ur6m7gRPLaoH0=

internal/project/library/libraryproperties/librarypropertiesschemas_test.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -390,17 +390,21 @@ func TestPropertiesDependsPattern(t *testing.T) {
390390
{"Pre-release version", "foo (=1.2.3-rc1)", compliancelevel.Specification, assert.False},
391391
{"Pre-release version", "foo (=1.2.3-rc1)", compliancelevel.Strict, assert.False},
392392

393-
{"Invalid version", "foo (bar)", compliancelevel.Permissive, assert.True},
394-
{"Invalid version", "foo (bar)", compliancelevel.Specification, assert.True},
395-
{"Invalid version", "foo (bar)", compliancelevel.Strict, assert.True},
396-
397393
{"Version w/o space", "foo(>1.2.3)", compliancelevel.Permissive, assert.True},
398394
{"Version w/o space", "foo(>1.2.3)", compliancelevel.Specification, assert.True},
399395
{"Version w/o space", "foo(>1.2.3)", compliancelevel.Strict, assert.True},
400396

401397
{"Names w/ version", "foo (<=1.2.3),bar", compliancelevel.Permissive, assert.False},
402398
{"Names w/ version", "foo (<=1.2.3),bar", compliancelevel.Specification, assert.False},
403399
{"Names w/ version", "foo (<=1.2.3),bar", compliancelevel.Strict, assert.False},
400+
401+
{"Names w/ parenthesized version constraints", "foo ((>0.1.0 && <2.0.0) || >2.1.0),bar", compliancelevel.Permissive, assert.False},
402+
{"Names w/ parenthesized version constraints", "foo ((>0.1.0 && <2.0.0) || >2.1.0),bar", compliancelevel.Specification, assert.False},
403+
{"Names w/ parenthesized version constraints", "foo ((>0.1.0 && <2.0.0) || >2.1.0),bar", compliancelevel.Strict, assert.False},
404+
405+
{"Names w/ empty version constraint", "foo (),bar", compliancelevel.Permissive, assert.False},
406+
{"Names w/ empty version constraint", "foo (),bar", compliancelevel.Specification, assert.False},
407+
{"Names w/ empty version constraint", "foo (),bar", compliancelevel.Strict, assert.False},
404408
}
405409

406410
checkPropertyPatternMismatch("depends", testTables, t)

internal/rule/ruleconfiguration/ruleconfiguration.go

+17
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,23 @@ var configurations = []Type{
11131113
ErrorModes: nil,
11141114
RuleFunction: rulefunction.LibraryPropertiesDependsFieldNotInIndex,
11151115
},
1116+
{
1117+
ProjectType: projecttype.Library,
1118+
SuperprojectType: projecttype.All,
1119+
Category: "library.properties",
1120+
Subcategory: "depends field",
1121+
ID: "LP058",
1122+
Brief: "invalid depends constraint syntax",
1123+
Description: "The `depends` field in the library's `library.properties` metadata file uses invalid version constraint syntax.",
1124+
MessageTemplate: "library.properties depends field item(s) {{.}} have invalid constraint syntax.",
1125+
Reference: "https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format",
1126+
DisableModes: nil,
1127+
EnableModes: []rulemode.Type{rulemode.Default},
1128+
InfoModes: nil,
1129+
WarningModes: nil,
1130+
ErrorModes: []rulemode.Type{rulemode.Default},
1131+
RuleFunction: rulefunction.LibraryPropertiesDependsFieldConstraintInvalid,
1132+
},
11161133
{
11171134
ProjectType: projecttype.Library,
11181135
SuperprojectType: projecttype.All,

internal/rule/rulefunction/library.go

+78-24
Original file line numberDiff line numberDiff line change
@@ -1201,37 +1201,21 @@ func LibraryPropertiesDependsFieldNotInIndex() (result ruleresult.Type, output s
12011201
return ruleresult.Skip, "Field not present"
12021202
}
12031203

1204-
dependsList := commaSeparatedToList(depends)
1204+
dependencies := libDependencies(depends)
12051205

1206-
var dependencyRegexp = regexp.MustCompile("^([^()]+?) *(?:\\((.+)\\))?$")
12071206
dependsNotInIndex := []string{}
1208-
for _, depend := range dependsList {
1209-
// Process raw depend string into a dependency object
1210-
if depend == "" {
1211-
// This is the responsibility of LibraryPropertiesDependsFieldInvalidFormat()
1212-
continue
1213-
}
1214-
dependencyData := dependencyRegexp.FindAllStringSubmatch(depend, -1)
1215-
if dependencyData == nil {
1216-
// This is the responsibility of LibraryPropertiesDependsFieldInvalidFormat()
1217-
continue
1218-
}
1219-
dependencyConstraint, err := semver.ParseConstraint(dependencyData[0][2])
1220-
if err != nil {
1207+
for _, dependency := range dependencies {
1208+
if dependency.parseConstraintErr != nil {
12211209
// This is the responsibility of LibraryPropertiesDependsFieldInvalidFormat()
12221210
continue
12231211
}
1224-
var dependency semver.Dependency = &librariesindex.Dependency{
1225-
Name: dependencyData[0][1],
1226-
VersionConstraint: dependencyConstraint,
1227-
}
12281212

1229-
logrus.Tracef("Checking if dependency %s is in index.", depend)
1213+
logrus.Tracef("Checking if dependency %s is in index.", dependency.depend)
12301214
// Get all releases of the dependency
1231-
library := projectdata.LibraryManagerIndex().Index.FindIndexedLibrary(&libraries.Library{Name: dependency.GetName()})
1215+
library := projectdata.LibraryManagerIndex().Index.FindIndexedLibrary(&libraries.Library{Name: dependency.data.GetName()})
12321216
if library == nil {
12331217
logrus.Tracef("Dependency is not in the index.")
1234-
dependsNotInIndex = append(dependsNotInIndex, depend)
1218+
dependsNotInIndex = append(dependsNotInIndex, dependency.depend)
12351219
continue
12361220
}
12371221
// Convert the dependency's libraries.Library object to a semver.Releases object
@@ -1240,10 +1224,10 @@ func LibraryPropertiesDependsFieldNotInIndex() (result ruleresult.Type, output s
12401224
releases = append(releases, release)
12411225
}
12421226
// Filter the dependency's releases according to the dependency's constraint
1243-
dependencyReleases := releases.FilterBy(dependency)
1227+
dependencyReleases := releases.FilterBy(&dependency.data)
12441228
if len(dependencyReleases) == 0 {
12451229
logrus.Tracef("No releases match dependency's constraint.")
1246-
dependsNotInIndex = append(dependsNotInIndex, depend)
1230+
dependsNotInIndex = append(dependsNotInIndex, dependency.depend)
12471231
continue
12481232
}
12491233
}
@@ -1255,6 +1239,34 @@ func LibraryPropertiesDependsFieldNotInIndex() (result ruleresult.Type, output s
12551239
return ruleresult.Pass, ""
12561240
}
12571241

1242+
// LibraryPropertiesDependsFieldConstraintInvalid checks whether the syntax of the version constraints in the
1243+
// library.properties `depends` field is valid.
1244+
func LibraryPropertiesDependsFieldConstraintInvalid() (result ruleresult.Type, output string) {
1245+
if projectdata.LibraryPropertiesLoadError() != nil {
1246+
return ruleresult.NotRun, "Couldn't load library.properties"
1247+
}
1248+
1249+
depends, hasDepends := projectdata.LibraryProperties().GetOk("depends")
1250+
if !hasDepends {
1251+
return ruleresult.Skip, "Field not present"
1252+
}
1253+
1254+
dependencies := libDependencies(depends)
1255+
1256+
nonCompliant := []string{}
1257+
for _, dependency := range dependencies {
1258+
if dependency.parseConstraintErr != nil {
1259+
nonCompliant = append(nonCompliant, dependency.depend)
1260+
}
1261+
}
1262+
1263+
if len(nonCompliant) > 0 {
1264+
return ruleresult.Fail, strings.Join(nonCompliant, ", ")
1265+
}
1266+
1267+
return ruleresult.Pass, ""
1268+
}
1269+
12581270
// LibraryPropertiesDotALinkageFieldInvalid checks for invalid value in the library.properties "dot_a_linkage" field.
12591271
func LibraryPropertiesDotALinkageFieldInvalid() (result ruleresult.Type, output string) {
12601272
if projectdata.LibraryPropertiesLoadError() != nil {
@@ -1552,3 +1564,45 @@ func commaSeparatedToList(commaSeparated string) []string {
15521564

15531565
return list
15541566
}
1567+
1568+
// libDependency is a library dependency
1569+
type libDependency struct {
1570+
depend string // Raw element from depends field.
1571+
data librariesindex.Dependency // Dependency object.
1572+
parseConstraintErr error // Error produced by parsing the version constraint.
1573+
}
1574+
1575+
var dependRegexp = regexp.MustCompile("^([^()]+?) *(?:\\((.*)\\))?$")
1576+
1577+
// libDependencies parses the library.properties `depends` field contents and returns an array of libDependency objects
1578+
func libDependencies(depends string) []libDependency {
1579+
dependList := commaSeparatedToList(depends)
1580+
1581+
dependencies := []libDependency{}
1582+
for _, depend := range dependList {
1583+
// Process raw depend string into a dependency object
1584+
if depend == "" {
1585+
// This function is only concerned with the parseable depend elements.
1586+
// `depends` field data format is checked separately.
1587+
continue
1588+
}
1589+
dependencyData := dependRegexp.FindAllStringSubmatch(depend, -1)
1590+
if dependencyData == nil {
1591+
// This function is only concerned with the parseable depend elements.
1592+
// `depends` field data format is checked separately.
1593+
continue
1594+
}
1595+
dependencyConstraint, err := semver.ParseConstraint(dependencyData[0][2])
1596+
dependencies = append(dependencies, libDependency{
1597+
depend: depend,
1598+
data: librariesindex.Dependency{
1599+
Name: dependencyData[0][1],
1600+
VersionConstraint: dependencyConstraint,
1601+
},
1602+
parseConstraintErr: err,
1603+
},
1604+
)
1605+
}
1606+
1607+
return dependencies
1608+
}

internal/rule/rulefunction/library_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,20 @@ func TestLibraryPropertiesDependsFieldNotInIndex(t *testing.T) {
846846
checkLibraryRuleFunction(LibraryPropertiesDependsFieldNotInIndex, testTables, t)
847847
}
848848

849+
func TestLibraryPropertiesDependsFieldConstraintInvalid(t *testing.T) {
850+
testTables := []libraryRuleFunctionTestTable{
851+
{"Unable to load", "InvalidLibraryProperties", ruleresult.NotRun, ""},
852+
{"Legacy", "Legacy", ruleresult.Skip, ""},
853+
{"No depends field", "NoDepends", ruleresult.Skip, ""},
854+
{"Depends field empty", "DependsEmpty", ruleresult.Pass, ""},
855+
{"Invalid depends field format", "DependsHasBadChars", ruleresult.Pass, ""},
856+
{"Invalid constraint syntax", "DependsConstraintInvalid", ruleresult.Fail, "^BarLib \\(nope\\), QuxLib \\(huh\\)$"},
857+
{"Valid constraint syntax", "DependsConstraintValid", ruleresult.Pass, ""},
858+
}
859+
860+
checkLibraryRuleFunction(LibraryPropertiesDependsFieldConstraintInvalid, testTables, t)
861+
}
862+
849863
func TestLibraryPropertiesDotALinkageFieldInvalid(t *testing.T) {
850864
testTables := []libraryRuleFunctionTestTable{
851865
{"Invalid", "InvalidLibraryProperties", ruleresult.NotRun, ""},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name=DependsConstraintInvalid
2+
version=1.0.0
3+
author=Cristian Maglie <c.maglie@example.com>, Pippo Pluto <pippo@example.com>
4+
maintainer=Cristian Maglie <c.maglie@example.com>
5+
sentence=A library that makes coding a web server a breeze.
6+
paragraph=Supports HTTP1.1 and you can do GET and POST.
7+
category=Communication
8+
url=http://example.com/
9+
architectures=avr
10+
depends=FooLib (=0.0.1),BarLib (nope),BazLib (=1.2.3),QuxLib (huh)
11+
includes=DependsConstraintInvalid.h

internal/rule/rulefunction/testdata/libraries/DependsConstraintInvalid/src/DependsConstraintInvalid.h

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name=DependsConstraintValid
2+
version=1.0.0
3+
author=Cristian Maglie <c.maglie@example.com>, Pippo Pluto <pippo@example.com>
4+
maintainer=Cristian Maglie <c.maglie@example.com>
5+
sentence=A library that makes coding a web server a breeze.
6+
paragraph=Supports HTTP1.1 and you can do GET and POST.
7+
category=Communication
8+
url=http://example.com/
9+
architectures=avr
10+
depends=LibA (=0.0.1),LibB (>1.0.0),LibC (>=1.0.0),LibD (<2.0.0),LibE (<=2.0.0),LibF (!=1.0.0),LibG (<1.0.0 || >2.0.0),LibH ((>0.1.0 && <2.0.0) || >2.1.0),LibI (),LibJ
11+
includes=DependsConstraintValid.h

internal/rule/rulefunction/testdata/libraries/DependsConstraintValid/src/DependsConstraintValid.h

Whitespace-only changes.

internal/rule/rulefunction/testdata/libraries/DependsIndexed/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=Supports HTTP1.1 and you can do GET and POST.
77
category=Communication
88
url=http://example.com/
99
architectures=avr
10-
depends=,(foo),foo (bar),Adafruit NeoPixel,Servo (<1.1.4),Stepper (<=1.1.3),Mouse (=1.0.0),Keyboard (>=1.0.1),WiFiNINA (>1.0.0)
10+
depends=,(foo),foo (bar),Adafruit NeoPixel,Servo (<1.1.4),Stepper (<=1.1.3),Mouse (=1.0.0),Keyboard (>=1.0.1),WiFiNINA (>1.0.0),Ethernet ()

internal/rule/schema/schemadata/bindata.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1911,8 +1911,8 @@ var _arduinoLibraryPropertiesDefinitionsSchemaJson = []byte(`{
19111911
"type": "string"
19121912
},
19131913
{
1914-
"$comment": "Based on #/definitions/propertiesObjects/name/base/definitions/patternObjects/allowedCharacters and general-definitions-schema.json#/definitions/patternObjects/relaxedSemver",
1915-
"pattern": "^((((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\( *(<|<=|=|>=|>)(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))?(\\.(0|[1-9]\\d*))?(-((0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))? *\\) *)?), *)*((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\( *(<|<=|=|>=|>)(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))?(\\.(0|[1-9]\\d*))?(-((0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))? *\\) *)?))?$"
1914+
"$comment": "Based on #/definitions/propertiesObjects/name/base/definitions/patternObjects/allowedCharacters",
1915+
"pattern": "^((((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\(.*\\) *)?), *)*((([a-zA-Z][a-zA-Z0-9 _.\\-]*)|([0-9][a-zA-Z0-9 _.\\-]*[a-zA-Z][a-zA-Z0-9 _.\\-]*))+( \\(.*\\) *)?))?$"
19161916
}
19171917
]
19181918
}

ruledocsgen/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ require (
7272
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
7373
go.bug.st/cleanup v1.0.0 // indirect
7474
go.bug.st/downloader/v2 v2.1.0 // indirect
75-
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 // indirect
75+
go.bug.st/relaxed-semver v0.9.0 // indirect
7676
go.opentelemetry.io/contrib v0.20.0 // indirect
7777
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.20.0 // indirect
7878
go.opentelemetry.io/otel v0.20.0 // indirect

ruledocsgen/go.sum

+2-1
Original file line numberDiff line numberDiff line change
@@ -1252,8 +1252,9 @@ go.bug.st/cleanup v1.0.0 h1:XVj1HZxkBXeq3gMT7ijWUpHyIC1j8XAoNSyQ06CskgA=
12521252
go.bug.st/cleanup v1.0.0/go.mod h1:EqVmTg2IBk4znLbPD28xne3abjsJftMdqqJEjhn70bk=
12531253
go.bug.st/downloader/v2 v2.1.0 h1:VqGOrJrjgz8c0c8ExvF9dvvcpcrbo2IrI+rOoXKD6nQ=
12541254
go.bug.st/downloader/v2 v2.1.0/go.mod h1:VZW2V1iGKV8rJL2ZEGIDzzBeKowYv34AedJz13RzVII=
1255-
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 h1:F1qxtaFuewctYc/SsHRn+Q7Dtwi+yJGPgVq8YLtQz98=
12561255
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18/go.mod h1:Cx1VqMtEhE9pIkEyUj3LVVVPkv89dgW8aCKrRPDR/uE=
1256+
go.bug.st/relaxed-semver v0.9.0 h1:qt0T8W70VCurvsbxRK25fQwiTOFjkzwC/fDOpyPnchQ=
1257+
go.bug.st/relaxed-semver v0.9.0/go.mod h1:ug0/W/RPYUjliE70Ghxg77RDHmPxqpo7SHV16ijss7Q=
12571258
go.bug.st/serial v1.1.1/go.mod h1:VmYBeyJWp5BnJ0tw2NUJHZdJTGl2ecBGABHlzRK1knY=
12581259
go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45/go.mod h1:dRSl/CVCTf56CkXgJMDOdSwNfo2g1orOGE/gBGdvjZw=
12591260
go.elastic.co/apm v1.8.0/go.mod h1:tCw6CkOJgkWnzEthFN9HUP1uL3Gjc/Ur6m7gRPLaoH0=

0 commit comments

Comments
 (0)