cosmocode/dokuwiki-plugin-issuelinks

View on GitHub
services/Jira.service.php

Summary

Maintainability
C
1 day
Test Coverage

File Jira.service.php has 319 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Created by IntelliJ IDEA.
 * User: michael
 * Date: 4/16/18
Severity: Minor
Found in services/Jira.service.php - About 3 hrs to fix

    Jira has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Jira extends AbstractService
    {
    
        const SYNTAX = 'jira';
        const DISPLAY_NAME = 'Jira';
    Severity: Minor
    Found in services/Jira.service.php - About 2 hrs 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

          Avoid too many return statements within this method.
          Open

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

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

            class Jira extends AbstractService
            Severity: Major
            Found in services/Jira.service.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.

            Reduce the number of returns of this function 5, down to the maximum allowed 3.
            Open

                public function isConfigured()
            Severity: Major
            Found in services/Jira.service.php by sonar-php

            Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

            Noncompliant Code Example

            With the default threshold of 3:

            function myFunction(){ // Noncompliant as there are 4 return statements
              if (condition1) {
                return true;
              } else {
                if (condition2) {
                  return false;
                } else {
                  return true;
                }
              }
              return false;
            }
            

            Missing class import via use statement (line '33', column '37').
            Open

                    $this->dokuHTTPClient = new \DokuHTTPClient();
            Severity: Minor
            Found in services/Jira.service.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

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

                    $issue = Issue::getInstance('jira', $projectKey, $issueNumber, false);
            Severity: Minor
            Found in services/Jira.service.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\Issue' in method 'retrieveAllIssues'.
            Open

                            $issue = Issue::getInstance('jira', $projectKey, $issueNumber, false);
            Severity: Minor
            Found in services/Jira.service.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\Issue' in method 'handleWebhook'.
            Open

                    $issue = Issue::getInstance('jira', $projectKey, $issueId, false);
            Severity: Minor
            Found in services/Jira.service.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

            Take the required action to fix the issue indicated by this "FIXME" comment.
            Open

                    // FIXME: check and handle these fields:
            Severity: Major
            Found in services/Jira.service.php by sonar-php

            FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

            Sometimes the developer will not have the time or will simply forget to get back to that tag.

            This rule is meant to track those tags and to ensure that they do not go unnoticed.

            Noncompliant Code Example

            function divide($numerator, $denominator) {
              return $numerator / $denominator;              // FIXME denominator value might be  0
            }
            

            See

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

                    $issue->setStatus($issueData['fields']['status']['name']);
            Severity: Critical
            Found in services/Jira.service.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.

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

                    $jiraUser = $db->getKeyValue('jira_user');
            Severity: Critical
            Found in services/Jira.service.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.

            Define a constant instead of duplicating this literal "fields" 13 times.
            Open

                    $issue->setSummary($issueData['fields']['summary']);
            Severity: Critical
            Found in services/Jira.service.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.

            Define a constant instead of duplicating this literal "jira_url" 5 times.
            Open

                    $jiraUrl = $db->getKeyValue('jira_url');
            Severity: Critical
            Found in services/Jira.service.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.

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

                    $authToken = $db->getKeyValue('jira_token');
            Severity: Critical
            Found in services/Jira.service.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

            //        $jqlQuery = urlencode("project=$projectKey ORDER BY updated DESC");
            Severity: Major
            Found in services/Jira.service.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"

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

                    $issue->setDescription($issueData['fields']['description']);
            Severity: Critical
            Found in services/Jira.service.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.

            Define a constant instead of duplicating this literal "jira:issue_updated" 3 times.
            Open

                            'jira:issue_updated',
            Severity: Critical
            Found in services/Jira.service.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.

            Take the required action to fix the issue indicated by this "FIXME" comment.
            Open

                    // FIXME: somehow validate that we are allowed to retrieve that issue
            Severity: Major
            Found in services/Jira.service.php by sonar-php

            FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

            Sometimes the developer will not have the time or will simply forget to get back to that tag.

            This rule is meant to track those tags and to ensure that they do not go unnoticed.

            Noncompliant Code Example

            function divide($numerator, $denominator) {
              return $numerator / $denominator;              // FIXME denominator value might be  0
            }
            

            See

            Define a constant instead of duplicating this literal "issuelinks_db" 8 times.
            Open

                    $db = plugin_load('helper', 'issuelinks_db');
            Severity: Critical
            Found in services/Jira.service.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.

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

                    $db = plugin_load('helper', 'issuelinks_db');
            Severity: Critical
            Found in services/Jira.service.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.

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

                        'name' => 'dokuwiki plugin issuelinks for Wiki: ' . $conf['title'],
            Severity: Critical
            Found in services/Jira.service.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.

            Take the required action to fix the issue indicated by this "FIXME" comment.
            Open

                // FIXME should this be rather protected?
            Severity: Major
            Found in services/Jira.service.php by sonar-php

            FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

            Sometimes the developer will not have the time or will simply forget to get back to that tag.

            This rule is meant to track those tags and to ensure that they do not go unnoticed.

            Noncompliant Code Example

            function divide($numerator, $denominator) {
              return $numerator / $denominator;              // FIXME denominator value might be  0
            }
            

            See

            Remove this commented out code.
            Open

            //            $user = $this->makeJiraRequest('/rest/api/2/user', [], 'GET');
            Severity: Major
            Found in services/Jira.service.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"

            Define a constant instead of duplicating this literal "repository_id" 7 times.
            Open

                    $allowedRepos = explode(',', $webhooks[0]['repository_id']);
            Severity: Critical
            Found in services/Jira.service.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

            //        $issue->setParent($issueData['fields']['parent']['key']);
            Severity: Major
            Found in services/Jira.service.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 "$token" which has the same name as the field declared at line 25.
            Open

                    $token = $INPUT->str('jira_token');
            Severity: Major
            Found in services/Jira.service.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 "/rest/webhooks/1.0/webhook" 3 times.
            Open

                        $this->makeJiraRequest('/rest/webhooks/1.0/webhook', [], 'GET');
            Severity: Critical
            Found in services/Jira.service.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.

            Define a constant instead of duplicating this literal "dokuwiki plugin issuelinks for Wiki: " 4 times.
            Open

                        'name' => 'dokuwiki plugin issuelinks for Wiki: ' . $conf['title'],
            Severity: Critical
            Found in services/Jira.service.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.

            Define a constant instead of duplicating this literal "jira:issue_created" 3 times.
            Open

                            'jira:issue_created',
            Severity: Critical
            Found in services/Jira.service.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.

            Avoid unused parameters such as '$isMergeRequest'.
            Open

                public static function getProjectIssueSeparator($isMergeRequest)
            Severity: Minor
            Found in services/Jira.service.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused parameters such as '$hookid'.
            Open

                public function deleteWebhook($project, $hookid)
            Severity: Minor
            Found in services/Jira.service.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused parameters such as '$isMergeRequest'.
            Open

                public function getIssueURL($projectId, $issueId, $isMergeRequest)
            Severity: Minor
            Found in services/Jira.service.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused parameters such as '$organisation'.
            Open

                public function getListOfAllReposAndHooks($organisation)
            Severity: Minor
            Found in services/Jira.service.php by phpmd

            UnusedFormalParameter

            Since: 0.2

            Avoid passing parameters to methods or constructors and then not using those parameters.

            Example

            class Foo
            {
                private function bar($howdy)
                {
                    // $howdy is not used
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

            Avoid unused local variables such as '$issueId'.
            Open

                    list($projectKey, $issueId) = explode('-', $data['issue']['key']);
            Severity: Minor
            Found in services/Jira.service.php by phpmd

            UnusedLocalVariable

            Since: 0.2

            Detects when a local variable is declared and/or assigned, but not used.

            Example

            class Foo {
                public function doSomething()
                {
                    $i = 5; // Unused
                }
            }

            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

            Call to undeclared function \plugin_load()
            Open

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

            Call to undeclared function \plugin_load()
            Open

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

            Call to undeclared function \plugin_load()
            Open

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

            Assigning 1 to property but \dokuwiki\plugin\issuelinks\classes\Repository->hookID is string
            Open

                            $repo->hookID = 1;
            Severity: Minor
            Found in services/Jira.service.php by phan

            Call to undeclared function \plugin_load()
            Open

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

            Call to undeclared function \blank()
            Open

                    $valid &= !blank($type);
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to undeclared function \hsc()
            Open

                        $this->configError = 'The Jira authentication failed with message: ' . hsc($e->getMessage());
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to undeclared function \blank()
            Open

                    $valid &= !blank($status);
            Severity: Critical
            Found in services/Jira.service.php by phan

            Returning type int but isIssueValid() is declared to return bool
            Open

                    return $valid;
            Severity: Minor
            Found in services/Jira.service.php by phan

            Returning type null but parseIssueSyntax() is declared to return \dokuwiki\plugin\issuelinks\classes\Issue
            Open

                        return null;
            Severity: Minor
            Found in services/Jira.service.php by phan

            Call to undeclared function \plugin_load()
            Open

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

            Parameter $configForm has undeclared type \dokuwiki\Form\Form
            Open

                public function hydrateConfigForm(Form $configForm)
            Severity: Minor
            Found in services/Jira.service.php by phan

            Call to undeclared function \plugin_load()
            Open

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

            Call to method addPasswordInput from undeclared class \dokuwiki\Form\Form
            Open

                    $configForm->addPasswordInput('jira_token', 'Jira AccessToken')->useInput(false);
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to undeclared function \plugin_load()
            Open

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

            Call to undeclared function \hsc()
            Open

                    return hsc($this->authUser);
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to undeclared function \plugin_load()
            Open

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

            Call to undeclared function \blank()
            Open

                    $valid = !blank($summary);
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to method addHTML from undeclared class \dokuwiki\Form\Form
            Open

                    $configForm->addHTML("<p>{$this->configError} $message</p>");
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to method addTextInput from undeclared class \dokuwiki\Form\Form
            Open

                    $configForm->addTextInput('jira_user', 'Jira User')
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to method __construct from undeclared class \DokuHTTPClient
            Open

                    $this->dokuHTTPClient = new \DokuHTTPClient();
            Severity: Critical
            Found in services/Jira.service.php by phan

            Call to method addTextInput from undeclared class \dokuwiki\Form\Form
            Open

                    $configForm->addTextInput('jira_url', 'Jira Url')->val($this->jiraUrl);
            Severity: Critical
            Found in services/Jira.service.php by phan

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    if (!empty($webhooks)) {
                        $oldID = $webhooks[0]['id'];
                        // get current webhook projects
                        $projects = explode(',', $webhooks[0]['repository_id']);
                        // remove old webhook
            Severity: Minor
            Found in services/Jira.service.php and 1 other location - About 35 mins to fix
            services/Jira.service.php on lines 354..362

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                public static function isIssueValid(Issue $issue)
                {
                    $summary = $issue->getSummary();
                    $valid = !blank($summary);
                    $status = $issue->getStatus();
            Severity: Minor
            Found in services/Jira.service.php and 1 other location - About 35 mins to fix
            services/GitHub.service.php on lines 46..55

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    if (!empty($webhooks)) {
                        $oldID = $webhooks[0]['id'];
                        // get current webhook projects
                        $projects = explode(',', $webhooks[0]['repository_id']);
                        // remove old webhook
            Severity: Minor
            Found in services/Jira.service.php and 1 other location - About 35 mins to fix
            services/Jira.service.php on lines 408..416

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    $db = plugin_load('helper', 'issuelinks_db');
            Severity: Minor
            Found in services/Jira.service.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 services/Jira.service.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 services/Jira.service.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 services/Jira.service.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 services/Jira.service.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 services/Jira.service.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 services/Jira.service.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 services/Jira.service.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 variable $jira_url is not named in camelCase.
            Open

                public function getRepoPageText()
                {
                    /** @var \helper_plugin_issuelinks_db $db */
                    $db = plugin_load('helper', 'issuelinks_db');
                    $jira_url = $db->getKeyValue('jira_url');
            Severity: Minor
            Found in services/Jira.service.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

            The variable $INPUT is not named in camelCase.
            Open

                public function handleAuthorization()
                {
                    global $INPUT;
            
                    $token = $INPUT->str('jira_token');
            Severity: Minor
            Found in services/Jira.service.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

            The variable $INPUT is not named in camelCase.
            Open

                public function handleAuthorization()
                {
                    global $INPUT;
            
                    $token = $INPUT->str('jira_token');
            Severity: Minor
            Found in services/Jira.service.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

            The variable $INPUT is not named in camelCase.
            Open

                public static function isOurWebhook()
                {
                    global $INPUT;
                    $userAgent = $INPUT->server->str('HTTP_USER_AGENT');
                    return strpos($userAgent, 'Atlassian') === 0;
            Severity: Minor
            Found in services/Jira.service.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

            The variable $INPUT is not named in camelCase.
            Open

                public function handleAuthorization()
                {
                    global $INPUT;
            
                    $token = $INPUT->str('jira_token');
            Severity: Minor
            Found in services/Jira.service.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

            The variable $INPUT is not named in camelCase.
            Open

                public function handleAuthorization()
                {
                    global $INPUT;
            
                    $token = $INPUT->str('jira_token');
            Severity: Minor
            Found in services/Jira.service.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

            The variable $jira_url is not named in camelCase.
            Open

                public function getRepoPageText()
                {
                    /** @var \helper_plugin_issuelinks_db $db */
                    $db = plugin_load('helper', 'issuelinks_db');
                    $jira_url = $db->getKeyValue('jira_url');
            Severity: Minor
            Found in services/Jira.service.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

            The variable $INPUT is not named in camelCase.
            Open

                public static function isOurWebhook()
                {
                    global $INPUT;
                    $userAgent = $INPUT->server->str('HTTP_USER_AGENT');
                    return strpos($userAgent, 'Atlassian') === 0;
            Severity: Minor
            Found in services/Jira.service.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