Showing 45 of 59 total issues

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

abstract class AbstractValue extends ValueFriends {

    /** @const string Name of Primi (object) type. */
    public const TYPE = '__undefined__';

Severity: Minor
Found in src/Values/AbstractValue.php - About 3 hrs to fix

    Function autocomplete has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
    Open

        private static function autocomplete(
            string $buffer,
            Context $ctx
        ): array {
    
    
    Severity: Minor
    Found in src/Repl.php - About 2 hrs 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

    File StringTypeExtension.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    namespace Smuuf\Primi\Stdlib\TypeExtensions;
    Severity: Minor
    Found in src/Stdlib/TypeExtensions/StringTypeExtension.php - About 2 hrs to fix

      File Repl.php has 277 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      
      namespace Smuuf\Primi;
      Severity: Minor
      Found in src/Repl.php - About 2 hrs to fix

        Function execute has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring.
        Open

            public function execute(): void {
        
                $cfg = $this->config;
        
                // Enable verbose logging.
        Severity: Minor
        Found in src/Cli/Entrypoint.php - About 2 hrs 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

        Context has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Context {
        
            use StrictObject;
        
            /** Runtime config bound to this context. */
        Severity: Minor
        Found in src/Context.php - About 2 hrs to fix

          Func has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          abstract class Func {
          
              /**
               * Pair of regexes to match zeroes at the beginning and at the end of a
               * string, if they're not the last zeroes on that side of decimal point.
          Severity: Minor
          Found in src/Helpers/Func.php - About 2 hrs to fix

            Function mapping_to_couples has a Cognitive Complexity of 19 (exceeds 8 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 2 hrs 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 execute has 63 lines of code (exceeds 40 allowed). Consider refactoring.
            Open

                public function execute(): void {
            
                    $cfg = $this->config;
            
                    // Enable verbose logging.
            Severity: Major
            Found in src/Cli/Entrypoint.php - About 1 hr to fix

              Function prepareParameters has a Cognitive Complexity of 17 (exceeds 8 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

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

                  public static function check_allowed_parameter_types_of_function(
                      \ReflectionFunction $rf
                  ): array {
              
                      $types = [];
              Severity: Minor
              Found in src/Helpers/Types.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 format has 47 lines of code (exceeds 40 allowed). Consider refactoring.
              Open

                  #[PrimiFunc]
                  public static function format(
                      StringValue $str,
                      AbstractValue ...$items
                  ): StringValue {
              Severity: Minor
              Found in src/Stdlib/TypeExtensions/StringTypeExtension.php - About 1 hr to fix

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

                    protected static function handle(array $node, Context $context) {
                
                        if (!isset($node['args'])) {
                            return [];
                        }
                Severity: Minor
                Found in src/Handlers/Kinds/ArgumentList.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 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

                Function range has a Cognitive Complexity of 14 (exceeds 8 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

                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

                    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

                      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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language