cosmocode/dokuwiki-plugin-issuelinks

View on GitHub

Showing 899 of 899 total issues

Method retrieveAllIssues has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function retrieveAllIssues($projectKey, &$startat = 0)
    {
        $perPage = 30;
        $page = ceil(($startat + 1) / $perPage);
        // FIXME: implent `since` parameter?
Severity: Minor
Found in services/GitHub.service.php - About 1 hr to fix

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

        public function getDB()
        {
            if (null === $this->db) {
                /** @var helper_plugin_sqlite $sqlite */
                $sqlite = plugin_load('helper', 'sqlite');
    Severity: Minor
    Found in helper/db.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 getListOfAllReposAndHooks has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getListOfAllReposAndHooks($organisation)
        {
            $endpoint = "/orgs/$organisation/repos";
            try {
                $repos = $this->makeGitHubGETRequest($endpoint);
    Severity: Minor
    Found in services/GitHub.service.php - About 1 hr to fix

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class util_plugin_issuelinks_test extends DokuWikiTest {
      Severity: Minor
      Found in _test/util.test.php by phpcodesniffer

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class admin_plugin_issuelinks_repoadmin extends DokuWiki_Admin_Plugin
      Severity: Minor
      Found in admin/repoadmin.php by phpcodesniffer

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class action_plugin_issuelinks_ajax extends DokuWiki_Action_Plugin
      Severity: Minor
      Found in action/ajax.php by phpcodesniffer

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class general_plugin_issuelinks_test extends DokuWikiTest
      Severity: Minor
      Found in _test/general.test.php by phpcodesniffer

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class syntax_plugin_issuelinks extends DokuWiki_Syntax_Plugin
      Severity: Minor
      Found in syntax.php by phpcodesniffer

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class linksyntax_plugin_issuelinks_test extends DokuWikiTest {

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class helper_plugin_issuelinks_db extends DokuWiki_Plugin
      Severity: Minor
      Found in helper/db.php by phpcodesniffer

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class helper_plugin_issuelinks_data extends DokuWiki_Plugin
      Severity: Minor
      Found in helper/data.php by phpcodesniffer

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class helper_plugin_issuelinks_util extends DokuWiki_Plugin
      Severity: Minor
      Found in helper/util.php by phpcodesniffer

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

          public function run()
          {
              /** @var \helper_plugin_issuelinks_util $util */
              $util = plugin_load('helper', 'issuelinks_util');
              if (!$util) {
      Severity: Minor
      Found in Webhook.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

      Method savePageRevIssues has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function savePageRevIssues($page, $rev, $serviceName, $project, $issue_id, $isMergeRequest, $type)
      Severity: Major
      Found in helper/db.php - About 50 mins to fix

        The class general_plugin_issuelinks_test is not named in CamelCase.
        Open

        class general_plugin_issuelinks_test extends DokuWikiTest
        {
        
            /**
             * Simple test to make sure the plugin.info.txt is in correct format
        Severity: Minor
        Found in _test/general.test.php by phpmd

        CamelCaseClassName

        Since: 0.2

        It is considered best practice to use the CamelCase notation to name classes.

        Example

        class class_name {
        }

        Source

        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

        The property $trans_prefix is not named in camelCase.
        Open

        class IssueLinksException extends \RuntimeException
        {
        
            protected $trans_prefix = 'Exception: ';
        
        
        Severity: Minor
        Found in classes/IssueLinksException.php by phpmd

        CamelCasePropertyName

        Since: 0.2

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

        Example

        class ClassName {
            protected $property_name;
        }

        Source

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

                global $ID;
        Severity: Minor
        Found in _test/handleIssueLinkSyntax.test.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 $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 $ID. Configured minimum length is 3.
        Open

                global $ID;
        Severity: Minor
        Found in syntax.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

        Severity
        Category
        Status
        Source
        Language