vairogs/vairogs

View on GitHub

Showing 98 of 98 total issues

Method distanceBetweenPoints has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        float $latitude1,
        float $longitude1,
        float $latitude2,
        float $longitude2,
        bool $km = true,
Severity: Minor
Found in src/Vairogs/Component/Functions/Number/_DistanceBetweenPoints.php - About 45 mins to fix

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

    <?php declare(strict_types = 1);
    
    use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
    
    return static function (
    Severity: Major
    Found in src/Vairogs/Component/Mapper/Resources/config/services.php and 3 other locations - About 35 mins to fix
    src/Vairogs/Component/Cache/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/DoctrineTools/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/Settings/Resources/config/services.php on lines 1..16

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

    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 declare(strict_types = 1);
    
    use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
    
    return static function (
    Severity: Major
    Found in src/Vairogs/Component/Cache/Resources/config/services.php and 3 other locations - About 35 mins to fix
    src/Vairogs/Component/DoctrineTools/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/Mapper/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/Settings/Resources/config/services.php on lines 1..16

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

    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 declare(strict_types = 1);
    
    use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
    
    return static function (
    src/Vairogs/Component/Cache/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/Mapper/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/Settings/Resources/config/services.php on lines 1..16

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

    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 declare(strict_types = 1);
    
    use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
    
    return static function (
    Severity: Major
    Found in src/Vairogs/Component/Settings/Resources/config/services.php and 3 other locations - About 35 mins to fix
    src/Vairogs/Component/Cache/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/DoctrineTools/Resources/config/services.php on lines 1..16
    src/Vairogs/Component/Mapper/Resources/config/services.php on lines 1..16

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

    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

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

        public function bubbleSort(
            array &$array,
        ): void {
            $count = count(value: $array);
            for ($foo = 0; $foo < $count; $foo++) {
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Sort/_BubbleSort.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 merge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function merge(
            array $left,
            array $right,
        ): array {
            $result = [];
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Sort/_MergeSort.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 compare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function compare(
            string $first,
            string $second,
            string $haystack = Text::EN_LOWERCASE,
        ): int {
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Text/_Compare.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

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

    <?php declare(strict_types = 1);
    
    namespace Vairogs\Component\DoctrineTools\ORM\Traits;
    
    use Doctrine\ORM\Mapping as ORM;
    Severity: Minor
    Found in src/Vairogs/Component/DoctrineTools/ORM/Traits/__Uuid.php and 1 other location - About 30 mins to fix
    src/Vairogs/Component/DoctrineTools/ORM/Traits/__Ulid.php on lines 1..22

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

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

    <?php declare(strict_types = 1);
    
    namespace Vairogs\Component\DoctrineTools\ORM\Traits;
    
    use Doctrine\ORM\Mapping as ORM;
    Severity: Minor
    Found in src/Vairogs/Component/DoctrineTools/ORM/Traits/__Ulid.php and 1 other location - About 30 mins to fix
    src/Vairogs/Component/DoctrineTools/ORM/Traits/__Uuid.php on lines 1..22

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

    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

    The method isInstalled has a boolean flag argument $incDevReq, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $incDevReq = false,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Remove error control operator '@' on line 18.
    Open

        public function mkdir(
            string $dir,
        ): bool {
            if (!is_dir(filename: $dir)) {
                @mkdir(directory: $dir, recursive: true);

    ErrorControlOperator

    Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

    Example

    function foo($filePath) {
        $file = @fopen($filPath); // hides exceptions
        $key = @$array[$notExistingKey]; // assigns null to $key
    }

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

    The method remoteIp has a boolean flag argument $trust, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $trust = false,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method isEmpty has a boolean flag argument $result, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $result = true,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method isPrime has a boolean flag argument $override, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $override = false,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method definition has a boolean flag argument $isStatic, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function definition(string $class, string $name, bool $isStatic = false): array

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method unique has a boolean flag argument $keepKeys, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $keepKeys = false,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method validateIPAddress has a boolean flag argument $deny, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $deny = true,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method arrayValuesFiltered has a boolean flag argument $start, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $start = true,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method value has a boolean flag argument $throw, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $throw = true,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Severity
    Category
    Status
    Source
    Language