Class: Chemicalml::Convention::Compchem::Constraints::JobModuleAtMostOneEnvironment

Inherits:
Chemicalml::Convention::Constraint::NodeConstraint show all
Includes:
ModulePredicates
Defined in:
lib/chemicalml/convention/compchem/constraints/job_module_at_most_one_environment.rb

Overview

A job module MUST contain at most one environment module.

Instance Method Summary collapse

Methods included from ModulePredicates

#calculation_module?, #child_modules_with, #cml_module?, #compchem_root?, #environment_module?, #finalization_module?, #initialization_module?, #job_list_module?, #job_module?

Methods inherited from Chemicalml::Convention::Constraint::NodeConstraint

#check

Instance Method Details

#check_node(node, path) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/chemicalml/convention/compchem/constraints/job_module_at_most_one_environment.rb', line 12

def check_node(node, path)

  environments = child_modules_with(node, 'compchem:environment')
  return [] if environments.length <= 1

  [violation(path: path.join('/'),
             message: 'job module must contain at most one environment ' \
                      "(found #{environments.length})")]
end