code: function () {
        var doUniqueMemberIdsCheck = function (compound) {
          var duplicateMemberIds = [];
          compound.members.forEach(function (member) {
            var memberId = member.memberId;
  
            function filterByMemberId (member) {
              return member.memberId === memberId;
            }
  
            var arrayByMemberId = compound.members.filter(filterByMemberId);
            if (arrayByMemberId.length > 1 && duplicateMemberIds.indexOf(memberId) < 0) {
              duplicateMemberIds.push(memberId);
            }
          });
          duplicateMemberIds.forEach(function (memberId) {
            errors.push('RuleViolation identified: Artifact \'' + compound.artifactId +
              '\' contains multiple members with \'memberId\'=\'' + memberId + '\'');
          });
        };
        //
        if (doc.artifacts && doc.artifacts.compoundComponents) {
          doc.artifacts.compoundComponents.forEach(doUniqueMemberIdsCheck);
        }
      }
docs: Rule 4: Check compound member definitions to have unique memberId's.