j84reginato/my-eval

View on GitHub

Showing 154 of 154 total issues

Function isUnary has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function isUnary(Node $node, ?Node $lastNode): bool
    {
        if (!$node instanceof InfixExpressionNode) {
            return false;
        }
Severity: Minor
Found in src/Parsing/Parser.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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function parse(string|Rational $value, bool $normalize = true): Rational
    {
        if ($value === '') {
            throw new SyntaxErrorException();
        }
Severity: Minor
Found in src/Extensions/Rational.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 compareTo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function compareTo(Node $other): bool
    {
        if (!($other instanceof static)) {
            return false;
        }
Severity: Minor
Found in src/Parsing/Nodes/Operator/AbstractExpressionNode.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 visitInfixExpressionNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitInfixExpressionNode(InfixExpressionNode $node): string
    {
        $left     = $node->getLeft();
        $operator = $node->operator;
        $right    = $node->getRight();
Severity: Minor
Found in src/Solving/LaTeXPrinter.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 populateNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function populateNode(AbstractOperatorNode $node): Node
    {
        if ($node instanceof FunctionNode) {
            throw new DelimeterMismatchException($node->operator);
        }
Severity: Minor
Found in src/Parsing/Parser.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 rpow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function rpow($a, $b)
    {
        if ($b->getDenominator() === 1) {
            $n = $b->getNumerator();
            if ($n >= 0) {
Severity: Minor
Found in src/Solving/RationalEvaluator.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 numericFactors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function numericFactors(Node $leftOperand, Node $rightOperand): ?Node
    {
        if ($this->isNumeric($rightOperand) && (float)$rightOperand->value === 0.0) {
            throw new DivisionByZeroException();
        }
Severity: Minor
Found in src/Parsing/Operations/Math/DivisionOperation.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 tan(deg2rad($inner));
Severity: Major
Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return sinh($inner);
    Severity: Major
    Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return cosh($inner);
      Severity: Major
      Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return $this->nodeFactory->multiplication($right->accept($this), $node);
        Severity: Major
        Found in src/Solving/Differentiator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return Complex::sinh($z);
          Severity: Major
          Found in src/Solving/ComplexEvaluator.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return Complex::div(Complex::log($z), M_LN10);
            Severity: Major
            Found in src/Solving/ComplexEvaluator.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return Complex::sqrt($z);
              Severity: Major
              Found in src/Solving/ComplexEvaluator.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return new Complex($z->arg(), 0);
                Severity: Major
                Found in src/Solving/ComplexEvaluator.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return asin($inner);
                  Severity: Major
                  Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return log10($inner);
                    Severity: Major
                    Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return "($text)";
                      Severity: Major
                      Found in src/Solving/ASCIIPrinter.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return "$leftValue$operator$rightValue";
                        Severity: Major
                        Found in src/Solving/LaTeXPrinter.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return "$prepend$text";
                          Severity: Major
                          Found in src/Solving/ASCIIPrinter.php - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language