susina/psr2-code-generator

View on GitHub

Showing 6 of 6 total issues

AbstractPhpStruct has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractPhpStruct extends AbstractModel implements NamespaceInterface, DocblockInterface
{
    use DocblockPart;
    use LongDescriptionPart;
    use QualifiedNamePart;
Severity: Minor
Found in src/Model/AbstractPhpStruct.php - About 3 hrs to fix

    Method configureOptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function configureOptions(OptionsResolver $resolver): void
        {
            $resolver->setDefaults([
                'generateEmptyDocblock' => false,
                'enableSorting' => true,
    Severity: Minor
    Found in src/Config/GeneratorConfig.php - About 1 hr to fix

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

          public function write(string $content): self
          {
              $lines = explode("\n", $content);
              for ($i = 0, $c = count($lines); $i < $c; ++$i) {
                  if ($this->indentationLevel > 0
      Severity: Minor
      Found in src/Generator/Utils/Writer.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 setTraits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function setTraits(array $traits)
          {
              $this->traits->clear();
              foreach ($traits as $trait) {
                  if (is_string($trait)) {
      Severity: Minor
      Found in src/Model/Parts/TraitsPart.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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function build(AbstractModel $model): void
          {
              if (!$model instanceof PhpMethod) {
                  throw new \InvalidArgumentException('Method builder can build method classes only.');
              }
      Severity: Minor
      Found in src/Generator/Builder/MethodBuilder.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 compare has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function compare($a, $b): int
          {
              // find first difference
              $cmp1 = null;
              $cmp2 = null;
      Severity: Minor
      Found in src/Generator/Comparator/DefaultUseStatementComparator.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