NeroReflex/Gishiki

View on GitHub

Showing 48 of 176 total issues

Avoid too many return statements within this method.
Open

            return new self($nativeSerialization);
Severity: Major
Found in src/Algorithms/Collections/SerializableCollection.php - About 30 mins to fix

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

        public function update($collection, $data, SelectionCriteria $where) : int
        {
            //check for invalid database name
            if ((!is_string($collection)) || (strlen($collection) <= 0)) {
                throw new \InvalidArgumentException('The name of the table must be given as a non-empty string');
    Severity: Minor
    Found in src/Database/Adapters/Utils/PDODatabaseTrait.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 serialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function serialize($format = self::JSON)
        {
            if (!is_integer($format)) {
                throw new \InvalidArgumentException('Invalid serialization format');
            }
    Severity: Minor
    Found in src/Algorithms/Collections/SerializableCollection.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 where has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function where($clause, $field, $relation, $data)
        {
            if (!is_string($field) || (strlen($field) <= 0)) {
                throw new \InvalidArgumentException('the field name must be a string');
            }
    Severity: Minor
    Found in src/Database/Runtime/SelectionCriteria.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function create($collection, $data)
        {
            //check for invalid database name
            if ((!is_string($collection)) || (strlen($collection) <= 0)) {
                throw new \InvalidArgumentException('The name of the table must be given as a non-empty string');
    Severity: Minor
    Found in src/Database/Adapters/Utils/PDODatabaseTrait.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 parseStandardConnectionQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseStandardConnectionQuery($connection)
        {
            /*
             * split the string into an array like
             *     0 => 'user:pass',
    Severity: Minor
    Found in src/Database/Adapters/Utils/ConnectionParser/ConnectionParserTrait.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function run(Router &$router)
        {
            //...generate the response
            try {
                $router->run($this->request, $this->response, [
    Severity: Minor
    Found in src/Core/Application.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($algorithm = Algorithm::BCRYPT)
        {
            //check if the hashing algorithm is supported
            if (strcmp($algorithm, Algorithm::BCRYPT) == 0) {
                $this->algorithm = $algorithm;
    Severity: Minor
    Found in src/Security/Hashing/Hasher.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