cosmocode/dokuwiki-plugin-issuelinks

View on GitHub
syntax.php

Summary

Maintainability
A
0 mins
Test Coverage

Remove error control operator '@' on line 102.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

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

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

        $issue = Issue::getInstance($data['service'], $data['project'], $data['issueId'], $data['isMergeRequest']);
Severity: Minor
Found in syntax.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 'connectTo'.
Open

        $serviceProvider = dokuwiki\plugin\issuelinks\classes\ServiceProvider::getInstance();
Severity: Minor
Found in syntax.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 unused parameters such as '$pos'.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
Severity: Minor
Found in syntax.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 '$handler'.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
Severity: Minor
Found in syntax.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 '$class'.
Open

        foreach ($this->syntaxPatterns as $pattern => $class) {
Severity: Minor
Found in syntax.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

Avoid unused parameters such as '$state'.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
Severity: Minor
Found in syntax.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

Call to undeclared function \act_clean()
Open

        if (act_clean($ACT) === 'show' && $isLatest && page_exists($ID)) {
Severity: Critical
Found in syntax.php by phan

Call to undeclared function \wikiFN()
Open

        $currentRev = @filemtime(wikiFN($ID));
Severity: Critical
Found in syntax.php by phan

Call to undeclared function \page_exists()
Open

        if (act_clean($ACT) === 'show' && $isLatest && page_exists($ID)) {
Severity: Critical
Found in syntax.php by phan

Call to method interwikilink from undeclared class \Doku_Renderer
Open

            $renderer->interwikilink(null, null, 'google.com', implode(' ', $data));
Severity: Critical
Found in syntax.php by phan

Reference to instance property doc from undeclared class \Doku_Renderer
Open

        $renderer->doc .= $issue->getIssueLinkHTML();
Severity: Minor
Found in syntax.php by phan

Class extends undeclared class \DokuWiki_Syntax_Plugin
Open

class syntax_plugin_issuelinks extends DokuWiki_Syntax_Plugin
Severity: Critical
Found in syntax.php by phan

Parameter $handler has undeclared type \Doku_Handler
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
Severity: Minor
Found in syntax.php by phan

Possibly zero references to use statement for classlike/namespace ServiceInterface (\dokuwiki\plugin\issuelinks\services\ServiceInterface)
Open

use dokuwiki\plugin\issuelinks\services\ServiceInterface;
Severity: Minor
Found in syntax.php by phan

Call to undeclared method \syntax_plugin_issuelinks::loadHelper
Open

        $db_helper = $this->loadHelper('issuelinks_db');
Severity: Critical
Found in syntax.php by phan

Reference to undeclared property \syntax_plugin_issuelinks->Lexer
Open

            $this->Lexer->addSpecialPattern("\[\[$pattern>.*?\]\]", $mode, 'plugin_issuelinks');
Severity: Minor
Found in syntax.php by phan

Parameter $renderer has undeclared type \Doku_Renderer
Open

    public function render($mode, Doku_Renderer $renderer, $data)
Severity: Minor
Found in syntax.php by phan

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

The class syntax_plugin_issuelinks is not named in CamelCase.
Open

class syntax_plugin_issuelinks extends DokuWiki_Syntax_Plugin
{

    protected $syntaxPatterns = [];

Severity: Minor
Found in syntax.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

The parameter $issue_id is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $ID. Configured minimum length is 3.
Open

        global $ID, $REV, $ACT;
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

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

Class name "syntax_plugin_issuelinks" is not in camel caps format
Open

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

The variable $ID is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $ID is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $db_helper is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $ACT is not named in camelCase.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
    {
        list($pmServiceKey, $issueSyntax) = explode('>', trim($match, '[]'));

        $serviceClassName = $this->syntaxPatterns[$pmServiceKey];
Severity: Minor
Found in syntax.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 $db_helper is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $REV is not named in camelCase.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
    {
        list($pmServiceKey, $issueSyntax) = explode('>', trim($match, '[]'));

        $serviceClassName = $this->syntaxPatterns[$pmServiceKey];
Severity: Minor
Found in syntax.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 $issue_id is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $ID is not named in camelCase.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
    {
        list($pmServiceKey, $issueSyntax) = explode('>', trim($match, '[]'));

        $serviceClassName = $this->syntaxPatterns[$pmServiceKey];
Severity: Minor
Found in syntax.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 $ACT is not named in camelCase.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
    {
        list($pmServiceKey, $issueSyntax) = explode('>', trim($match, '[]'));

        $serviceClassName = $this->syntaxPatterns[$pmServiceKey];
Severity: Minor
Found in syntax.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 $ID is not named in camelCase.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
    {
        list($pmServiceKey, $issueSyntax) = explode('>', trim($match, '[]'));

        $serviceClassName = $this->syntaxPatterns[$pmServiceKey];
Severity: Minor
Found in syntax.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 $ID is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $REV is not named in camelCase.
Open

    public function handle($match, $state, $pos, Doku_Handler $handler)
    {
        list($pmServiceKey, $issueSyntax) = explode('>', trim($match, '[]'));

        $serviceClassName = $this->syntaxPatterns[$pmServiceKey];
Severity: Minor
Found in syntax.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 $issue_id is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $ID is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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 $db_helper is not named in camelCase.
Open

    private function saveLinkToDatabase($pmServiceName, $project, $issue_id, $isMergeRequest)
    {
        global $ID;
        $currentRev = @filemtime(wikiFN($ID));

Severity: Minor
Found in syntax.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