phpmyadmin/phpmyadmin

View on GitHub
src/Error/ErrorReport.php

Summary

Maintainability
C
1 day
Test Coverage

Function getData has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function getData(string $exceptionType = 'js'): array
    {
        $relationParameters = $this->relation->getRelationParameters();
        // common params for both, php & js exceptions
        $report = [
Severity: Minor
Found in src/Error/ErrorReport.php - About 3 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 getData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getData(string $exceptionType = 'js'): array
    {
        $relationParameters = $this->relation->getRelationParameters();
        // common params for both, php & js exceptions
        $report = [
Severity: Major
Found in src/Error/ErrorReport.php - About 2 hrs to fix

    Function translateStacktrace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function translateStacktrace(array $stack): array
        {
            foreach ($stack as &$level) {
                foreach ($level['context'] as &$line) {
                    if (mb_strlen($line) <= 80) {
    Severity: Minor
    Found in src/Error/ErrorReport.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 sanitizeUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function sanitizeUrl(string $url): array
        {
            $components = parse_url($url);
    
            if (! is_array($components)) {
    Severity: Minor
    Found in src/Error/ErrorReport.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 $report;
    Severity: Major
    Found in src/Error/ErrorReport.php - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status