@@ -317,6 +317,109 @@ func LibraryPropertiesAuthorFieldLTMinLength() (result checkresult.Type, output
317
317
return checkresult .Pass , ""
318
318
}
319
319
320
+ // LibraryPropertiesMaintainerFieldMissing checks for missing library.properties "maintainer" field.
321
+ func LibraryPropertiesMaintainerFieldMissing () (result checkresult.Type , output string ) {
322
+ if checkdata .LibraryPropertiesLoadError () != nil {
323
+ return checkresult .NotRun , ""
324
+ }
325
+
326
+ if schema .RequiredPropertyMissing ("maintainer" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
327
+ return checkresult .Fail , ""
328
+ }
329
+ return checkresult .Pass , ""
330
+ }
331
+
332
+ // LibraryPropertiesMaintainerFieldLTMinLength checks if the library.properties "maintainer" value is less than the minimum length.
333
+ func LibraryPropertiesMaintainerFieldLTMinLength () (result checkresult.Type , output string ) {
334
+ if checkdata .LibraryPropertiesLoadError () != nil {
335
+ return checkresult .NotRun , ""
336
+ }
337
+
338
+ if ! checkdata .LibraryProperties ().ContainsKey ("maintainer" ) {
339
+ return checkresult .NotRun , ""
340
+ }
341
+
342
+ if schema .PropertyLessThanMinLength ("maintainer" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
343
+ return checkresult .Fail , ""
344
+ }
345
+
346
+ return checkresult .Pass , ""
347
+ }
348
+
349
+ // LibraryPropertiesMaintainerFieldStartsWithArduino checks if the library.properties "maintainer" value starts with "Arduino".
350
+ func LibraryPropertiesMaintainerFieldStartsWithArduino () (result checkresult.Type , output string ) {
351
+ if checkdata .LibraryPropertiesLoadError () != nil {
352
+ return checkresult .NotRun , ""
353
+ }
354
+
355
+ maintainer , ok := checkdata .LibraryProperties ().GetOk ("maintainer" )
356
+ if ! ok {
357
+ return checkresult .NotRun , ""
358
+ }
359
+
360
+ if schema .ValidationErrorMatch ("^#/maintainer$" , "/patternObjects/notStartsWithArduino" , "" , "" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
361
+ return checkresult .Fail , maintainer
362
+ }
363
+
364
+ return checkresult .Pass , ""
365
+ }
366
+
367
+ // LibraryPropertiesEmailFieldAsMaintainerAlias checks whether the library.properties "email" field is being used as an alias for the "maintainer" field.
368
+ func LibraryPropertiesEmailFieldAsMaintainerAlias () (result checkresult.Type , output string ) {
369
+ if checkdata .LibraryPropertiesLoadError () != nil {
370
+ return checkresult .NotRun , ""
371
+ }
372
+
373
+ if ! checkdata .LibraryProperties ().ContainsKey ("email" ) {
374
+ return checkresult .NotRun , ""
375
+ }
376
+
377
+ if ! checkdata .LibraryProperties ().ContainsKey ("maintainer" ) {
378
+ return checkresult .Fail , ""
379
+ }
380
+
381
+ return checkresult .Pass , ""
382
+ }
383
+
384
+ // LibraryPropertiesNameFieldLTMinLength checks if the library.properties "email" value is less than the minimum length.
385
+ func LibraryPropertiesEmailFieldLTMinLength () (result checkresult.Type , output string ) {
386
+ if checkdata .LibraryPropertiesLoadError () != nil {
387
+ return checkresult .NotRun , ""
388
+ }
389
+
390
+ if checkdata .LibraryProperties ().ContainsKey ("maintainer" ) || ! checkdata .LibraryProperties ().ContainsKey ("email" ) {
391
+ return checkresult .NotRun , ""
392
+ }
393
+
394
+ if schema .PropertyLessThanMinLength ("email" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
395
+ return checkresult .Fail , ""
396
+ }
397
+
398
+ return checkresult .Pass , ""
399
+ }
400
+
401
+ // LibraryPropertiesMaintainerFieldStartsWithArduino checks if the library.properties "email" value starts with "Arduino".
402
+ func LibraryPropertiesEmailFieldStartsWithArduino () (result checkresult.Type , output string ) {
403
+ if checkdata .LibraryPropertiesLoadError () != nil {
404
+ return checkresult .NotRun , ""
405
+ }
406
+
407
+ if checkdata .LibraryProperties ().ContainsKey ("maintainer" ) {
408
+ return checkresult .NotRun , ""
409
+ }
410
+
411
+ email , ok := checkdata .LibraryProperties ().GetOk ("email" )
412
+ if ! ok {
413
+ return checkresult .NotRun , ""
414
+ }
415
+
416
+ if schema .ValidationErrorMatch ("^#/email$" , "/patternObjects/notStartsWithArduino" , "" , "" , checkdata .LibraryPropertiesSchemaValidationResult ()[compliancelevel .Specification ], configuration .SchemasPath ()) {
417
+ return checkresult .Fail , email
418
+ }
419
+
420
+ return checkresult .Pass , ""
421
+ }
422
+
320
423
// LibraryPropertiesSentenceFieldMissing checks for missing library.properties "sentence" field.
321
424
func LibraryPropertiesSentenceFieldMissing () (result checkresult.Type , output string ) {
322
425
if checkdata .LibraryPropertiesLoadError () != nil {
0 commit comments