njuhel/php-swagger-to-md

View on GitHub

Showing 181 of 181 total issues

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

    public function checkTemplates($path = null)
    {
        if (defined('PHAR_SWG2MD_ROOT_PATH')) {
            $baseDir = PHAR_SWG2MD_ROOT_PATH;
        }
Severity: Minor
Found in src/Swagger2md.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 getSummary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSummary(\SwaggerValidator\Common\Context $context)
    {
        $method = __FUNCTION__;

        $summary  = array();
Severity: Minor
Found in src/SwaggerValidator/Object/Paths.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 renderTable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderTable($name, $anchor, $listKey, $colonsFile, $template, $vars, $store = null)
    {
        if ($store !== false) {
            $file = $this->checkAndMakeObjectFolder();
        }
Severity: Minor
Found in src/Swagger2md.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 markdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function markdown(\SwaggerValidator\Common\Context $context, $generalItems)
    {
        $method       = __FUNCTION__;
        $generalItems = $this->getMethodGeneric($context, $method, $generalItems);
        $tplResources = array();
Severity: Minor
Found in src/SwaggerValidator/Object/Paths.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;
Severity: Major
Found in src/Swagger2md.php - About 30 mins to fix

    Missing class import via use statement (line '53', column '121').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::ResponseItem, new \Swagger2md\SwaggerValidator\Object\ResponseItem());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '229', column '71').
    Open

            file_put_contents($this->output, $this->swagger->markdown(new \Swagger2md\Context()));
    Severity: Minor
    Found in src/Swagger2md.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '38', column '123').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::TypeArrayItems, new \Swagger2md\SwaggerValidator\DataType\TypeArrayItems());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '36', column '120').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::TypeInteger, new \Swagger2md\SwaggerValidator\DataType\TypeInteger());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '37', column '118').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::TypeArray, new \Swagger2md\SwaggerValidator\DataType\TypeArray());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '60', column '116').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::Contact, new \Swagger2md\SwaggerValidator\Object\Contact());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '42', column '119').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::TypeNumber, new \Swagger2md\SwaggerValidator\DataType\TypeNumber());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '43', column '117').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::TypeFile, new \Swagger2md\SwaggerValidator\DataType\TypeFile());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '49', column '122').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::ParameterBody, new \Swagger2md\SwaggerValidator\Object\ParameterBody());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '195', column '62').
    Open

            $this->swagger = \SwaggerValidator\Swagger::load(new \Swagger2md\Context());
    Severity: Minor
    Found in src/Swagger2md.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '46', column '119').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::Parameters, new \Swagger2md\SwaggerValidator\Object\Parameters());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '50', column '116').
    Open

            \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::Swagger, new \Swagger2md\SwaggerValidator\Object\Swagger());
    Severity: Minor
    Found in src/SwaggerValidator/Override.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid too many return statements within this method.
    Open

                return $this->twigTpl->render($template, $vars);
    Severity: Major
    Found in src/Swagger2md.php - About 30 mins to fix

      Missing class import via use statement (line '170', column '34').
      Open

                  $this->twigTpl = new \Twig_Environment(new \Twig_Loader_Filesystem($this->templateFolder), array(
      Severity: Minor
      Found in src/Swagger2md.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '40', column '119').
      Open

              \SwaggerValidator\Common\Factory::getInstance()->set(\SwaggerValidator\Common\CollectionType::TypeObject, new \Swagger2md\SwaggerValidator\DataType\TypeObject());
      Severity: Minor
      Found in src/SwaggerValidator/Override.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Severity
      Category
      Status
      Source
      Language