nabbar/SwaggerValidator-PHP

View on GitHub

Showing 188 of 604 total issues

Avoid too many return statements within this method.
Open

            return $context->setDataCheck('enum')->setValidationError(\SwaggerValidator\Common\Context::VALIDATION_TYPE_DATAVALUE, null, __METHOD__, __LINE__);
Severity: Major
Found in src/DataType/TypeString.php - About 30 mins to fix

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

        public function searchDataPath($search, $nb = 1)
        {
            $ref  = $this->__get('DataPath');
            $find = null;
    
    Severity: Minor
    Found in src/Common/ContextBase.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 checkDataIsEmpty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkDataIsEmpty()
        {
            if ($this->isDataExists() === false) {
                $this->contextDataEmpty = true;
            }
    Severity: Minor
    Found in src/Common/Context.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 validateAllOf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function validateAllOf(\SwaggerValidator\Common\Context $context, $valueParams = null)
        {
            $keyAllOf = \SwaggerValidator\Common\FactorySwagger::KEY_ALLOF;
    
            foreach ($this->$keyAllOf as $key => $object) {
    Severity: Minor
    Found in src/DataType/TypeCombined.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 jsonSerialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function jsonSerialize()
        {
            if ($this->originTypeArray === true) {
                $result = array();
            }
    Severity: Minor
    Found in src/Common/Collection.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 jsonUnSerialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function jsonUnSerialize(\SwaggerValidator\Common\Context $context, $jsonData)
        {
            if (!is_object($jsonData)) {
                $context->throwException('Mismatching type of JSON Data received', __METHOD__, __LINE__);
            }
    Severity: Minor
    Found in src/Object/Swagger.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 validateAnyOf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function validateAnyOf(\SwaggerValidator\Common\Context $context, $valueParams = null)
        {
            $keyAnyOf = \SwaggerValidator\Common\FactorySwagger::KEY_ANYOF;
    
            foreach ($this->$keyAnyOf as $key => $object) {
    Severity: Minor
    Found in src/DataType/TypeCombined.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 extractAllReference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function extractAllReference(\SwaggerValidator\Common\Context $context)
        {
            $refList = array();
    
            if (is_object($this->fileObj)) {
    Severity: Minor
    Found in src/Common/ReferenceFile.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