railt/graphql

View on GitHub

Showing 18 of 35 total issues

File grammar.php has 569 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use Railt\SDL\Node;
use Railt\SDL\Node\Expression as Expr;
use Railt\SDL\Node\Statement as Stmt;
Severity: Major
Found in resources/grammar.php - About 1 day to fix

    Function getDirectives has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getDirectives(string $name = null): iterable
        {
            if ($this->schema !== null) {
                foreach ($this->schema->getDirectives($name) as $directive) {
                    yield $this->schema => $directive;
    Severity: Minor
    Found in src/Dictionary.php - About 5 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

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

    class ExpressionException extends CompilationException
    {
        public const CODE_UNPROCESSABLE = 0x01;
        public const CODE_UNDEFINED_VARIABLE = 0x02;
        public const CODE_ENUM_INVALID_TYPE = 0x03;
    Severity: Minor
    Found in src/Exception/ExpressionException.php - About 3 hrs to fix

      Method getDirectives has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getDirectives(string $name = null): iterable
          {
              if ($this->schema !== null) {
                  foreach ($this->schema->getDirectives($name) as $directive) {
                      yield $this->schema => $directive;
      Severity: Minor
      Found in src/Dictionary.php - About 1 hr to fix

        Method execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function execute(InputInterface $input, OutputInterface $output): int
            {
                if (!class_exists(Compiler::class)) {
                    throw new \LogicException('The "railt/compiler" dependency required');
                }
        Severity: Minor
        Found in src/Command/CompileParserCommand.php - About 1 hr to fix

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

              public function exec(): void
              {
                  $this->assertFieldNotDefined();
          
                  /** @var OutputTypeInterface $type */
          Severity: Minor
          Found in src/Compiler/Command/Build/BuildFieldDefinitionCommand.php - About 1 hr to fix

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

                public function exec(): void
                {
                    $this->assertInputFieldNotDefined();
            
                    /** @var InputTypeInterface $type */
            Severity: Minor
            Found in src/Compiler/Command/Build/BuildInputFieldDefinitionCommand.php - About 1 hr to fix

              Method exec has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function exec(): void
                  {
                      $this->assertArgumentNotDefined();
              
                      /** @var InputTypeInterface $type */
              Severity: Minor
              Found in src/Compiler/Command/Build/BuildArgumentDefinitionCommand.php - About 1 hr to fix

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        NameNode $name,
                        DescriptionNode $description,
                        #[Visitable]
                        public array $interfaces = [],
                        #[Visitable]
                Severity: Minor
                Found in src/Node/Statement/Definition/ObjectLikeDefinitionNode.php - About 35 mins to fix

                  Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          #[Visitable]
                          public IdentifierNode $name,
                          #[Visitable]
                          public DescriptionNode $description,
                          #[Visitable]
                  Severity: Minor
                  Found in src/Node/Statement/ArgumentNode.php - About 35 mins to fix

                    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            #[Visitable]
                            public IdentifierNode $name,
                            #[Visitable]
                            public DescriptionNode $description,
                            #[Visitable]
                    Severity: Minor
                    Found in src/Node/Statement/FieldNode.php - About 35 mins to fix

                      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              #[Visitable]
                              public NameNode $name,
                              #[Visitable]
                              public DescriptionNode $description,
                              #[Visitable]
                      Severity: Minor
                      Found in src/Node/Statement/Definition/DirectiveDefinitionNode.php - About 35 mins to fix

                        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                #[Visitable]
                                public IdentifierNode $name,
                                #[Visitable]
                                public DescriptionNode $description,
                                #[Visitable]
                        Severity: Minor
                        Found in src/Node/Statement/InputFieldNode.php - About 35 mins to fix

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

                              private static function getMinIndentation(string $text): int
                              {
                                  $indentation = \PHP_INT_MAX;
                          
                                  foreach (\explode("\n", $text) as $i => $line) {
                          Severity: Minor
                          Found in src/Node/Expression/Literal/StringLiteralNode.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 parseMultilineString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function parseMultilineString(string $value): self
                              {
                                  $value = \substr($value, 3, -3);
                          
                                  $indentation = self::getMinIndentation($value);
                          Severity: Minor
                          Found in src/Node/Expression/Literal/StringLiteralNode.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

                          Avoid too many return statements within this method.
                          Open

                                  return \get_debug_type($value);
                          Severity: Major
                          Found in src/Exception/ExpressionException.php - About 30 mins to fix

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

                                public function exec(): void
                                {
                                    foreach ($this->node->fields as $node) {
                                        $type = $this->buildFieldType($node);
                            
                            
                            Severity: Minor
                            Found in src/Compiler/Command/Build/BuildSchemaDefinitionCommand.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function execute(InputInterface $input, OutputInterface $output): int
                                {
                                    if (!class_exists(Compiler::class)) {
                                        throw new \LogicException('The "railt/compiler" dependency required');
                                    }
                            Severity: Minor
                            Found in src/Command/CompileParserCommand.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