kronostechnologies/graphql-framework

View on GitHub

Showing 19 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

      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

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

                    protected function getDepthPropertiesFromDefinition($definition)
                    {
                        $depthProperties = [];
                
                        if (array_key_exists('fields', $definition)) {
                Severity: Minor
                Found in src/Kronos/GraphQLFramework/Hydrator/DTOHydrator.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 getDiscoveredType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function getDiscoveredType($typeName)
                    {
                        $similarDiscoveredType = array_filter($this->discoveredTypes, function (DiscoveredType $discoveredType) use ($typeName) {
                            return $discoveredType->getTypeName() === $typeName;
                        });
                Severity: Minor
                Found in src/Kronos/GraphQLFramework/TypeRegistry/AutomatedTypeRegistry.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