bravesheep/dogmatist

View on GitHub

Showing 26 of 26 total issues

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

    private function processField(\ReflectionProperty $prop, Builder $builder)
    {
        $type = null;
        $count = null;
        foreach ($this->reader->getPropertyAnnotations($prop) as $annot) {
Severity: Minor
Found in src/Guesser/AnnotationGuesser.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 addField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function addField($name, Annotations\FieldInterface $annot, $count, Builder $builder)
    {
        if ($annot instanceof Annotations\Fake) {
            $builder->fake($name, $annot->type, $annot->args);
        } elseif ($annot instanceof Annotations\Link) {
Severity: Minor
Found in src/Guesser/AnnotationGuesser.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 addFieldOfType has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private function addFieldOfType($field, $type, $multiple, array $options, Builder $builder)
Severity: Minor
Found in src/Guesser/FieldNameGuesser.php - About 35 mins to fix

    Avoid too many return statements within this method.
    Open

                return false;
    Severity: Major
    Found in src/Guesser/TypeResolver.php - About 30 mins to fix

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

          protected function checkState($field)
          {
              if (is_int($field)) {
                  $this->preparePositional();
              }
      Severity: Minor
      Found in src/ConstructorBuilder.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

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

          public function fill(Builder $builder)
          {
              if (Util::isUserClass($builder->getClass())) {
                  $refl = new \ReflectionClass($builder->getClass());
                  $filter = \ReflectionProperty::IS_PRIVATE |
      Severity: Minor
      Found in src/Guesser/FieldNameGuesser.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