marcojetson/freckle

View on GitHub

Showing 22 of 22 total issues

Function generate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function generate()
    {
        $schemaManager = $this->getSchemaManager();

        $definitions = [];
Severity: Minor
Found in lib/Connection.php - About 1 hr 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 __toString has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __toString()
    {
        $header = '';

        $parts = explode('\\', $this->entityClass());
Severity: Minor
Found in lib/Mapping.php - About 1 hr to fix

    Method generate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function generate()
        {
            $schemaManager = $this->getSchemaManager();
    
            $definitions = [];
    Severity: Minor
    Found in lib/Connection.php - About 1 hr to fix

      Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(array $definition)
          {
              $this->entityClass = $this->resolveEntityClass($definition);
              $this->table = $this->resolveTable($definition);
      
      
      Severity: Minor
      Found in lib/Mapping.php - About 1 hr to fix

        Function __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct(array $definition)
            {
                $this->entityClass = $this->resolveEntityClass($definition);
                $this->table = $this->resolveTable($definition);
        
        
        Severity: Minor
        Found in lib/Mapping.php - About 1 hr 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 relation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function relation(Entity $entity, $definition)
            {
                list($type, $entityClass, $conditions) = $definition;
        
                if (!is_subclass_of($entityClass, Entity::class)) {
        Severity: Minor
        Found in lib/Mapper.php - About 55 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 clause has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function clause($conditions, $glue = 'and')
            {
                $restrictions = [];
                foreach ($conditions as $field => $value) {
                    if ($field === 'and' || $field === 'or') {
        Severity: Minor
        Found in lib/Query.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 __toString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __toString()
            {
                $header = '';
        
                $parts = explode('\\', $this->entityClass());
        Severity: Minor
        Found in lib/Mapping.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

        Missing class import via use statement (line '64', column '23').
        Open

                    throw new \BadMethodCallException('Missing argument 1 for ' . static::class . '::' . $method);
        Severity: Minor
        Found in lib/Entity.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '281', column '23').
        Open

                    throw new \InvalidArgumentException('Related $entityClass must be a subclass of ' . Entity::class);
        Severity: Minor
        Found in lib/Mapper.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '167', column '19').
        Open

                throw new \RuntimeException('Freckle\Query is read-only');
        Severity: Minor
        Found in lib/Query.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '208', column '27').
        Open

                        throw new \InvalidArgumentException('Invalid operator ' . $operatorName);
        Severity: Minor
        Found in lib/Query.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '59', column '23').
        Open

                    throw new \InvalidArgumentException('$operatorClass must be a subclass off ' . self::class);
        Severity: Minor
        Found in lib/Operator/Operator.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '178', column '23').
        Open

                    throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $name . '()');
        Severity: Minor
        Found in lib/Query.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '109', column '23').
        Open

                    throw new \InvalidArgumentException('$entityClass must be a subclass of ' . Entity::class);
        Severity: Minor
        Found in lib/Mapping.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '123', column '20').
        Open

                return new \ArrayIterator($this->run());
        Severity: Minor
        Found in lib/Query.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '159', column '19').
        Open

                throw new \RuntimeException('Freckle\Query is read-only');
        Severity: Minor
        Found in lib/Query.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        The method count has a boolean flag argument $limit, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function count($limit = true)
        Severity: Minor
        Found in lib/Query.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        Missing class import via use statement (line '60', column '23').
        Open

                    throw new \BadMethodCallException('Call to undefined method ' . static::class . '::' . $method);
        Severity: Minor
        Found in lib/Entity.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Function entity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function entity(array $data = [])
            {
                /** @var Entity $entity */
                $entityClass = $this->mapping->entityClass();
                $entity = new $entityClass;
        Severity: Minor
        Found in lib/Mapper.php - About 25 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

        Severity
        Category
        Status
        Source
        Language