Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f830a43

Browse files
authored
Merge pull request #48 from arduino/per1234/dot_a_linkage-schema-checks
Add schema provided checks for library.properties dot_a_linkage field
2 parents 5f0c17c + f8ecb47 commit f830a43

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

‎check/checkconfigurations/checkconfigurations.go‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,21 @@ var configurations = []Type{
656656
ErrorModes: nil,
657657
CheckFunction: checkfunctions.LibraryPropertiesDependsFieldNotInIndex,
658658
},
659+
{
660+
ProjectType: projecttype.Library,
661+
Category: "library.properties",
662+
Subcategory: "dot_a_linkage field",
663+
ID: "",
664+
Brief: "invalid value",
665+
Description: "",
666+
MessageTemplate: "invalid dot_a_linkage field value {{.}} in library.properties. See https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format",
667+
DisableModes: nil,
668+
EnableModes: []checkmode.Type{checkmode.All},
669+
InfoModes: nil,
670+
WarningModes: []checkmode.Type{checkmode.Permissive},
671+
ErrorModes: []checkmode.Type{checkmode.Default},
672+
CheckFunction: checkfunctions.LibraryPropertiesDotALinkageFieldInvalid,
673+
},
659674
{
660675
ProjectType: projecttype.Sketch,
661676
Category: "structure",

‎check/checkfunctions/library.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,24 @@ func LibraryPropertiesDependsFieldNotInIndex() (result checkresult.Type, output
670670
return checkresult.Pass, ""
671671
}
672672

673+
// LibraryPropertiesDotALinkageFieldInvalid checks for invalid value in the library.properties "dot_a_linkage" field.
674+
func LibraryPropertiesDotALinkageFieldInvalid() (result checkresult.Type, output string) {
675+
if checkdata.LibraryPropertiesLoadError() != nil {
676+
return checkresult.NotRun, ""
677+
}
678+
679+
dotALinkage, ok := checkdata.LibraryProperties().GetOk("dot_a_linkage")
680+
if !ok {
681+
return checkresult.NotRun, ""
682+
}
683+
684+
if schema.PropertyEnumMismatch("dot_a_linkage", checkdata.LibraryPropertiesSchemaValidationResult()[compliancelevel.Specification], configuration.SchemasPath()) {
685+
return checkresult.Fail, dotALinkage
686+
}
687+
688+
return checkresult.Pass, ""
689+
}
690+
673691
// spellCheckLibraryPropertiesFieldValue returns the value of the provided library.properties field with commonly misspelled words corrected.
674692
func spellCheckLibraryPropertiesFieldValue(fieldName string) (result checkresult.Type, output string) {
675693
if checkdata.LibraryPropertiesLoadError() != nil {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /