nabbar/SwaggerValidator-PHP

View on GitHub

Showing 604 of 604 total issues

File Context.php has 642 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
 *
Severity: Major
Found in src/Common/Context.php - About 1 day to fix

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

    <?php
    
    /*
     * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
     *
    Severity: Major
    Found in src/Security/OAuth2ImplicitSecurity.php and 3 other locations - About 1 day to fix
    src/Security/ApiKeySecurity.php on lines 1..79
    src/Security/OAuth2ApplicationSecurity.php on lines 1..79
    src/Security/OAuth2PasswordSecurity.php on lines 1..79

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

    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 4 locations. Consider refactoring.
    Open

    <?php
    
    /*
     * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
     *
    Severity: Major
    Found in src/Security/ApiKeySecurity.php and 3 other locations - About 1 day to fix
    src/Security/OAuth2ApplicationSecurity.php on lines 1..79
    src/Security/OAuth2ImplicitSecurity.php on lines 1..79
    src/Security/OAuth2PasswordSecurity.php on lines 1..79

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

    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 4 locations. Consider refactoring.
    Open

    <?php
    
    /*
     * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
     *
    Severity: Major
    Found in src/Security/OAuth2ApplicationSecurity.php and 3 other locations - About 1 day to fix
    src/Security/ApiKeySecurity.php on lines 1..79
    src/Security/OAuth2ImplicitSecurity.php on lines 1..79
    src/Security/OAuth2PasswordSecurity.php on lines 1..79

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

    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 4 locations. Consider refactoring.
    Open

    <?php
    
    /*
     * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
     *
    Severity: Major
    Found in src/Security/OAuth2PasswordSecurity.php and 3 other locations - About 1 day to fix
    src/Security/ApiKeySecurity.php on lines 1..79
    src/Security/OAuth2ApplicationSecurity.php on lines 1..79
    src/Security/OAuth2ImplicitSecurity.php on lines 1..79

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

    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
    
    /*
     * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
     *
    Severity: Major
    Found in src/Object/SecurityRequirement.php and 2 other locations - About 7 hrs to fix
    src/Object/SecurityDefinitions.php on lines 1..72
    src/Object/SecurityItem.php on lines 1..72

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

    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
    
    /*
     * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
     *
    Severity: Major
    Found in src/Object/SecurityDefinitions.php and 2 other locations - About 7 hrs to fix
    src/Object/SecurityItem.php on lines 1..72
    src/Object/SecurityRequirement.php on lines 1..72

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

    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
    
    /*
     * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
     *
    Severity: Major
    Found in src/Object/SecurityItem.php and 2 other locations - About 7 hrs to fix
    src/Object/SecurityDefinitions.php on lines 1..72
    src/Object/SecurityRequirement.php on lines 1..72

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

    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

    ContextBase has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ContextBase implements \SwaggerValidator\Interfaces\ContextBase
    {
    
        /**
         *
    Severity: Major
    Found in src/Common/ContextBase.php - About 7 hrs to fix

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

      <?php
      
      /*
       * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
       *
      Severity: Major
      Found in src/Object/ExternalDocs.php and 3 other locations - About 7 hrs to fix
      src/Object/Contact.php on lines 1..70
      src/Object/Definitions.php on lines 1..70
      src/Object/License.php on lines 1..70

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

      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 4 locations. Consider refactoring.
      Open

      <?php
      
      /*
       * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
       *
      Severity: Major
      Found in src/Object/Definitions.php and 3 other locations - About 7 hrs to fix
      src/Object/Contact.php on lines 1..70
      src/Object/ExternalDocs.php on lines 1..70
      src/Object/License.php on lines 1..70

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

      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 4 locations. Consider refactoring.
      Open

      <?php
      
      /*
       * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
       *
      Severity: Major
      Found in src/Object/Contact.php and 3 other locations - About 7 hrs to fix
      src/Object/Definitions.php on lines 1..70
      src/Object/ExternalDocs.php on lines 1..70
      src/Object/License.php on lines 1..70

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

      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 4 locations. Consider refactoring.
      Open

      <?php
      
      /*
       * Copyright 2016 Nicolas JUHEL <swaggervalidator@nabbar.com>.
       *
      Severity: Major
      Found in src/Object/License.php and 3 other locations - About 7 hrs to fix
      src/Object/Contact.php on lines 1..70
      src/Object/Definitions.php on lines 1..70
      src/Object/ExternalDocs.php on lines 1..70

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

      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

      Context has 42 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Context extends ContextBase implements \SwaggerValidator\Interfaces\ContextLog, \SwaggerValidator\Interfaces\ContextDataLoader, \SwaggerValidator\Interfaces\ContextDataParser
      {
          /*
           * Mode Constants
           */
      Severity: Minor
      Found in src/Common/Context.php - About 5 hrs to fix

        Function validate has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validate(\SwaggerValidator\Common\Context $context)
            {
                foreach ($this->keys() as $key) {
                    if (is_object($this->$key) && ($this->$key instanceof \SwaggerValidator\Object\PathItem)) {
                        continue;
        Severity: Minor
        Found in src/Object/Paths.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 ContextBase.php has 389 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          Sandbox has 32 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Sandbox
          {
          
              /**
               *
          Severity: Minor
          Found in src/Common/Sandbox.php - About 4 hrs to fix

            Function validate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function validate(\SwaggerValidator\Common\Context $context)
                {
                    $keyRequired   = \SwaggerValidator\Common\FactorySwagger::KEY_REQUIRED;
                    $keyAdditional = \SwaggerValidator\Common\FactorySwagger::KEY_ADDPROPERTIES;
            
            Severity: Minor
            Found in src/DataType/TypeObject.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

            File FactorySwagger.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              The class Swagger has an overall complexity of 67 which is very high. The configured complexity threshold is 50.
              Open

              class Swagger extends \SwaggerValidator\Common\CollectionSwagger
              {
              
                  public function __construct()
                  {
              Severity: Minor
              Found in src/Object/Swagger.php by phpmd
              Severity
              Category
              Status
              Source
              Language