goodot/fuzzy-dm

View on GitHub

Showing 12 of 12 total issues

Function call has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    function call($x)
    {
        $x = (float)$x;
        $a = (float)$this->a;
        $b = (float)$this->b;
Severity: Minor
Found in src/membership/polygon/Trapmf.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 aggregate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private function aggregate($item, $features, $aggregation_function)
    {
        if (!$item instanceof Item)
            throw new \Exception("item should be Item");

Severity: Minor
Found in src/Analyzer.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

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

    static function get_aggregation_function_by_key($key)
    {
        $aggregation_functions = array("arithmetic_mean", "geometric_mean",
            "harmonic_mean", "weighted_arithmetic_mean", "weighted_geometric_mean",
            "weighted_harmonic_mean");
Severity: Minor
Found in src/aggregation/Tools.php - About 1 hr to fix

    Function call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        function call($x)
        {
            $x = (float)$x;
            $a = (float)$this->a;
            $b = (float)$this->b;
    Severity: Minor
    Found in src/membership/polygon/Trimf.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 get_aggregation_function_by_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        static function get_aggregation_function_by_key($key)
        {
            $aggregation_functions = array("arithmetic_mean", "geometric_mean",
                "harmonic_mean", "weighted_arithmetic_mean", "weighted_geometric_mean",
                "weighted_harmonic_mean");
    Severity: Minor
    Found in src/aggregation/Tools.php - About 55 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        function __construct($features, $items, $aggregation_function)
        {
            foreach ($features as $feature) {
                if (!$feature instanceof Feature)
                    throw new \Exception("feature should be Feature");
    Severity: Minor
    Found in src/Analyzer.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 suggest_best has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        function suggest_best()
        {
            $results = $this->results;
            if ($results != NULL) {
                $best = $results[0];
    Severity: Minor
    Found in src/Analyzer.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

    Avoid too many return statements within this method.
    Open

                        return new WeightedHarmonicMean();
    Severity: Major
    Found in src/aggregation/Tools.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return new ArithmeticMean();
      Severity: Major
      Found in src/aggregation/Tools.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return 0;
        Severity: Major
        Found in src/membership/polygon/Trapmf.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return new WeightedGeometricMean();
          Severity: Major
          Found in src/aggregation/Tools.php - About 30 mins to fix

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

                function top($top)
                {
                    $this->working_results = $this->results;
                    $top_results = array();
            
            
            Severity: Minor
            Found in src/Analyzer.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