Showing 57 of 59 total issues

Function extractMethods has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
Open

    public static function extractMethods(object $obj): array {

        $result = [];
        $extRef = new \ReflectionClass($obj);

Severity: Minor
Found in src/Extensions/MethodExtractor.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 prepareParameters has 46 lines of code (exceeds 40 allowed). Consider refactoring.
Open

    public static function prepareParameters(array $paramsNode): array {

        // Prepare dict array for passing specifics about parameters expected
        // by the function.
        // Parameters will be prepared as a dict array with names of parameters
Severity: Minor
Found in src/Handlers/Kinds/FunctionDefinition.php - About 1 hr to fix

    Method range has 46 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

        #[PrimiFunc(callConv: PrimiFunc::CONV_CALLARGS)]
        public static function range(CallArgs $args): IteratorFactoryValue {
    
            $args = $args->extract(['start', 'end', 'step'], ['end', 'step']);
    
    
    Severity: Minor
    Found in src/Stdlib/Modules/std/__builtins__.primi.php - About 1 hr to fix

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

      <?php
      
      declare(strict_types=1);
      
      namespace Smuuf\Primi\Handlers;
      Severity: Major
      Found in src/Handlers/SharedArithmeticHandler.php and 1 other location - About 1 hr to fix
      src/Handlers/Kinds/Comparison.php on lines 1..30

      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 103.

      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

      <?php
      
      declare(strict_types=1);
      
      namespace Smuuf\Primi\Handlers\Kinds;
      Severity: Major
      Found in src/Handlers/Kinds/Comparison.php and 1 other location - About 1 hr to fix
      src/Handlers/SharedArithmeticHandler.php on lines 1..35

      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 103.

      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 build has 43 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

          public static function build(
              array $entryNode,
              string $definitionName,
              ModuleValue $definitionModule,
              ?array $defParams = \null,
      Severity: Minor
      Found in src/Structures/FnContainer.php - About 1 hr to fix

        Method loop has 43 lines of code (exceeds 40 allowed). Consider refactoring.
        Open

            private function loop(Context $ctx): void {
        
                $currentScope = $ctx->getCurrentScope();
                $cellNumber = 1;
        
        
        Severity: Minor
        Found in src/Repl.php - About 1 hr to fix

          Function loop has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
          Open

              private function loop(Context $ctx): void {
          
                  $currentScope = $ctx->getCurrentScope();
                  $cellNumber = 1;
          
          
          Severity: Minor
          Found in src/Repl.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 autocomplete has 42 lines of code (exceeds 40 allowed). Consider refactoring.
          Open

              private static function autocomplete(
                  string $buffer,
                  Context $ctx
              ): array {
          
          
          Severity: Minor
          Found in src/Repl.php - About 1 hr to fix

            Method mapping_to_couples has 41 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                public static function mapping_to_couples(AbstractValue $value) {
            
                    $internalValue = $value->getInternalValue();
                    if ($internalValue instanceof MapContainer) {
            
            
            Severity: Minor
            Found in src/Helpers/Func.php - About 1 hr to fix

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

              <?php
              
              declare(strict_types=1);
              
              namespace Smuuf\Primi\Values;
              Severity: Minor
              Found in src/Values/NotImplementedValue.php and 1 other location - About 55 mins to fix
              src/Values/NullValue.php on lines 1..47

              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 99.

              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

              <?php
              
              declare(strict_types=1);
              
              namespace Smuuf\Primi\Values;
              Severity: Minor
              Found in src/Values/NullValue.php and 1 other location - About 55 mins to fix
              src/Values/NotImplementedValue.php on lines 1..47

              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 99.

              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 reduce has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
              Open

                  public static function reduce(array &$node): void {
              
                      // Make sure this is always list, even with one item.
                      if (isset($node['args'])) {
                          $node['args'] = Func::ensure_indexed($node['args']);
              Severity: Minor
              Found in src/Handlers/Kinds/ArgumentList.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 handle has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
              Open

                  protected static function handle(array $node, Context $context) {
              
                      // Execute the left-hand node and get its return value.
                      $subject = HandlerFactory::runNode($node['left'], $context);
              
              
              Severity: Minor
              Found in src/Handlers/Kinds/ForStatement.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 resolve has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
              Open

                  private static function resolve(
                      string $dotpath,
                      string $originPackage
                  ): array {
              
              
              Severity: Minor
              Found in src/Modules/Dotpath.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 attr_lookup has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
              Open

                  public static function attr_lookup(
                      TypeValue $typeObject,
                      string $attrName,
                      ?AbstractValue $bind = \null
                  ) {
              Severity: Minor
              Found in src/Helpers/Types.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 handle has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
              Open

                  protected static function handle(
                      array $node,
                      Context $context
                  ) {
              
              
              Severity: Minor
              Found in src/Handlers/Kinds/WhileStatement.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

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

                  public function doAddition(AbstractValue $right): ?AbstractValue {
              
                      if ($magic = $this->attrGet(MagicStrings::MAGICMETHOD_OP_ADD)) {
              
                          $result = $magic->invoke($this->ctx, new CallArgs([$right]));
              Severity: Minor
              Found in src/Values/InstanceValue.php and 1 other location - About 45 mins to fix
              src/Values/InstanceValue.php on lines 90..105

              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 95.

              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

                  public function doSubtraction(AbstractValue $right): ?AbstractValue {
              
                      if ($magic = $this->attrGet(MagicStrings::MAGICMETHOD_OP_SUB)) {
              
                          $result = $magic->invoke($this->ctx, new CallArgs([$right]));
              Severity: Minor
              Found in src/Values/InstanceValue.php and 1 other location - About 45 mins to fix
              src/Values/InstanceValue.php on lines 73..88

              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 95.

              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 build has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      array $entryNode,
                      string $definitionName,
                      ModuleValue $definitionModule,
                      ?array $defParams = \null,
                      ?Scope $defScope = \null
              Severity: Minor
              Found in src/Structures/FnContainer.php - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language