j84reginato/my-eval

View on GitHub

Showing 147 of 154 total issues

Method visitInfixExpressionNode has 36 lines of code (exceeds 25 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 1 hr to fix

    Method ifactor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function ifactor($n): array
        {
    
            // max_n = 2^31-1 = 2147483647
            $d       = 2;
    Severity: Minor
    Found in src/Solving/RationalEvaluator.php - About 1 hr to fix

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

          public static function factory(Token $token): Node
          {
              return match ($token->type) {
                  // Operands
                  TokenType::NATURAL_NUMBER,
      Severity: Minor
      Found in src/Parsing/Nodes/Node.php - About 1 hr to fix

        Method visitFunctionNode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function visitFunctionNode(FunctionNode $node): string
            {
                $functionName = $node->operator;
        
                $operand = $node->operand->accept($this);
        Severity: Minor
        Found in src/Solving/LaTeXPrinter.php - About 1 hr to fix

          Method parenthesize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function parenthesize(
                  ?Node $node,
                  InfixExpressionNode $cutoff,
                  string $prepend = '',
                  bool $conservative = false
          Severity: Minor
          Found in src/Solving/ASCIIPrinter.php - About 1 hr to fix

            Method fromFloat has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function fromFloat(float|string $float, float $tolerance = 1e-7): Rational
                {
                    if (is_string($float) && preg_match('~^-?\d+([,|.]\d+)?$~', $float)) {
                        $float = (float)str_replace(',', '.', $float);
                    }
            Severity: Minor
            Found in src/Extensions/Rational.php - About 1 hr to fix

              Method parse has 28 lines of code (exceeds 25 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 1 hr to fix

                Method compareTo has 28 lines of code (exceeds 25 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 1 hr to fix

                  Method rpow has 28 lines of code (exceeds 25 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 1 hr to fix

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

                        public function visitTernaryNode(TernaryExpressionNode $node): float
                        {
                            /** @var InfixExpressionNode|BooleanNode $condition */
                            $condition = $node->getCondition();
                    
                    
                    Severity: Minor
                    Found in src/Solving/LogicEvaluator.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 complexity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function complexity(): int
                        {
                            switch (\get_class($this)) {
                                case IntegerNode::class:
                                case VariableNode::class:
                    Severity: Minor
                    Found in src/Parsing/Nodes/Node.php - About 1 hr to fix

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

                          private function numericFactors(Node $leftOperand, Node $rightOperand): ?Node
                          {
                              if (
                                  ($this->isNumeric($leftOperand) && (float)$leftOperand->value === 0.0) ||
                                  ($this->isNumeric($rightOperand) && (float)$rightOperand->value === 0.0)
                      Severity: Minor
                      Found in src/Parsing/Operations/Math/MultiplicationOperation.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 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function visitInfixExpressionNode(InfixExpressionNode $node): Node
                          {
                              $left     = $node->getLeft();
                              $operator = $node->operator;
                              $right    = $node->getRight();
                      Severity: Minor
                      Found in src/Solving/Differentiator.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 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

                      Severity
                      Category
                      Status
                      Source
                      Language