kronostechnologies/graphql-framework

View on GitHub

Showing 22 of 22 total issues

Function modifyResponse has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function modifyResponse($response)
    {
        if (is_array($response)) {
            // Array of DTOs
            foreach ($response as $key => $val) {
Severity: Minor
Found in src/Kronos/GraphQLFramework/Relay/RelayMiddleware.php - About 4 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

FrameworkConfiguration has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

class FrameworkConfiguration
{
    /**
     * @var LoggerInterface
     */
Severity: Minor
Found in src/Kronos/GraphQLFramework/FrameworkConfiguration.php - About 4 hrs to fix

    Method executeQuery has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function executeQuery($queryString, array $variables)
        {
            try {
                $this->loadSchema();
    
    
    Severity: Major
    Found in src/Kronos/GraphQLFramework/Executor/Executor.php - About 2 hrs to fix

      Function executeQuery has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function executeQuery($queryString, array $variables)
          {
              try {
                  $this->loadSchema();
      
      
      Severity: Minor
      Found in src/Kronos/GraphQLFramework/Executor/Executor.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

      Function getPersistentCacheStatus has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getPersistentCacheStatus($forceStatus, $cacheName)
          {
              if ($forceStatus === true) {
                  if ($this->cacheAdapter === null) {
                      throw new NoCacheAdapterConfiguredException($cacheName);
      Severity: Minor
      Found in src/Kronos/GraphQLFramework/FrameworkConfiguration.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

      Function extractNamespace has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function extractNamespace(array $tokens)
          {
              $extractedNamespace = "";
              $inNamespace = false;
      
      
      Severity: Minor
      Found in src/Kronos/GraphQLFramework/Utils/Reflection/ClassInfoReader.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

      Function createInstanceFromDefinition has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function createInstanceFromDefinition($definition, $values)
          {
              if (!array_key_exists('fqn', $definition)) {
                  throw new FQNDefinitionMissingException();
              }
      Severity: Minor
      Found in src/Kronos/GraphQLFramework/Hydrator/DTOHydrator.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

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

      <?php
      
      
      namespace Kronos\GraphQLFramework\Resolver\Exception;
      
      
      src/Kronos/GraphQLFramework/Resolver/Controller/Exception/InvalidControllerTypeException.php on lines 1..28
      src/Kronos/GraphQLFramework/Utils/Reflection/Exception/NoClassMethodFoundException.php on lines 1..28

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

      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
      
      
      namespace Kronos\GraphQLFramework\Resolver\Controller\Exception;
      
      
      src/Kronos/GraphQLFramework/Resolver/Exception/MissingFieldResolverException.php on lines 1..29
      src/Kronos/GraphQLFramework/Utils/Reflection/Exception/NoClassMethodFoundException.php on lines 1..28

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

      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
      
      
      namespace Kronos\GraphQLFramework\Utils\Reflection\Exception;
      
      
      src/Kronos/GraphQLFramework/Resolver/Controller/Exception/InvalidControllerTypeException.php on lines 1..28
      src/Kronos/GraphQLFramework/Resolver/Exception/MissingFieldResolverException.php on lines 1..29

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

      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 modifyResponse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function modifyResponse($response)
          {
              if (is_array($response)) {
                  // Array of DTOs
                  foreach ($response as $key => $val) {
      Severity: Minor
      Found in src/Kronos/GraphQLFramework/Relay/RelayMiddleware.php - About 1 hr to fix

        Function modifyRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function modifyRequest($request)
            {
                if (is_array($request)) {
                    if (array_key_exists($this->idFieldName, $request)) {
                        $relayIdentifier = new RelayGlobalIdentifier();
        Severity: Minor
        Found in src/Kronos/GraphQLFramework/Relay/RelayMiddleware.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 executePostRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function executePostRequest(ServerRequestInterface $request)
            {
                $parsedBody = json_decode($request->getBody()->getContents(), true);
        
                if ($parsedBody === null || !array_key_exists('query', $parsedBody)) {
        Severity: Minor
        Found in src/Kronos/GraphQLFramework/EntryPoint/HttpEntryPoint.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 getPotentialControllerClasses has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getPotentialControllerClasses()
            {
                if ($this->controllers === null) {
                    $lister = new DirectoryLister($this->controllersDirectory);
        
        
        Severity: Minor
        Found in src/Kronos/GraphQLFramework/Resolver/Controller/ControllerFinder.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 getControllerForTypeExpectingGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getControllerForTypeExpectingGroup($typeName, $expectedGroup)
            {
                foreach ($this->getGroupedControllers() as $groupName => $controllers) {
                    /** @var ClassInfoReaderResult[] $controllers */
                    $controllerMatcher = new ControllerMatcher($controllers);
        Severity: Minor
        Found in src/Kronos/GraphQLFramework/Resolver/Controller/ControllerStore.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 executeGetRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function executeGetRequest(ServerRequestInterface $request)
            {
                $queryParams = $request->getQueryParams();
        
                if (!array_key_exists('query', $queryParams)) {
        Severity: Minor
        Found in src/Kronos/GraphQLFramework/EntryPoint/HttpEntryPoint.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 new ExecutorResult(json_encode([
                            'internalException' => [
                                'message' => $ex->getMessage(),
                                'trace' => $ex->getTrace(),
                            ]
        Severity: Major
        Found in src/Kronos/GraphQLFramework/Executor/Executor.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return new ExecutorResult(json_encode($exceptionPayload), $ex);
          Severity: Major
          Found in src/Kronos/GraphQLFramework/Executor/Executor.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return true;
            Severity: Major
            Found in src/Kronos/GraphQLFramework/FrameworkConfiguration.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return new ExecutorResult(json_encode($result), $handledException);
              Severity: Major
              Found in src/Kronos/GraphQLFramework/Executor/Executor.php - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language