Showing 68 of 82 total issues

Method createGrammarRules has 382 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function createGrammarRules(): array
    {
        return [
            new Concatenation(0, ['TypeSystemLanguage'], 'Document'),
            new Concatenation(1, ['ExecutableLanguage'], null),
Severity: Major
Found in src/GraphQL/BaseParser.php - About 1 day to fix

    File BaseParser.php has 588 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * This file is part of Phplrt package.
     *
     * For the full copyright and license information, please view the LICENSE
    Severity: Major
    Found in src/GraphQL/BaseParser.php - About 1 day to fix

      Method createGrammarRules has 241 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function createGrammarRules(): array
          {
              return [
                  new Repetition(0, 0, -1, 'Directive', null),
                  new Repetition(1, 0, -1, 'Definition', null),
      Severity: Major
      Found in src/SDL/Parser/BaseParser.php - About 1 day to fix

        Method createGrammarRules has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function createGrammarRules(): array
            {
                return [
                    new Concatenation(0, ['Value'], null),
                    (new Concatenation('Json', [0], 'Json'))->setDefaultId('Json'),
        Severity: Major
        Found in src/Json/Json5/BaseParser.php - About 3 hrs to fix

          Method createDateTime has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function createDateTime(ScalarDefinition $reflection): ScalarType
              {
                  $serializeDateTime = function ($value): string {
                      switch (true) {
                          case \is_string($value):
          Severity: Minor
          Found in src/Foundation/Webonyx/Builder/ScalarBuilder.php - About 1 hr to fix

            Function collect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private function collect(Reader $reader, IOInterface $io): \Traversable
                {
                    $sections = $this->loadConfigs($reader);
            
                    foreach ($sections as $name => $configs) {
            Severity: Minor
            Found in src/Discovery/Generator.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 render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function render(TokenInterface $token, Readable $sources): string
                {
                    switch ($token->getName()) {
                        case 'T_CHAR_UTF':
                            return $this->renderUtfChar($token->getValue(1));
            Severity: Minor
            Found in src/Json/Json5/Ast/StringNode.php - About 1 hr to fix

              Function compile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function compile(): void
                  {
                      if ($this->completed === false) {
                          $this->completed = true;
              
              
              Severity: Minor
              Found in src/SDL/Reflection/Builder/Process/Compiler.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 filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function filter(array $data, array $current = []): array
                  {
                      $result = [];
              
                      foreach ($data as $key => $value) {
              Severity: Minor
              Found in src/Discovery/Composer/ArrayWalker.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 all has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function all(): iterable
                  {
                      yield '' => $this->getDirectory();
              
                      //
              Severity: Minor
              Found in src/Discovery/Parser/Variables/PackageVariables.php - About 1 hr to fix

                Function isAllowedFor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function isAllowedFor(?Definition $type): bool
                    {
                        if ($type === null) {
                            return false;
                        }
                Severity: Minor
                Found in src/SDL/Base/Definitions/BaseDirective.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 foldSelectionSet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function foldSelectionSet(SelectionSetNode $selectionSet, int $descend): array
                    {
                        $fields = [];
                
                        foreach ($selectionSet->selections as $selectionNode) {
                Severity: Minor
                Found in src/Foundation/Webonyx/Input.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 list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function list(iterable $routes, FieldResolve $event): array
                    {
                        $result = [];
                
                        foreach ($routes as $route) {
                Severity: Minor
                Found in src/Extension/Routing/Subscribers/FieldResolveToActionSubscriber.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 validateArrayDefaultValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function validateArrayDefaultValue(ArgumentDefinition $type, array $defaults): void
                    {
                        if (! $type->isList()) {
                            $error = \sprintf('%s can not be initialized by List %s',
                                $type, $this->valueToString($defaults)
                Severity: Minor
                Found in src/SDL/Reflection/Validation/Definitions/ArgumentValidator.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 buildType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function buildType(NodeInterface $ast): bool
                    {
                        foreach ($ast->getChildren() as $child) {
                            if ($child->getName() === 'T_NON_NULL') {
                                if ($this->isList) {
                Severity: Minor
                Found in src/SDL/Reflection/Builder/Behavior/TypeIndicationBuilder.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 valueToScalar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function valueToScalar($value)
                    {
                        if (\is_scalar($value)) {
                            return $value;
                        }
                Severity: Minor
                Found in src/SDL/Support.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 resolvePreferType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function resolvePreferType(FieldDefinition $field, ResolveInfo $info): array
                    {
                        $types = [];
                
                        foreach ($info->fieldNodes as $node) {
                Severity: Minor
                Found in src/Foundation/Webonyx/Input/PreferTypesLoader.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 preload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function preload(Dictionary $dictionary): void
                    {
                        foreach ($dictionary->all() as $type) {
                            if ($type instanceof ObjectDefinition && $type->getNumberOfInterfaces() > 0) {
                                $this->types[] = $this->loadType($type->getName());
                Severity: Minor
                Found in src/Foundation/Webonyx/Builder/SchemaBuilder.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 fromEnvironment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function fromEnvironment(array $variables, array $values, \Closure $otherwise = null)
                    {
                        foreach ([$_ENV, $_SERVER] as $context) {
                            foreach ($variables as $variable) {
                                if (isset($context[$variable])) {
                Severity: Minor
                Found in src/Foundation/Application/Environment.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 parseArgumentValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function parseArgumentValue(NodeInterface $ast): array
                    {
                        [$key, $value] = [null, null];
                
                        foreach ($ast->getChildren() as $child) {
                Severity: Minor
                Found in src/SDL/Reflection/Builder/Invocations/DirectiveInvocationBuilder.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

                Severity
                Category
                Status
                Source
                Language