MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / diffErrors

Function diffErrors

Source/componentdiff.go:423–466  ·  view source on GitHub ↗
(path string, errorsA[] ComponentDefinitionError, errorsB[] ComponentDefinitionError)

Source from the content-addressed store, hash-verified

421}
422
423func diffErrors(path string, errorsA[] ComponentDefinitionError, errorsB[] ComponentDefinitionError) ([]ComponentDiffElementAdd, []ComponentDiffElementRemove, []ComponentDiffAttributeChange, error) {
424 changes := make([]ComponentDiffAttributeChange, 0)
425 adds := make([]ComponentDiffElementAdd, 0)
426 removes := make([]ComponentDiffElementRemove, 0)
427
428 for _, errorA := range(errorsA) {
429 BHasErrorA := false
430 for _, errorB := range(errorsB) {
431 if errorA.Name == errorB.Name {
432 BHasErrorA = true
433 Echanges, err := diffError(path, errorA, errorB)
434 if (err != nil) {
435 return adds, removes, changes, err
436 }
437 changes = append(changes, Echanges...)
438 break;
439 }
440 }
441 if (!BHasErrorA) {
442 var remove ComponentDiffElementRemove
443 remove.Path = path
444 remove.Removal = errorA
445 removes = append(removes, remove)
446 }
447 }
448
449 for _, errorB := range(errorsB) {
450 AHasErrorB := false
451 for _, errorA := range(errorsA) {
452 if errorB.Name == errorA.Name {
453 AHasErrorB = true
454 break;
455 }
456 }
457 if (!AHasErrorB) {
458 var add ComponentDiffElementAdd
459 add.Path = path
460 add.Addition = errorB
461 adds = append(adds, add)
462 }
463 }
464
465 return adds, removes, changes, nil
466}
467
468
469func diffGlobal(path string, globalA ComponentDefinitionGlobal, globalB ComponentDefinitionGlobal) ([]ComponentDiffElementAdd, []ComponentDiffElementRemove, []ComponentDiffAttributeChange, error) {

Callers 1

DiffComponentDefinitionsFunction · 0.85

Calls 1

diffErrorFunction · 0.85

Tested by

no test coverage detected