@@ -49,6 +49,59 @@ func LibraryPropertiesNameFieldMissing() (result checkresult.Type, output string
49
49
return checkresult .Pass , ""
50
50
}
51
51
52
+ // LibraryPropertiesNameFieldLTMinLength checks if the library.properties "name" value is less than the minimum length.
53
+ func LibraryPropertiesNameFieldLTMinLength () (result checkresult.Type , output string ) {
54
+ if checkdata .LibraryPropertiesLoadError () != nil {
55
+ return checkresult .NotRun , ""
56
+ }
57
+
58
+ if ! checkdata .LibraryProperties ().ContainsKey ("name" ) {
59
+ return checkresult .NotRun , ""
60
+ }
61
+
62
+ if schema .PropertyLessThanMinLength ("name" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
63
+ return checkresult .Fail , ""
64
+ }
65
+
66
+ return checkresult .Pass , ""
67
+ }
68
+
69
+ // LibraryPropertiesNameFieldGTMaxLength checks if the library.properties "name" value is greater than the maximum length.
70
+ func LibraryPropertiesNameFieldGTMaxLength () (result checkresult.Type , output string ) {
71
+ if checkdata .LibraryPropertiesLoadError () != nil {
72
+ return checkresult .NotRun , ""
73
+ }
74
+
75
+ name , ok := checkdata .LibraryProperties ().GetOk ("name" )
76
+ if ! ok {
77
+ return checkresult .NotRun , ""
78
+ }
79
+
80
+ if schema .PropertyGreaterThanMaxLength ("name" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
81
+ return checkresult .Fail , name
82
+ }
83
+
84
+ return checkresult .Pass , ""
85
+ }
86
+
87
+ // LibraryPropertiesNameFieldGTRecommendedLength checks if the library.properties "name" value is greater than the recommended length.
88
+ func LibraryPropertiesNameFieldGTRecommendedLength () (result checkresult.Type , output string ) {
89
+ if checkdata .LibraryPropertiesLoadError () != nil {
90
+ return checkresult .NotRun , checkdata .LibraryProperties ().Get ("name" )
91
+ }
92
+
93
+ name , ok := checkdata .LibraryProperties ().GetOk ("name" )
94
+ if ! ok {
95
+ return checkresult .NotRun , ""
96
+ }
97
+
98
+ if schema .PropertyGreaterThanMaxLength ("name" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Strict ], configuration .SchemasPath ()) {
99
+ return checkresult .Fail , name
100
+ }
101
+
102
+ return checkresult .Pass , ""
103
+ }
104
+
52
105
// LibraryPropertiesNameFieldDisallowedCharacters checks for disallowed characters in the library.properties "name" field.
53
106
func LibraryPropertiesNameFieldDisallowedCharacters () (result checkresult.Type , output string ) {
54
107
if checkdata .LibraryPropertiesLoadError () != nil {
@@ -62,6 +115,78 @@ func LibraryPropertiesNameFieldDisallowedCharacters() (result checkresult.Type,
62
115
return checkresult .Pass , ""
63
116
}
64
117
118
+ // LibraryPropertiesNameFieldHasSpaces checks if the library.properties "name" value contains spaces.
119
+ func LibraryPropertiesNameFieldHasSpaces () (result checkresult.Type , output string ) {
120
+ if checkdata .LibraryPropertiesLoadError () != nil {
121
+ return checkresult .NotRun , ""
122
+ }
123
+
124
+ name , ok := checkdata .LibraryProperties ().GetOk ("name" )
125
+ if ! ok {
126
+ return checkresult .NotRun , ""
127
+ }
128
+
129
+ if schema .ValidationErrorMatch ("^#/name$" , "/patternObjects/notContainsSpaces" , "" , "" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Strict ], configuration .SchemasPath ()) {
130
+ return checkresult .Fail , name
131
+ }
132
+
133
+ return checkresult .Pass , ""
134
+ }
135
+
136
+ // LibraryPropertiesNameFieldStartsWithArduino checks if the library.properties "name" value starts with "Arduino".
137
+ func LibraryPropertiesNameFieldStartsWithArduino () (result checkresult.Type , output string ) {
138
+ if checkdata .LibraryPropertiesLoadError () != nil {
139
+ return checkresult .NotRun , ""
140
+ }
141
+
142
+ name , ok := checkdata .LibraryProperties ().GetOk ("name" )
143
+ if ! ok {
144
+ return checkresult .NotRun , ""
145
+ }
146
+
147
+ if schema .ValidationErrorMatch ("^#/name$" , "/patternObjects/notStartsWithArduino" , "" , "" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
148
+ return checkresult .Fail , name
149
+ }
150
+
151
+ return checkresult .Pass , ""
152
+ }
153
+
154
+ // LibraryPropertiesNameFieldContainsArduino checks if the library.properties "name" value contains "Arduino".
155
+ func LibraryPropertiesNameFieldContainsArduino () (result checkresult.Type , output string ) {
156
+ if checkdata .LibraryPropertiesLoadError () != nil {
157
+ return checkresult .NotRun , ""
158
+ }
159
+
160
+ name , ok := checkdata .LibraryProperties ().GetOk ("name" )
161
+ if ! ok {
162
+ return checkresult .NotRun , ""
163
+ }
164
+
165
+ if schema .ValidationErrorMatch ("^#/name$" , "/patternObjects/notContainsArduino" , "" , "" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Strict ], configuration .SchemasPath ()) {
166
+ return checkresult .Fail , name
167
+ }
168
+
169
+ return checkresult .Pass , ""
170
+ }
171
+
172
+ // LibraryPropertiesNameFieldContainsLibrary checks if the library.properties "name" value contains "library".
173
+ func LibraryPropertiesNameFieldContainsLibrary () (result checkresult.Type , output string ) {
174
+ if checkdata .LibraryPropertiesLoadError () != nil {
175
+ return checkresult .NotRun , ""
176
+ }
177
+
178
+ name , ok := checkdata .LibraryProperties ().GetOk ("name" )
179
+ if ! ok {
180
+ return checkresult .NotRun , ""
181
+ }
182
+
183
+ if schema .ValidationErrorMatch ("^#/name$" , "/patternObjects/notContainsSuperfluousTerms" , "" , "" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Strict ], configuration .SchemasPath ()) {
184
+ return checkresult .Fail , name
185
+ }
186
+
187
+ return checkresult .Pass , ""
188
+ }
189
+
65
190
// LibraryPropertiesNameFieldDuplicate checks whether there is an existing entry in the Library Manager index using the the library.properties `name` value.
66
191
func LibraryPropertiesNameFieldDuplicate () (result checkresult.Type , output string ) {
67
192
if checkdata .LibraryPropertiesLoadError () != nil {
0 commit comments