MCPcopy Create free account
hub / github.com/exercism/cli / metadataMatchesExercise

Method metadataMatchesExercise

cmd/submit.go:432–447  ·  view source on GitHub ↗

metadataMatchesExercise checks that the metadata refers to the exercise being submitted.

(metadata *workspace.ExerciseMetadata, exercise workspace.Exercise)

Source from the content-addressed store, hash-verified

430
431// metadataMatchesExercise checks that the metadata refers to the exercise being submitted.
432func (s submitValidator) metadataMatchesExercise(metadata *workspace.ExerciseMetadata, exercise workspace.Exercise) error {
433 if metadata.ExerciseSlug != exercise.Slug {
434 // TODO: error msg should suggest running future doctor command
435 msg := `
436
437 The exercise directory does not match exercise slug in metadata:
438
439 expected '%[1]s' but got '%[2]s'
440
441 Please rename the directory '%[1]s' to '%[2]s' and try again.
442
443 `
444 return fmt.Errorf(msg, exercise.Slug, metadata.ExerciseSlug)
445 }
446 return nil
447}
448
449// isRequestor checks that the submission requestor is listed as the author in the metadata.
450func (s submitValidator) isRequestor(metadata *workspace.ExerciseMetadata) error {

Callers 1

runSubmitFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected