cosmocode/dokuwiki-plugin-issuelinks

View on GitHub
classes/Issue.php

Summary

Maintainability
D
2 days
Test Coverage

File Issue.php has 467 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace dokuwiki\plugin\issuelinks\classes;

/**
Severity: Minor
Found in classes/Issue.php - About 7 hrs to fix

    Issue has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Issue extends \DokuWiki_Plugin implements \JsonSerializable
    {
    
        /** @var Issue[] */
        private static $instances = [];
    Severity: Minor
    Found in classes/Issue.php - About 6 hrs to fix

      The class Issue has an overall complexity of 92 which is very high. The configured complexity threshold is 50.
      Open

      class Issue extends \DokuWiki_Plugin implements \JsonSerializable
      {
      
          /** @var Issue[] */
          private static $instances = [];
      Severity: Minor
      Found in classes/Issue.php by phpmd

      Method buildTooltipHTML has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function buildTooltipHTML()
          {
              $html = '<aside class="issueTooltip">';
              $html .= "<h1 class=\"issueTitle\">{$this->getSummary()}</h1>";
              $html .= "<div class='assigneeAvatar waiting'></div>";
      Severity: Major
      Found in classes/Issue.php - About 2 hrs to fix

        Function buildTooltipHTML has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function buildTooltipHTML()
            {
                $html = '<aside class="issueTooltip">';
                $html .= "<h1 class=\"issueTitle\">{$this->getSummary()}</h1>";
                $html .= "<div class='assigneeAvatar waiting'></div>";
        Severity: Minor
        Found in classes/Issue.php - About 2 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

        The class Issue has 21 fields. Consider redesigning Issue to keep the number of fields under 15.
        Open

        class Issue extends \DokuWiki_Plugin implements \JsonSerializable
        {
        
            /** @var Issue[] */
            private static $instances = [];
        Severity: Minor
        Found in classes/Issue.php by phpmd

        TooManyFields

        Since: 0.1

        Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

        Example

        class Person {
           protected $one;
           private $two;
           private $three;
           [... many more fields ...]
        }

        Source https://phpmd.org/rules/codesize.html#toomanyfields

        Method getInstance has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $serviceName,
                $projectKey,
                $issueId,
                $isMergeRequest = false,
                $forcereload = false
        Severity: Minor
        Found in classes/Issue.php - About 35 mins to fix

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

              public function getAdditionalDataHTML()
              {
                  $this->getFromService();
                  $data = [];
                  if (!empty($this->assignee)) {
          Severity: Minor
          Found in classes/Issue.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

          The method buildTooltipHTML() has an NPath complexity of 324. The configured NPath complexity threshold is 200.
          Open

              public function buildTooltipHTML()
              {
                  $html = '<aside class="issueTooltip">';
                  $html .= "<h1 class=\"issueTitle\">{$this->getSummary()}</h1>";
                  $html .= "<div class='assigneeAvatar waiting'></div>";
          Severity: Minor
          Found in classes/Issue.php by phpmd

          NPathComplexity

          Since: 0.1

          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

          Example

          class Foo {
              function bar() {
                  // lots of complicated code
              }
          }

          Source https://phpmd.org/rules/codesize.html#npathcomplexity

          The method buildTooltipHTML() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
          Open

              public function buildTooltipHTML()
              {
                  $html = '<aside class="issueTooltip">';
                  $html .= "<h1 class=\"issueTitle\">{$this->getSummary()}</h1>";
                  $html .= "<div class='assigneeAvatar waiting'></div>";
          Severity: Minor
          Found in classes/Issue.php by phpmd

          CyclomaticComplexity

          Since: 0.1

          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

          Example

          // Cyclomatic Complexity = 11
          class Foo {
          1   public function example() {
          2       if ($a == $b) {
          3           if ($a1 == $b1) {
                          fiddle();
          4           } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                          fiddle();
                      }
          5       } elseif ($c == $d) {
          6           while ($c == $d) {
                          fiddle();
                      }
          7        } elseif ($e == $f) {
          8           for ($n = 0; $n < $h; $n++) {
                          fiddle();
                      }
                  } else {
                      switch ($z) {
          9               case 1:
                              fiddle();
                              break;
          10              case 2:
                              fiddle();
                              break;
          11              case 3:
                              fiddle();
                              break;
                          default:
                              fiddle();
                              break;
                      }
                  }
              }
          }

          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

          Class "Issue" has 45 methods, which is greater than 20 authorized. Split it into smaller classes.
          Open

          class Issue extends \DokuWiki_Plugin implements \JsonSerializable
          Severity: Major
          Found in classes/Issue.php by sonar-php

          A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

          Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
          Open

              public function buildTooltipHTML()
          Severity: Critical
          Found in classes/Issue.php by sonar-php

          Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

          See

          The method getInstance has a boolean flag argument $forcereload, which is a certain sign of a Single Responsibility Principle violation.
          Open

                  $forcereload = false
          Severity: Minor
          Found in classes/Issue.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method getInstance has a boolean flag argument $isMergeRequest, which is a certain sign of a Single Responsibility Principle violation.
          Open

                  $isMergeRequest = false,
          Severity: Minor
          Found in classes/Issue.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method getKey has a boolean flag argument $annotateMergeRequest, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getKey($annotateMergeRequest = false)
          Severity: Minor
          Found in classes/Issue.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method isValid has a boolean flag argument $recheck, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function isValid($recheck = false)
          Severity: Minor
          Found in classes/Issue.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          Missing class import via use statement (line '45', column '23').
          Open

                      throw new \InvalidArgumentException('Empty value passed to Issue constructor');
          Severity: Minor
          Found in classes/Issue.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          The method getIssueLinkHTML has a boolean flag argument $addSummary, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getIssueLinkHTML($addSummary = false)
          Severity: Minor
          Found in classes/Issue.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          Avoid using static access to class 'dokuwiki\plugin\issuelinks\classes\ServiceProvider' in method 'getIssueLinkHTML'.
          Open

                  $serviceProvider = ServiceProvider::getInstance();
          Severity: Minor
          Found in classes/Issue.php by phpmd

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          The method calculateColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          $cl = pow(($c + 0.055) / 1.055, 2.4);
                      }
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ElseExpression

          Since: 1.4.0

          An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($flag) {
                      // one branch
                  } else {
                      // another branch
                  }
              }
          }

          Source https://phpmd.org/rules/cleancode.html#elseexpression

          Avoid using static access to class 'dokuwiki\plugin\issuelinks\classes\ServiceProvider' in method 'getFromService'.
          Open

                  $serviceProvider = ServiceProvider::getInstance();
          Severity: Minor
          Found in classes/Issue.php by phpmd

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class 'dokuwiki\plugin\issuelinks\classes\ServiceProvider' in method 'getIssueURL'.
          Open

                  $serviceProvider = ServiceProvider::getInstance();
          Severity: Minor
          Found in classes/Issue.php by phpmd

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class 'dokuwiki\plugin\issuelinks\classes\ServiceProvider' in method 'isValid'.
          Open

                      $serviceProvider = ServiceProvider::getInstance();
          Severity: Minor
          Found in classes/Issue.php by phpmd

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          The method buildTooltipHTML uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                  } else {
                      $html .= $util->getLang('no issue description');
                  }
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ElseExpression

          Since: 1.4.0

          An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($flag) {
                      // one branch
                  } else {
                      // another branch
                  }
              }
          }

          Source https://phpmd.org/rules/cleancode.html#elseexpression

          Rename "$description" which has the same name as the field declared at line 20.
          Open

                  $description = $this->getDescription();
          Severity: Major
          Found in classes/Issue.php by sonar-php

          Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

          Noncompliant Code Example

          class Foo {
            public $myField;
          
            public function doSomething() {
              $myField = 0;
              ...
            }
          }
          

          See

          Rename "$status" which has the same name as the field declared at line 21.
          Open

                  $status = cleanID($this->getStatus());
          Severity: Major
          Found in classes/Issue.php by sonar-php

          Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

          Noncompliant Code Example

          class Foo {
            public $myField;
          
            public function doSomething() {
              $myField = 0;
              ...
            }
          }
          

          See

          Define a constant instead of duplicating this literal "status" 3 times.
          Open

                  $this->status = $issue['status'];
          Severity: Critical
          Found in classes/Issue.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Rename "$labels" which has the same name as the field declared at line 24.
          Open

                      $labels = $this->getLabels();
          Severity: Major
          Found in classes/Issue.php by sonar-php

          Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

          Noncompliant Code Example

          class Foo {
            public $myField;
          
            public function doSomething() {
              $myField = 0;
              ...
            }
          }
          

          See

          Rename "$labels" which has the same name as the field declared at line 24.
          Open

                  $labels = $this->getLabels();
          Severity: Major
          Found in classes/Issue.php by sonar-php

          Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

          Noncompliant Code Example

          class Foo {
            public $myField;
          
            public function doSomething() {
              $myField = 0;
              ...
            }
          }
          

          See

          Define a constant instead of duplicating this literal "helper" 4 times.
          Open

                  $db = plugin_load('helper', 'issuelinks_db');
          Severity: Critical
          Found in classes/Issue.php by sonar-php

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Remove this commented out code.
          Open

          //        $this->getFromDB();
          Severity: Major
          Found in classes/Issue.php by sonar-php

          Programmers should not comment out code as it bloats programs and reduces readability.

          Unused code should be deleted and can be retrieved from source control history if required.

          See

          • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
          • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
          • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
          • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

          Rename "$components" which has the same name as the field declared at line 23.
          Open

                  $components = $this->getComponents();
          Severity: Major
          Found in classes/Issue.php by sonar-php

          Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

          Noncompliant Code Example

          class Foo {
            public $myField;
          
            public function doSomething() {
              $myField = 0;
              ...
            }
          }
          

          See

          Call to undeclared function \plugin_load()
          Open

                  $util = plugin_load('helper', 'issuelinks_util');
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared function \cleanID()
          Open

                  $status = cleanID($this->getStatus());
          Severity: Critical
          Found in classes/Issue.php by phan

          Reference to undeclared constant \DOKU_URL
          Open

                  return DOKU_URL . '/lib/plugins/issuelinks/images/' . $typeIcon[cleanID($this->type)];
          Severity: Minor
          Found in classes/Issue.php by phan

          Call to undeclared function \cleanID()
          Open

                  $classes = 'issuelink ' . cleanID($this->getType()) . ($this->isMergeRequest ? ' mergerequest' : '');
          Severity: Critical
          Found in classes/Issue.php by phan

          Invalid offset "name" of array type array{}
          Open

                      $data['avatarHTML'] = "<img src=\"{$this->assignee['avatarURL']}\" alt=\"{$this->assignee['name']}\">";
          Severity: Minor
          Found in classes/Issue.php by phan

          Call to undeclared function \plugin_load()
          Open

                  $db = plugin_load('helper', 'issuelinks_db');
          Severity: Critical
          Found in classes/Issue.php by phan

          Suspicious type null of a variable or expression used to build a string. (Expected type to be able to cast to a string)
          Open

                      $data['avatarHTML'] = "<img src=\"{$this->assignee['avatarURL']}\" alt=\"{$this->assignee['name']}\">";
          Severity: Minor
          Found in classes/Issue.php by phan

          Class extends undeclared class \DokuWiki_Plugin
          Open

          class Issue extends \DokuWiki_Plugin implements \JsonSerializable
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared function \cleanID()
          Open

                  if (!isset($typeIcon[cleanID($this->type)])) {
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared function \html_wikilink()
          Open

                          $html .= html_wikilink($linkingPage['page']);
          Severity: Critical
          Found in classes/Issue.php by phan

          Argument 3 (issueId) is string but \dokuwiki\plugin\issuelinks\classes\Issue::__construct() takes int defined at /code/classes/Issue.php:42
          Open

                      self::$instances[$issueHash] = new Issue($serviceName, $projectKey, $issueId, $isMergeRequest);
          Severity: Minor
          Found in classes/Issue.php by phan

          Call to undeclared function \cleanID()
          Open

                  return DOKU_URL . '/lib/plugins/issuelinks/images/' . $typeIcon[cleanID($this->type)];
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared function \hsc()
          Open

                          $html .= hsc($lines[$i]) . "\n";
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared function \buildAttributes()
          Open

                  return "<a href=\"$url\" " . buildAttributes($attributes, true) . '>' . $this->getTypeHTML() . "$name</a>";
          Severity: Critical
          Found in classes/Issue.php by phan

          Reference to undeclared property \dokuwiki\plugin\issuelinks\classes\Issue->pmService
          Open

                  $sep = $this->pmService->getProjectIssueSeparator($this->isMergeRequest);
          Severity: Minor
          Found in classes/Issue.php by phan

          Call to undeclared function \plugin_load()
          Open

                  $util = plugin_load('helper', 'issuelinks_util');
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared method \dokuwiki\plugin\issuelinks\classes\Issue::loadHelper
          Open

                  $data = $this->loadHelper('issuelinks_data');
          Severity: Critical
          Found in classes/Issue.php by phan

          Suspicious type bool|false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
          Open

                  $issueHash = $serviceName . $projectKey . $issueId . '!' . $isMergeRequest;
          Severity: Minor
          Found in classes/Issue.php by phan

          Call to undeclared function \plugin_load()
          Open

                  $db = plugin_load('helper', 'issuelinks_db');
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared function \cleanID()
          Open

                  return "<span class='mm__status " . cleanID($status) . "'>$status</span>";
          Severity: Critical
          Found in classes/Issue.php by phan

          Call to undeclared function \inlineSVG()
          Open

                      return inlineSVG(__DIR__ . '/../images/mdi-source-pull.svg');
          Severity: Critical
          Found in classes/Issue.php by phan

          Reference to undeclared constant \DOKU_URL
          Open

                      return DOKU_URL . '/lib/plugins/issuelinks/images/mdi-help-circle-outline.png';
          Severity: Minor
          Found in classes/Issue.php by phan

          Invalid offset "avatarURL" of array type array{}
          Open

                      $data['avatarHTML'] = "<img src=\"{$this->assignee['avatarURL']}\" alt=\"{$this->assignee['name']}\">";
          Severity: Minor
          Found in classes/Issue.php by phan

          Avoid variables with short names like $r. Configured minimum length is 3.
          Open

                  list($r, $g, $b) = array_map(function ($color8bit) {
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $b. Configured minimum length is 3.
          Open

                  list($r, $g, $b) = array_map(function ($color8bit) {
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $cl. Configured minimum length is 3.
          Open

                          $cl = $c / 12.92;
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $db. Configured minimum length is 3.
          Open

                  $db = plugin_load('helper', 'issuelinks_db');
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $db. Configured minimum length is 3.
          Open

                  $db = plugin_load('helper', 'issuelinks_db');
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $g. Configured minimum length is 3.
          Open

                  list($r, $g, $b) = array_map(function ($color8bit) {
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          The parameter $avatar_url is not named in camelCase.
          Open

              public function setAssignee($name, $avatar_url)
              {
                  $this->assignee['name'] = $name;
                  $this->assignee['avatarURL'] = $avatar_url;
              }
          Severity: Minor
          Found in classes/Issue.php by phpmd

          CamelCaseParameterName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name parameters.

          Example

          class ClassName {
              public function doSomething($user_name) {
              }
          }

          Source

          Avoid variables with short names like $a. Configured minimum length is 3.
          Open

                              $a = "<a href=\"$mr[url]\">$mr[summary]</a>";
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $c. Configured minimum length is 3.
          Open

                      $c = $color8bit / 255;
          Severity: Minor
          Found in classes/Issue.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          The 'getFromDB()' method which returns a boolean should be named 'is...()' or 'has...()'
          Open

              public function getFromDB()
              {
                  /** @var \helper_plugin_issuelinks_db $db */
                  $db = plugin_load('helper', 'issuelinks_db');
                  $issue = $db->loadIssue($this->serviceID, $this->projectId, $this->issueId, $this->isMergeRequest);
          Severity: Minor
          Found in classes/Issue.php by phpmd

          BooleanGetMethodName

          Since: 0.2

          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

          Example

          class Foo {
              /**
               * @return boolean
               */
              public function getFoo() {} // bad
              /**
               * @return bool
               */
              public function isFoo(); // ok
              /**
               * @return boolean
               */
              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
          }

          Source https://phpmd.org/rules/naming.html#booleangetmethodname

          The variable $avatar_url is not named in camelCase.
          Open

              public function setAssignee($name, $avatar_url)
              {
                  $this->assignee['name'] = $name;
                  $this->assignee['avatarURL'] = $avatar_url;
              }
          Severity: Minor
          Found in classes/Issue.php by phpmd

          CamelCaseVariableName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name variables.

          Example

          class ClassName {
              public function doSomething() {
                  $data_module = new DataModule();
              }
          }

          Source

          There are no issues that match your filters.

          Category
          Status