Skip to content

Commit

Permalink
fix #261: validate all dependencies are defined
Browse files Browse the repository at this point in the history
  • Loading branch information
j-chmielewski authored and F1bonacc1 committed Oct 10, 2024
1 parent bc0a228 commit 6b724f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func Load(opts *LoaderOptions) (*types.Project, error) {
validateProcessConfig,
validateNoCircularDependencies,
validateShellConfig,
validateDependenciesExist,
validatePlatformCompatibility,
validateHealthDependencyHasHealthCheck,
validateDependencyIsEnabled,
Expand Down
12 changes: 12 additions & 0 deletions src/loader/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ func validatePlatformCompatibility(p *types.Project) error {
return nil
}

func validateDependenciesExist(p *types.Project) error {
for process, config := range p.Processes {
for dependency := range config.DependsOn {
_, exists := p.Processes[dependency]
if !exists {
return fmt.Errorf("dependency process '%s' in process '%s' is not defined", dependency, process)
}
}
}
return nil
}

func validateNoCircularDependencies(p *types.Project) error {
visited := make(map[string]bool, len(p.Processes))
stack := make(map[string]bool)
Expand Down

0 comments on commit 6b724f8

Please sign in to comment.