cosmocode/dokuwiki-plugin-issuelinks

View on GitHub

Showing 46 of 899 total issues

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

    public function handleAjax(Doku_Event $event, $param)
    {
        if ($event->data !== 'plugin_issuelinks') {
            return;
        }
Severity: Minor
Found in action/ajax.php - About 1 hr to fix

    Method deleteWebhook has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function deleteWebhook($project, $hookid)
        {
            // get old webhook id
            /** @var \helper_plugin_issuelinks_db $db */
            $db = plugin_load('helper', 'issuelinks_db');
    Severity: Minor
    Found in services/Jira.service.php - About 1 hr to fix

      Method createWebhook has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createWebhook($project)
          {
              // get old webhook id
              /** @var \helper_plugin_issuelinks_db $db */
              $db = plugin_load('helper', 'issuelinks_db');
      Severity: Minor
      Found in services/Jira.service.php - About 1 hr to fix

        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

            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

              Method deleteAllIssuePageRevisions has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function deleteAllIssuePageRevisions($page, $serviceName, $projectKey, $issueId, $isMergeRequest, $type)
              Severity: Minor
              Found in helper/db.php - About 45 mins to fix

                Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function __construct()
                    {
                        $serviceDir = __DIR__ . '/../services';
                        $filenames = scandir($serviceDir, SCANDIR_SORT_ASCENDING);
                        foreach ($filenames as $filename) {
                Severity: Minor
                Found in classes/ServiceProvider.php - About 45 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 test_plugin_conf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function test_plugin_conf()
                    {
                        $conf_file = __DIR__ . '/../conf/default.php';
                        if (file_exists($conf_file)) {
                            include($conf_file);
                Severity: Minor
                Found in _test/general.test.php - About 45 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 removeOldLinks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function removeOldLinks($serviceName, $projectKey, $issue_id, $isMergeRequest, $pages)
                Severity: Minor
                Found in helper/db.php - About 35 mins to fix

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

                      protected function makeHTTPRequest(\DokuHTTPClient $dokuHTTPClient, $url, $headers, array $data, $method)
                  Severity: Minor
                  Found in services/AbstractService.php - About 35 mins to fix

                    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

                      Avoid too many return statements within this method.
                      Open

                              return true;
                      Severity: Major
                      Found in services/Jira.service.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return false;
                        Severity: Major
                        Found in services/GitLab.service.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return false;
                          Severity: Major
                          Found in services/GitHub.service.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return true;
                            Severity: Major
                            Found in services/GitHub.service.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return true;
                              Severity: Major
                              Found in services/GitLab.service.php - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language