j84reginato/my-eval

View on GitHub

Showing 154 of 154 total issues

Avoid too many return statements within this method.
Open

                return 1 / $tan_inner;
Severity: Major
Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

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

      Avoid too many return statements within this method.
      Open

                      return exp($logGamma);
      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(
                                new FloatNode($exponent->value),
                                $this->nodeFactory->multiplication($fpow, $base->accept($this))
                            );
        Severity: Major
        Found in src/Solving/Differentiator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

                            return '\frac{' . $left->accept($this) . '}{' . $right->accept($this) . '}';
            Severity: Major
            Found in src/Solving/LaTeXPrinter.php - About 30 mins to fix

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

                  public function visitFunctionNode(FunctionNode $node): float|int
                  {
                      if ($node->operand === null) {
                          throw new NullOperandException();
                      }
              Severity: Minor
              Found in src/Solving/StdMathEvaluator.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 visitFactorialNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function visitFactorialNode(FunctionNode $node): string
                  {
                      $functionName = $node->operator;
                      $operand      = $node->operand;
                      $op           = $operand->accept($this);
              Severity: Minor
              Found in src/Solving/ASCIIPrinter.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 visitInfixExpressionNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

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

                  protected function handleCloseParenthesis(): void
                  {
                      // Flag, checking for mismatching parentheses.
                      $clean = false;
              
              
              Severity: Minor
              Found in src/Parsing/Parser.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 visitFunctionNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function visitFunctionNode(FunctionNode $node): RationalNode
                  {
                      if ($node->operand === null) {
                          throw new NullOperandException();
                      }
              Severity: Minor
              Found in src/Solving/RationalEvaluator.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 handleInfixOperator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function handleInfixOperator(InfixExpressionNode $node, Token $token, ?Node $lastNode): void
                  {
                      // Check for unary minus and unary plus.
                      if ($this->isUnary($node, $lastNode)) {
                          // Unary +, just ignore it.
              Severity: Minor
              Found in src/Parsing/Parser.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 numericTerms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function numericTerms(Node $leftOperand, Node $rightOperand): ?Node
                  {
                      if ($this->isNumeric($leftOperand) && (float)$leftOperand->value === 0.0) {
                          return $rightOperand;
                      }
              Severity: Minor
              Found in src/Parsing/Operations/Math/AdditionOperation.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 numericExponent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function numericExponent(Node $leftOperand, Node $rightOperand): ?Node
                  {
                      // 0^0 throws an exception
                      if (
                          $this->isNumeric($leftOperand) &&
              Severity: Minor
              Found in src/Parsing/Operations/Math/ExponentiationOperation.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