phplrt/phplrt

View on GitHub

Showing 408 of 408 total issues

Method reducers has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function reducers(): array
    {
        return [
            20 => static function (array $delegates): Node {
                if ($delegates === []) {
Severity: Major
Found in libs/compiler/src/Grammar/PP2Grammar.php - About 3 hrs to fix

    The class Executor has an overall complexity of 57 which is very high. The configured complexity threshold is 50.
    Open

    class Executor implements ExecutorInterface
    {
        /**
         * @var int
         */
    Severity: Minor
    Found in libs/visitor/src/Executor.php by phpmd

    Method grammar has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function grammar(): array
        {
            return [
                0  => new Repetition(11, 0),
                1  => new Concatenation([30, 2]),
    Severity: Major
    Found in libs/compiler/src/Grammar/PP2Grammar.php - About 2 hrs to fix

      Avoid excessively long variable names like $expectedRecursionDepth. Keep variable name length under 20.
      Open

              private readonly int $expectedRecursionDepth = self::DEFAULT_EXPECTED_RECURSION_DEPTH,

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid using short method names like OrderedGenerator::id(). The configured minimum method name length is 3.
      Open

          private function id(int $id): string
          {
              return $this->prefix . $id;
          }

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

      Source https://phpmd.org/rules/naming.html#shortmethodname

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

      <?php
      
      declare(strict_types=1);
      
      namespace Phplrt\Compiler\Printer\Value;
      Severity: Major
      Found in libs/compiler/src/Printer/Value/PhpClassReference.php and 2 other locations - About 1 hr to fix
      libs/compiler/src/Printer/Value/PhpConstReference.php on lines 1..24
      libs/compiler/src/Printer/Value/PhpFunctionReference.php on lines 1..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 104.

      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 3 locations. Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      
      namespace Phplrt\Compiler\Printer\Value;
      Severity: Major
      Found in libs/compiler/src/Printer/Value/PhpConstReference.php and 2 other locations - About 1 hr to fix
      libs/compiler/src/Printer/Value/PhpClassReference.php on lines 1..24
      libs/compiler/src/Printer/Value/PhpFunctionReference.php on lines 1..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 104.

      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 3 locations. Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      
      namespace Phplrt\Compiler\Printer\Value;
      Severity: Major
      Found in libs/compiler/src/Printer/Value/PhpFunctionReference.php and 2 other locations - About 1 hr to fix
      libs/compiler/src/Printer/Value/PhpClassReference.php on lines 1..24
      libs/compiler/src/Printer/Value/PhpConstReference.php on lines 1..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 104.

      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

      Method createFromOffset has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createFromOffset(
              ReadableInterface $source,
              int $offset = PositionInterface::MIN_OFFSET
          ): Position {
              if ($offset <= PositionInterface::MIN_OFFSET) {
      Severity: Minor
      Found in libs/position/src/PositionFactory.php - About 1 hr to fix

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 33 and the first side effect is on line 11.
        Open

        <?php

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 31 and the first side effect is on line 12.
        Open

        <?php

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 35 and the first side effect is on line 11.
        Open

        <?php

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 43 and the first side effect is on line 12.
        Open

        <?php

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 22 and the first side effect is on line 18.
        Open

        <?php

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

            private int $id = 0;

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $id. Configured minimum length is 3.
        Open

            private function id(int $id): string

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $fn. Configured minimum length is 3.
        Open

                $fn = $prepend ? '\\array_unshift' : '\\array_push';
        Severity: Minor
        Found in libs/visitor/src/Traverser.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $to. Configured minimum length is 3.
        Open

                        [$from, $to] = [$value[0]->getValue(), $value[1]->getValue()];

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $to. Configured minimum length is 3.
        Open

            public function __construct(int $from, float $to)

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $e. Configured minimum length is 3.
        Open

            public static function fromInternalFileError(string $filename, \Throwable $e): self

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Severity
        Category
        Status
        Source
        Language