This method is called when all the policy rule attributes are checked
All along the comparisons, the failing attributes slugs are stored
If the rejected attributes array is not empty, it means that the rule is not enforced
181383
public function getResult(): array
    {
        $result =
            (count($this->rejectedAttributes) > 0)
            ? $this->rejectedAttributes
            : []
        ;
        $this->rejectedAttributes = [];
        return $result;
    }
1217562
public function isRulesUpdated()
        {
                if ($this->getCurrentFileHash(self::FILENAME_RULES) ==
                        $this->getLocalFileHash(self::FILENAME_RULES)) {
                        return true;
                } else {
                        return false;
                }
        }
22486
def _get_final_none_policy_for_validator(is_nonable,   # type: bool
                                         none_policy   # type: NoneArgPolicy
                                         ):
    
    if none_policy in {NonePolicy.VALIDATE, NonePolicy.SKIP, NonePolicy.FAIL}:
        none_policy_to_use = none_policy

    elif none_policy is NoneArgPolicy.SKIP_IF_NONABLE_ELSE_VALIDATE:
        none_policy_to_use = NonePolicy.SKIP if is_nonable else NonePolicy.VALIDATE

    elif none_policy is NoneArgPolicy.SKIP_IF_NONABLE_ELSE_FAIL:
        none_policy_to_use = NonePolicy.SKIP if is_nonable else NonePolicy.FAIL

    else:
        raise ValueError('Invalid none policy: ' + str(none_policy))
    return none_policy_to_use
567132
def rules(cls, attr=None):
        
        try:
            if attr is None:
                attr = cls._rules_attr()
            return getattr(cls, attr).keys()
        except TypeError:
            return ()
176677
public static void checkEventCriteria(final AttributeImpl attribute) throws DevFailed {
        // Check if value is not numerical (always true for State and String)
        if (attribute.isState() || attribute.isString()) {
            return;
        }
        // Else check criteria
        final EventProperties props = attribute.getProperties().getEventProp();
        if (props.arch_event.period.equals(Constants.NOT_SPECIFIED)
                && props.arch_event.abs_change.equals(Constants.NOT_SPECIFIED)
                && props.arch_event.rel_change.equals(Constants.NOT_SPECIFIED)) {
            throw DevFailedUtils.newDevFailed(ExceptionMessages.EVENT_CRITERIA_NOT_SET,
                    "Archive event properties (archive_abs_change or "
                            + "archive_rel_change or archive_period) for attribute " + attribute.getName()
                            + " are not set");
        }
    }
590034
def validate_empty_attributes(fully_qualified_name: str, spec: Dict[str, Any],
                              *attributes: str) -> List[EmptyAttributeError]:
    
    return [
        EmptyAttributeError(fully_qualified_name, spec, attribute)
        for attribute in attributes
        if not spec.get(attribute, None)
    ]
437231
def rule(ctxt, name):
    

    # If the result of evaluation is in the rule cache, bypass
    # evaluation
    if name in ctxt.rule_cache:
        ctxt.stack.append(ctxt.rule_cache[name])
        return

    # Obtain the rule we're to evaluate
    try:
        rule = ctxt.policy[name]
    except KeyError:
        # Rule doesn't exist; log a message and assume False
        log = logging.getLogger('policies')
        log.warn("Request to evaluate non-existant rule %r "
                 "while evaluating rule %r" % (name, ctxt.name))
        ctxt.stack.append(False)
        ctxt.rule_cache[name] = False
        return

    # Evaluate the rule, stopping at the set_authz instruction
    with ctxt.push_rule(name):
        rule.instructions(ctxt, True)

    # Cache the result
    ctxt.rule_cache[name] = ctxt.stack[-1]
936942
function() {
    // Check for unknown attributes
    var key, unknownAttrs = []
    for (key in obj) {
      if (!self.validators.hasOwnProperty(key))
        unknownAttrs.push(key)
    }
    if (unknownAttrs.length)
      self._merge(validationErrors, 'unknown attributes [' + unknownAttrs.join(', ') + ']', prefix)
      //validationErrors[prefix || '.'] = 'unknown attributes [' + unknownAttrs.join(', ') + ']'

    // Run the `after` hook only if there is no validation error.
    if (isValid && self.after) {
      try {
        self.after.call(obj)
      } catch (err) {
        if(!_handleError(err)) return done(err)
      }
    }
    done(null, validationErrors)
  }
