Checks if a node respect a rule.
487012
public function check(RuleInterface $rule, NodeInterface $node): ?ViolationInterface
    {
        if (!$this->match($rule, $node)) {
            return null;
        }

        switch ($rule->getType()) {
            case RuleInterface::TYPE_FORBIDDEN:
            case RuleInterface::TYPE_DISCOURAGED:
                $violation = $this->checkForbiddenOrDiscouragedRule($rule, $node);
                break;
            case RuleInterface::TYPE_ONLY:
                $violation = $this->checkOnlyRule($rule, $node);
                break;
            default:
                throw new \RuntimeException(sprintf('Unknown rule type "%s".', $rule->getType()));
        }

        return $violation;
    }
903775
private function shouldCheckOption($node): Bool
    {
        if (!$node instanceof Node) {
            return true;
        }
        if ($node->kind === \ast\AST_CONST) {
            return true;
        }
        if ($node->kind === \ast\AST_BINARY_OP && $node->flags === \ast\flags\BINARY_BITWISE_OR) {
            return true;
        }

        return false;
    }
513733
function check(node) {
    var initial = start(node).offset
    var final = end(node).offset

    if (generated(node)) {
      return null
    }

    return node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final))
      ? 'fenced'
      : 'indented'
  }
630878
function validateNode(node) {
            const parens = getParenTokens(node);

            if (parens) {
                validateParens(parens, astUtils.isFunction(node) ? node.params : node.arguments);

                if (multilineArgumentsOption) {
                    validateArguments(parens, astUtils.isFunction(node) ? node.params : node.arguments);
                }
            }
        }
382950
function verify(node) {
	switch (node.type) {
		case esprima.Syntax.FunctionDeclaration:
			if (node.leadingComments && node.leadingComments.length === 1) {
				analyzeFunction(node);
			}
			break;
		default:
			break;
	}
}
303299
function checkAtruler(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  if (l = checkAtkeyword(i)) i += l;
  else return 0;

  if (l = checkTsets(i)) i += l;

  if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;
  else return 0;

  if (l = checkAtrulers(i)) i += l;

  if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++;
  else return 0;

  return i - start;
}
525907
function checkFeatureChildNode(node, restrictedPatterns, errors) {
  checkNameAndDescription(node, restrictedPatterns, errors);
  node.steps.forEach(function(step) {
    // Use the node type of the parent to determine which rule configuration to use
    checkStepNode(step, restrictedPatterns[node.type], errors);
  });
}
1369527
function checkIfNodeCanBeChildOfStyle( def, currentNode, lastNode, nodeName, dtd, nodeIsNoStyle, nodeIsReadonly, includeReadonly ) {
		// Style can be applied to text node.
		if ( !nodeName )
			return 1;

		// Style definitely cannot be applied if DTD or data-nostyle do not allow.
		if ( !dtd[ nodeName ] || nodeIsNoStyle  )
			return 0;

		// Non-editable element cannot be styled is we shouldn't include readonly elements.
		if ( nodeIsReadonly && !includeReadonly  )
			return 0;

		// Check that we haven't passed lastNode yet and that style's childRule allows this style on current element.
		return checkPositionAndRule( currentNode, lastNode, def, posPrecedingIdenticalContained );
	}
578898
function _rule_check($rule, $str) {
        if (($rule['flag'] & PSCWS4_ZRULE_INCLUDE) && !$this->_rule_checkbit($str, $rule['bit']))
            return false;
        if (($rule['flag'] & PSCWS4_ZRULE_EXCLUDE) && $this->_rule_checkbit($str, $rule['bit']))
            return false;
        return true;
    }
871516
public boolean hasRuleBlock(String name) {
        for (RuleBlock ruleBlock : this.ruleBlocks) {
            if (ruleBlock.getName().equals(name)) {
                return true;
            }
        }
        return false;
    }
