kasperisager/vanilla-api

View on GitHub

Showing 786 of 948 total issues

Function process has a Cognitive Complexity of 513 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        if ($this->_tabWidth === null) {
            $cliValues = $phpcsFile->phpcs->cli->getCommandLineValues();
            if (isset($cliValues['tabWidth']) === false || $cliValues['tabWidth'] === 0) {

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _recurseScopeMap has a Cognitive Complexity of 398 (exceeds 5 allowed). Consider refactoring.
Open

    private static function _recurseScopeMap(
        &$tokens,
        $numTokens,
        $tokenizer,
        $eolChar,
Severity: Minor
Found in library/vendors/squizlabs/php_codesniffer/CodeSniffer/File.php - About 1 wk to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function processPattern has a Cognitive Complexity of 362 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processPattern(
        $patternInfo,
        PHP_CodeSniffer_File $phpcsFile,
        $stackPtr
    ) {

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function tokenizeString has a Cognitive Complexity of 339 (exceeds 5 allowed). Consider refactoring.
Open

    public function tokenizeString($string, $eolChar='\n')
    {
        if (PHP_CODESNIFFER_VERBOSITY > 1) {
            echo "\t*** START JS TOKENIZING ***".PHP_EOL;
        }

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function processMultiLineArray has a Cognitive Complexity of 302 (exceeds 5 allowed). Consider refactoring.
Open

    public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $arrayStart, $arrayEnd)
    {
        $tokens       = $phpcsFile->getTokens();
        $keywordStart = $tokens[$stackPtr]['column'];

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File File.php has 2117 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * A PHP_CodeSniffer_File object represents a PHP source file and the tokens
 * associated with it.
 *
Severity: Major
Found in library/vendors/squizlabs/php_codesniffer/CodeSniffer/File.php - About 5 days to fix

    Function tokenizeString has a Cognitive Complexity of 250 (exceeds 5 allowed). Consider refactoring.
    Open

        public function tokenizeString($string, $eolChar='\n')
        {
            if (PHP_CODESNIFFER_VERBOSITY > 1) {
                echo "\t*** START PHP TOKENIZING ***".PHP_EOL;
                $isWin = false;

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function processLongArgument has a Cognitive Complexity of 242 (exceeds 5 allowed). Consider refactoring.
    Open

        public function processLongArgument($arg, $pos)
        {
            switch ($arg) {
            case 'help':
                $this->printUsage();
    Severity: Minor
    Found in library/vendors/squizlabs/php_codesniffer/CodeSniffer/CLI.php - About 4 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function processOpen has a Cognitive Complexity of 211 (exceeds 5 allowed). Consider refactoring.
    Open

        public function processOpen(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
        {
            $tokens       = $phpcsFile->getTokens();
            $stackPtrType = strtolower($tokens[$stackPtr]['content']);
    
    

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function processBracket has a Cognitive Complexity of 210 (exceeds 5 allowed). Consider refactoring.
    Open

        public function processBracket(PHP_CodeSniffer_File $phpcsFile, $openBracket)
        {
            $tokens       = $phpcsFile->getTokens();
            $closeBracket = $tokens[$openBracket]['parenthesis_closer'];
            $multiLine    = ($tokens[$openBracket]['line'] !== $tokens[$closeBracket]['line']);

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _createLevelMap has a Cognitive Complexity of 200 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function _createLevelMap(&$tokens, $tokenizer, $eolChar)
        {
            if (PHP_CODESNIFFER_VERBOSITY > 1) {
                echo "\t*** START LEVEL MAP ***".PHP_EOL;
            }
    Severity: Minor
    Found in library/vendors/squizlabs/php_codesniffer/CodeSniffer/File.php - About 4 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function process has a Cognitive Complexity of 197 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
        {
            $tokens = $phpcsFile->getTokens();
    
            // We can't process SWITCH statements unless we know where they start and end.

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File CodeSniffer.php has 1405 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * PHP_CodeSniffer tokenizes PHP code and detects violations of a
     * defined set of coding standards.
     *
    Severity: Major
    Found in library/vendors/squizlabs/php_codesniffer/CodeSniffer.php - About 3 days to fix

      Function processParams has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function processParams(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $commentStart)
          {
              $tokens = $phpcsFile->getTokens();
      
              $params  = array();

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method process has 687 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
          {
              if ($this->_tabWidth === null) {
                  $cliValues = $phpcsFile->phpcs->cli->getCommandLineValues();
                  if (isset($cliValues['tabWidth']) === false || $cliValues['tabWidth'] === 0) {

        Function process has a Cognitive Complexity of 157 (exceeds 5 allowed). Consider refactoring.
        Open

            public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
            {
                $tokens       = $phpcsFile->getTokens();
                $commentStart = $stackPtr;
                $commentEnd   = $tokens[$stackPtr]['comment_closer'];

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function processAdditional has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring.
        Open

            public function processAdditional(&$tokens, $eolChar)
            {
                if (PHP_CODESNIFFER_VERBOSITY > 1) {
                    echo "\t*** START ADDITIONAL PHP PROCESSING ***".PHP_EOL;
                }

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function processAdditional has a Cognitive Complexity of 148 (exceeds 5 allowed). Consider refactoring.
        Open

            public function processAdditional(&$tokens, $eolChar)
            {
                if (PHP_CODESNIFFER_VERBOSITY > 1) {
                    echo "\t*** START ADDITIONAL JS PROCESSING ***".PHP_EOL;
                }

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function processMultiLineCall has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
        Open

            public function processMultiLineCall(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $openBracket, $tokens)
            {
                // We need to work out how far indented the function
                // call itself is, so we can work out how far to
                // indent the arguments.

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function tokenizeString has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring.
        Open

            public function tokenizeString($string, $eolChar='\n')
            {
                if (PHP_CODESNIFFER_VERBOSITY > 1) {
                    echo "\t*** START CSS TOKENIZING ***".PHP_EOL;
                }

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Severity
        Category
        Status
        Source
        Language