137162
public synchronized void removeAttributePolling(final AttributeImpl attr) throws DevFailed {
        if (attributeCacheMap.containsKey(attr)) {
            final AttributeCache cache = attributeCacheMap.get(attr);
            cache.stopRefresh();
            attributeCacheMap.remove(attr);
        } else if (extTrigAttributeCacheMap.containsKey(attr)) {
            extTrigAttributeCacheMap.remove(attr);
        } else if (attr.getName().equalsIgnoreCase(DeviceImpl.STATE_NAME) && stateCache != null) {
            stateCache.stopRefresh();
            stateCache = null;
        } else if (attr.getName().equalsIgnoreCase(DeviceImpl.STATUS_NAME) && statusCache != null) {
            statusCache.stopRefresh();
            statusCache = null;
        }
    }
212397
private void validateDeleteAllowed(Attribute attr) {
    String attrIdentifier = attr.getIdentifier();
    if (systemEntityTypeRegistry.hasSystemAttribute(attrIdentifier)) {
      throw new SystemMetadataModificationException();
    }
  }
1271148
function checkByAll ( rules, value, fieldMeta ) {
        return (rules || [])
            .map(function ( rule ) { 
                return checkByRule( rule, value, fieldMeta );
            })
            .filter(function ( el ) { return null !== el; });
    }
781291
def matches(filter, message, valid_paths, rule_cache, config):
    

    if not filter['rules']:
        return False

    for rule in filter['rules']:
        fn = rule['fn']
        negated = rule['negated']
        arguments = rule['arguments']
        rule_cache_key = rule['cache_key']

        try:
            if rule_cache_key not in rule_cache:
                value = fn(config, message, **arguments)
                if negated:
                    value = not value
                rule_cache[rule_cache_key] =  value

            if not rule_cache[rule_cache_key]:
                return False
        except Exception as e:
            log.exception(e)
            # If something throws an exception then we do *not* have a match.
            return False

    # Then all rules matched on this filter..
    return True
344479
boolean removeFilteredPolicy(String sec, String ptype, int fieldIndex, String... fieldValues) {
        boolean ruleRemoved = model.removeFilteredPolicy(sec, ptype, fieldIndex, fieldValues);
        if (!ruleRemoved) {
            return false;
        }

        if (adapter != null && autoSave) {
            try {
                adapter.removeFilteredPolicy(sec, ptype, fieldIndex, fieldValues);
            } catch (Error e) {
                if (!e.getMessage().equals("not implemented")) {
                    throw e;
                }
            }

            if (watcher != null) {
                // error intentionally ignored
                watcher.update();
            }
        }

        return true;
    }
230952
public void clearPolicy() {
        if (model.containsKey("p")) {
            for (Assertion ast : model.get("p").values()) {
                ast.policy = new ArrayList<>();
            }
        }

        if (model.containsKey("g")) {
            for (Assertion ast : model.get("g").values()) {
                ast.policy = new ArrayList<>();
            }
        }
    }
1212948
public boolean hasPolicy(String sec, String ptype, List<String> rule) {
        for (List<String> r : model.get(sec).get(ptype).policy) {
            if (Util.arrayEquals(rule, r)) {
                return true;
            }
        }

        return false;
    }
952763
protected function checkColumnsValidity(): void
    {
        $this->getAttribute('columns')->map(function (TableListColumn $column) {
            $this->checkSortableColumnHasAttribute($column);
            $isSearchable = in_array(
                $column->getAttribute('attribute'),
                $this->getAttribute('searchableColumns')->pluck('attribute')->toArray()
            );
            if ($isSearchable) {
                $this->checkSearchableColumnHasAttribute($column);
                $this->checkSearchedAttributeDoesExistInRelatedTable($column);
            }
        });
    }
176819
private static VisitorAttributes checkAttributes(VirtualFileFilter filter, VisitorAttributes attributes) {
        if (filter == null) {
            throw MESSAGES.nullArgument("filter");
        }
        // Specified
        if (attributes != null) { return attributes; }
        // From the filter
        if (filter instanceof VirtualFileFilterWithAttributes) { return ((VirtualFileFilterWithAttributes) filter).getAttributes(); }
        // It will use the default
        return null;
    }