nishimura/laiz-monad

View on GitHub

Showing 8 of 13 total issues

Function curry has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public static function curry(callable $f)
    {
        $ref = self::getReflection($f);
        $count = $ref->getNumberOfParameters();

Severity: Minor
Found in src/Laiz/Func/CurryTrait.php - About 2 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

Method curry has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function curry(callable $f)
    {
        $ref = self::getReflection($f);
        $count = $ref->getNumberOfParameters();

Severity: Minor
Found in src/Laiz/Func/CurryTrait.php - About 1 hr to fix

    Function __invoke has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __invoke($a)
        {
            if ($this->value instanceof Curry){
                $count = 1;
            }else if (is_object($this->value) && is_callable($this->value)){
    Severity: Minor
    Found in src/Laiz/Func/CurryTrait.php - About 1 hr 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 aor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function aor(...$args){
        $f = function($m1, $m2){
            if ($m1 instanceof Any &&
                !($m2 instanceof Any))
                $m1 = $m1->cast($m2);
    Severity: Minor
    Found in src/Laiz/Func/Alternative.php - About 45 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 mappend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function mappend(...$args) {
        $f = function($m1, $m2){
            if ($m1 instanceof Any &&
                !($m2 instanceof Any))
                $m1 = $m1->cast($m2);
    Severity: Minor
    Found in src/Laiz/Func/Monoid.php - About 45 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 mplus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function mplus(...$args) {
        $f = function($m1, $m2){
            if ($m1 instanceof Any &&
                !($m2 instanceof Any))
                $m1 = $m1->cast($m2);
    Severity: Minor
    Found in src/Laiz/Func/MonadPlus.php - About 45 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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function load($name = null)
        {
            static $loaded;
    
            if ($loaded)
    Severity: Minor
    Found in src/Laiz/Func/Loader.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 getReflection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function getReflection(callable $f)
        {
            if (is_array($f)){
                return new \ReflectionMethod($f[0], $f[1]);
            }else if (is_string($f) &&
    Severity: Minor
    Found in src/Laiz/Func/CurryTrait.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