1285795
function checkNode(node, clone)
			{
				if (node != null)
				{
					if (clone.originalNode != node)
					{
						cleanNode(node);
					}
					else
					{
						node = node.firstChild;
						clone = clone.firstChild;
						
						while (node != null)
						{
							var nextNode = node.nextSibling;
							
							if (clone == null)
							{
								cleanNode(node);
							}
							else
							{
								checkNode(node, clone);
								clone = clone.nextSibling;
							}
	
							node = nextNode;
						}
					}
				}
			}
249433
def checkNode(self, namespaceURI=None, localName=None):
        '''
            
        '''
        namespaceURI = namespaceURI or self.namespaceURI
        localName = localName or self.name
        check = False
        if localName and self.node:
            check = self._dom.isElement(self.node, localName, namespaceURI)
        if not check:
            raise NamespaceError, 'unexpected node type %s, expecting %s' %(self.node, localName)
221689
def is_boolean(node):
    """"""
    return any([
        isinstance(node, ast.Name)
        and node.id in ('True', 'False'),
        hasattr(ast, 'NameConstant')  # Support for Python 3 NameConstant
        and isinstance(node, getattr(ast, 'NameConstant'))  # screw you pylint!
        and str(node.value) in ('True', 'False')
    ])
336916
function isBlockNode(node) {
        if (!node) {
            return false;
        }
        var nodeType = node.nodeType;
        return nodeType == 1 && !inlineDisplayRegex.test(getComputedStyleProperty(node, "display"))
            || nodeType == 9 || nodeType == 11;
    }
1282797
protected function checkKey(array $rule, AbstractNode $node): bool
    {
        if ($rule['noKey']) {
            if ( ! is_null($node->getAttribute($rule['key']))) {
                return false;
            }
        } else {
            if ($rule['key'] != 'plaintext' && !$node->hasAttribute($rule['key'])) {
                return false;
            }
        }

        return true;
    }
553020
function rule( context ) {
	/**
	* FUNCTION: validateLiteral( node )
	*	Validates a regular expression literal.
	*
	* @param {Node} node - AST node
	* @returns {Void}
	*/
	function validateLiteral( node ) {
		var token = context.getTokens( node )[ 0 ];
		if (
			token.type === 'RegularExpression' &&
			!safe( token.value )
		) {
			context.report( node, 'Unsafe regular expression' );
		}
	} // end FUNCTION validateLiteral()

	/**
	* FUNCTION: validateExpression( node )
	*	Validates a regular expression creating using the `RegExp` constructor.
	*
	* @param {Node} node - AST node
	* @returns {Void}
	*/
	function validateExpression( node ) {
		var args,
			len,
			re,
			i;

		if ( node.callee.name === 'RegExp' ) {
			len = node.arguments.length;
			args = new Array( node.arguments.length );
			for ( i = 0; i < len; i++ ) {
				// NOTE: we only support literals ATM. Otherwise, we may need to walk and implement an entire tree.
				if ( node.arguments[ i ].type !== 'Literal' ) {
					return;
				}
				args[ i ] = node.arguments[ i ].value;
			}
			re = RegExp.apply( null, args );
			if ( !safe( re ) ) {
				context.report( node, 'Unsafe regular expression' );
			}
		}
	} // end FUNCTION validateExpression()

	return {
		'Literal': validateLiteral,
		'NewExpression': validateExpression,
		'CallExpression': validateExpression
	};
}
261307
function checkForSemicolon(node) {
            const isSemi = astUtils.isSemicolonToken(sourceCode.getLastToken(node));

            if (never) {
                if (isSemi && canRemoveSemicolon(node)) {
                    report(node, true);
                } else if (!isSemi && beforeStatementContinuationChars === "always" && maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) {
                    report(node);
                }
            } else {
                const oneLinerBlock = (exceptOneLine && isOneLinerBlock(node));

                if (isSemi && oneLinerBlock) {
                    report(node, true);
                } else if (!isSemi && !oneLinerBlock) {
                    report(node);
                }
            }
        }