Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
# Rule attributes
@AssetType("data_intg_flow")
@AssetType("data_intg_subflow")
package datamigrators

@Documentation(“http://docs.ibm.com/cp4d/compliance/Job
does_not_contain_unit_test_parameter”)
@SomeAttribute(“Some value”)
@SomeOtherAttribute(“Some other value”)

# Rule tags (effectively user-defined, free-form attributes)
@Tag(“security, portability, maintainability, fail-ci, CorpDataWarehouse, CheeseSandwichTeam”)

# Rule definition
if (!(item.parameters.any { paramName, param -> paramName.contains("DM_ENABLE_UNIT_TESTING") })) {
    compliance.failure("MettleCI Unit Test job parameter has not been added to this job");
};<blah blah blah>

Attributes are used to add extra information to the Rule which are used by the various MettleCI tools (Workbench, CLI) to change their behaviour. The one attribute of interest to end users is @AssetType. This defines the type of DataStage asset to which the rule can be applied. All rules (whether those dveloped developed by customers or supplied by Data Migrators) require an @AssetType tag.

Info

If you add a @Tag attribute to a rule you must also add a package value to the top of your Compliance rule. This is required by the technology underlying Compliance, and has no other functional implications. A good practice for the package name is to use a unique identifier which identifies the group assuming ownership (and responsibility for maintenance) of the rule. All out-of-the-box rules have a package name of ‘Data Migrators’, for example.

Rule Tags

Each MettleCI Compliance rule can include extra metadata using a set of user-specified values which are referred to as ‘tags’. Each Compliance rule may specify zero or more ‘tags’ which are free-form text labels associated with each rule.

...