Skip to content

Commit

Permalink
Make logic a one liner
Browse files Browse the repository at this point in the history
  • Loading branch information
mcantelon committed Jun 26, 2024
1 parent 333a5eb commit bf3aac0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
18 changes: 9 additions & 9 deletions internal/activities/add_premis_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ func (md *AddPREMISObjectsActivity) Execute(
return nil, err

Check warning on line 41 in internal/activities/add_premis_objects.go

View check run for this annotation

Codecov / codecov/patch

internal/activities/add_premis_objects.go#L41

Added line #L41 was not covered by tests
}

for _, subpath := range subpaths {
doc, err := premis.ParseOrInitialize(params.PREMISFilePath)
if err != nil {
return nil, err
}
doc, err := premis.ParseOrInitialize(params.PREMISFilePath)
if err != nil {
return nil, err

Check warning on line 46 in internal/activities/add_premis_objects.go

View check run for this annotation

Codecov / codecov/patch

internal/activities/add_premis_objects.go#L46

Added line #L46 was not covered by tests
}

for _, subpath := range subpaths {
object := premis.Object{
IdType: "UUID",
IdValue: uuid.New().String(),
Expand All @@ -57,11 +57,11 @@ func (md *AddPREMISObjectsActivity) Execute(
if err != nil {
return nil, err

Check warning on line 58 in internal/activities/add_premis_objects.go

View check run for this annotation

Codecov / codecov/patch

internal/activities/add_premis_objects.go#L58

Added line #L58 was not covered by tests
}
}

err = doc.WriteToFile(params.PREMISFilePath)
if err != nil {
return nil, err
}
err = doc.WriteToFile(params.PREMISFilePath)
if err != nil {
return nil, err

Check warning on line 64 in internal/activities/add_premis_objects.go

View check run for this annotation

Codecov / codecov/patch

internal/activities/add_premis_objects.go#L64

Added line #L64 was not covered by tests
}

return &AddPREMISObjectsResult{}, nil
Expand Down
5 changes: 1 addition & 4 deletions internal/activities/validate_file_formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ func (a *ValidateFileFormats) Execute(
detail = fmt.Sprintf("file format %q not allowed: %q", ff.ID, p)
outcome = "invalid"

failures = append(
failures,
detail,
)
failures = append(failures, detail)
}

// Define PREMIS event.
Expand Down

0 comments on commit bf3aac0

Please sign in to comment.