sixty-nine/ClassGrapher

View on GitHub

Showing 46 of 46 total issues

Method build has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function build($dir, $sortClasses = false, $sortNs = false, $sortMethods = false, $noParents = false, $noMethods = false, $noNs = false)
Severity: Major
Found in src/SixtyNine/ClassGrapher/Dump/DumpBuilder.php - About 50 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            $this
                ->setName('dump3')
                ->setDescription('Dump the object table')
                ->setHelp('Generate a list of classes and methods in text format')
                ->addArgument('dir', InputArgument::REQUIRED, '')
    Severity: Minor
    Found in src/SixtyNine/ClassGrapher/Command/DumpObjectTableCommand.php and 1 other location - About 50 mins to fix
    src/SixtyNine/ClassGrapher/Command/BuildGraphCommand.php on lines 21..28

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 97.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            $this
                ->setName('graph')
                ->setDescription('Generate a class diagram in GraphViz format')
                ->setHelp('Generate a class diagram in GraphViz format')
                ->addArgument('dir', InputArgument::REQUIRED, '')
    Severity: Minor
    Found in src/SixtyNine/ClassGrapher/Command/BuildGraphCommand.php and 1 other location - About 50 mins to fix
    src/SixtyNine/ClassGrapher/Command/DumpObjectTableCommand.php on lines 17..24

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 97.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function parseInterface has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseInterface()
        {
            $extends = array();
            $token = $this->tokenizer->expectToken(T_INTERFACE, false, true);
            $name = $this->classResolver->resolve($this->parseIdentifier());
    Severity: Minor
    Found in src/SixtyNine/ClassGrapher/Parser/Parser.php - About 45 mins 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 getAugmentedGrammar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getAugmentedGrammar()
        {
            if (!$this->isAugmentedGrammar()) {
                if ($this->axiom) {
                    $axiom = new Rule(new NonTerminalSymbol('axiom'), array($this->axiom->getLeftHand()), true);
    Severity: Minor
    Found in src/SixtyNine/PhpParse/Grammar/Grammar.php - About 45 mins 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 scan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function scan(ReaderInterface $reader)
        {
            $this->debugSection("SCANNER CYCLE");
    
            $this->resetQueue();
    Severity: Minor
    Found in src/SixtyNine/PhpParse/Scanner/GenericScanner.php - About 45 mins 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 scan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function scan(ReaderInterface $reader)
        {
            $tokens = array();
            $curLine = 0;
    
    
    Severity: Minor
    Found in src/SixtyNine/PhpParse/Scanner/PhpScanner.php - About 45 mins 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 resolve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolve($name)
        {
            $search = $name;
            if (($pos = strpos($name, '\\')) !== false) {
                $search = substr($name, 0, $pos);
    Severity: Minor
    Found in src/SixtyNine/ClassGrapher/Parser/ClassResolver.php - About 45 mins 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 expectToken has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function expectToken($data, $optional = false, $compareType = false)
        {
            if (!$optional) {
                $token = $this->getToken();
    
    
    Severity: Minor
    Found in src/SixtyNine/ClassGrapher/Parser/Tokenizer.php - About 45 mins 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 dump has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function dump($compact = false, $level = 0)
        {
            $dump = '';
            $indent = str_repeat('  ', $level);
            $dump .= sprintf("%sNODE[%s]%s\n", $indent, $this->type, !empty($this->properties) || !empty($this->children) ? ':' : '');
    Severity: Minor
    Found in src/SixtyNine/PhpParse/Parser/SyntaxTreeNode.php - About 45 mins 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 find has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function find($dirName, $pattern = '*.php', $excludeDirs = array())
        {
            if (!is_dir($dirName)) {
                throw new \InvalidArgumentException("Invalid directory '$dirName'");
            }
    Severity: Minor
    Found in src/SixtyNine/ClassGrapher/Helper/FileFinder.php - About 45 mins 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

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($file = '', $line = 0, $name = '', $extends = array(), $methods = array())
    Severity: Minor
    Found in src/SixtyNine/ClassGrapher/Model/InterfaceItem.php - About 35 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct($file = '', $line = 0, $name = '', $extends = '', $implements = array())
      Severity: Minor
      Found in src/SixtyNine/ClassGrapher/Model/ClassItem.php - About 35 mins to fix

        Method addClass has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function addClass($file, $line, $name, $extends = array(), $implements = array())
        Severity: Minor
        Found in src/SixtyNine/ClassGrapher/Model/ObjectTableBuilder.php - About 35 mins to fix

          Function peekToken has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function peekToken()
              {
                  if ($this->isEof()) {
                      return false;
                  }
          Severity: Minor
          Found in src/SixtyNine/ClassGrapher/Parser/Tokenizer.php - About 35 mins 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 testGetNextChar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function testGetNextChar()
              {
                  $curLine = 1;
                  $curCol = 1;
          
          
          Severity: Minor
          Found in src/SixtyNine/PhpParse/Tests/Reader/FileReaderTest.php - About 35 mins 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 parseUse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function parseUse()
              {
                  $this->tokenizer->expectToken(T_USE, false, true);
          
                  while (true) {
          Severity: Minor
          Found in src/SixtyNine/ClassGrapher/Parser/Parser.php - About 35 mins 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

          Avoid too many return statements within this method.
          Open

                      case self::TK_SYMBOL: return 'Symbol';
          Severity: Major
          Found in src/SixtyNine/PhpParse/Scanner/GenericToken.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        case self::TK_IDENTIFIER: return 'Identifier';
            Severity: Major
            Found in src/SixtyNine/PhpParse/Scanner/GenericToken.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $name;
              Severity: Major
              Found in src/SixtyNine/ClassGrapher/Parser/ClassResolver.php - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language