njuhel/php-swagger-to-md

View on GitHub

Showing 45 of 181 total issues

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

    public function markdown(\SwaggerValidator\Common\Context $context)
    {
        $method       = __FUNCTION__;
        $templateVars = array(
            'partType' => \Swagger2md\Swagger2md::getInstance()->renderTemplate('PartTypeFormat', array('type' => \SwaggerValidator\Common\FactorySwagger::TYPE_OBJECT)),
Severity: Minor
Found in src/SwaggerValidator/DataType/TypeObject.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

File Swagger2md.php has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * Copyright 2016 Nicolas JUHEL<swaggervalidator@nabbar.com>.
 *
Severity: Minor
Found in src/Swagger2md.php - About 4 hrs to fix

    Method loadSwaggerFile has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function loadSwaggerFile($swaggerFile = null)
        {
            $params = getopt('h::v', array(
                'templates::',
                'tempDir::',
    Severity: Major
    Found in src/Swagger2md.php - About 3 hrs to fix

      Function markdown has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function markdown(\SwaggerValidator\Common\Context $context)
          {
              $method       = __FUNCTION__;
              $keyTags      = \SwaggerValidator\Common\FactorySwagger::KEY_TAGS;
              $generalItems = $this->getMethodGeneric($context, $method);
      Severity: Minor
      Found in src/SwaggerValidator/Object/Swagger.php - About 3 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 markdown has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public function markdown(\SwaggerValidator\Common\Context $context)
          {
              $method       = __FUNCTION__;
              $templateVars = array(
                  'items' => array(),
      Severity: Minor
      Found in src/SwaggerValidator/DataType/TypeArrayItems.php - About 3 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 makeRequestExample has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function makeRequestExample(\SwaggerValidator\Common\Context $context, $operation)
          {
              $keyParameters = \SwaggerValidator\Common\FactorySwagger::KEY_PARAMETERS;
              $keyResponses  = \SwaggerValidator\Common\FactorySwagger::KEY_RESPONSES;
              $keyConsumes   = \SwaggerValidator\Common\FactorySwagger::KEY_CONSUMES;
      Severity: Minor
      Found in src/SwaggerValidator/Object/Operation.php - About 3 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 markdown has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public function markdown(\SwaggerValidator\Common\Context $context)
          {
              $method               = __FUNCTION__;
              $schemaKey            = \SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA;
              $templateVars         = array();
      Severity: Minor
      Found in src/SwaggerValidator/Object/ParameterBody.php - About 3 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 loadSwaggerFile has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public function loadSwaggerFile($swaggerFile = null)
          {
              $params = getopt('h::v', array(
                  'templates::',
                  'tempDir::',
      Severity: Minor
      Found in src/Swagger2md.php - About 3 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 makeRequestExample has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function makeRequestExample(\SwaggerValidator\Common\Context $context, $operation)
          {
              $keyParameters = \SwaggerValidator\Common\FactorySwagger::KEY_PARAMETERS;
              $keyResponses  = \SwaggerValidator\Common\FactorySwagger::KEY_RESPONSES;
              $keyConsumes   = \SwaggerValidator\Common\FactorySwagger::KEY_CONSUMES;
      Severity: Major
      Found in src/SwaggerValidator/Object/Operation.php - About 2 hrs to fix

        Method markdown has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function markdown(\SwaggerValidator\Common\Context $context)
            {
                $method       = __FUNCTION__;
                $templateVars = array(
                    'partType' => \Swagger2md\Swagger2md::getInstance()->renderTemplate('PartTypeFormat', array('type' => \SwaggerValidator\Common\FactorySwagger::TYPE_OBJECT)),
        Severity: Major
        Found in src/SwaggerValidator/DataType/TypeObject.php - About 2 hrs to fix

          Method renderTable has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function renderTable($name, $anchor, $listKey, $colonsFile, $template, $vars, $store = null)
              {
                  if ($store !== false) {
                      $file = $this->checkAndMakeObjectFolder();
                  }
          Severity: Major
          Found in src/Swagger2md.php - About 2 hrs to fix

            Function getTags has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getTags(\SwaggerValidator\Common\Context $context, $tags)
                {
                    $method  = __FUNCTION__;
                    $keyTags = \SwaggerValidator\Common\FactorySwagger::KEY_TAGS;
                    $curPath = $context->getRoutePath();
            Severity: Minor
            Found in src/SwaggerValidator/Object/PathItem.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

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

            class Swagger2md
            {
            
                const version = '1.0.0';
            
            
            Severity: Minor
            Found in src/Swagger2md.php - About 2 hrs to fix

              Method markdown has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function markdown(\SwaggerValidator\Common\Context $context)
                  {
                      $method               = __FUNCTION__;
                      $schemaKey            = \SwaggerValidator\Common\FactorySwagger::KEY_SCHEMA;
                      $templateVars         = array();
              Severity: Major
              Found in src/SwaggerValidator/Object/ParameterBody.php - About 2 hrs to fix

                Method markdown has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function markdown(\SwaggerValidator\Common\Context $context, $generalItems)
                    {
                        $method         = __FUNCTION__;
                        $generalItems   = $this->getMethodGeneric($context, $method, $generalItems);
                        $exampleRequest = $this->makeRequestExample($context, $generalItems);
                Severity: Major
                Found in src/SwaggerValidator/Object/Operation.php - About 2 hrs to fix

                  Method markdown has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function markdown(\SwaggerValidator\Common\Context $context)
                      {
                          $method       = __FUNCTION__;
                          $templateVars = array(
                              'items' => array(),
                  Severity: Major
                  Found in src/SwaggerValidator/DataType/TypeArrayItems.php - About 2 hrs to fix

                    Method markdown has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function markdown(\SwaggerValidator\Common\Context $context)
                        {
                            $method       = __FUNCTION__;
                            $keyTags      = \SwaggerValidator\Common\FactorySwagger::KEY_TAGS;
                            $generalItems = $this->getMethodGeneric($context, $method);
                    Severity: Minor
                    Found in src/SwaggerValidator/Object/Swagger.php - About 2 hrs to fix

                      Function markdown has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function markdown(\SwaggerValidator\Common\Context $context, $generalItems)
                          {
                              $method = __FUNCTION__;
                              $context->setType(\SwaggerValidator\Common\Context::TYPE_REQUEST);
                      
                      
                      Severity: Minor
                      Found in src/SwaggerValidator/Object/Parameters.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 getTags has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getTags(\SwaggerValidator\Common\Context $context, $tags)
                          {
                              $method  = __FUNCTION__;
                              $keyTags = \SwaggerValidator\Common\FactorySwagger::KEY_TAGS;
                              $curPath = $context->getRoutePath();
                      Severity: Minor
                      Found in src/SwaggerValidator/Object/PathItem.php - About 1 hr to fix

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

                            public function markdown(\SwaggerValidator\Common\Context $context, $generalItems)
                            {
                                $method         = __FUNCTION__;
                                $generalItems   = $this->getMethodGeneric($context, $method, $generalItems);
                                $exampleRequest = $this->makeRequestExample($context, $generalItems);
                        Severity: Minor
                        Found in src/SwaggerValidator/Object/Operation.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