cosmocode/dokuwiki-plugin-issuelinks

View on GitHub
_test/general.test.php

Summary

Maintainability
A
45 mins
Test Coverage

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

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

        $this->assertArrayHasKey('author', $info);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertEquals
Open

        $this->assertEquals('issuelinks', $info['base']);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertRegExp
Open

        $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
Severity: Critical
Found in _test/general.test.php by phan

Reference to undeclared constant \DOKU_PLUGIN
Open

                    'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'issuelinks/conf/metadata.php');
Severity: Minor
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

                $this->assertArrayHasKey($key, $meta,
Severity: Critical
Found in _test/general.test.php by phan

Reference to undeclared constant \DOKU_PLUGIN
Open

            'Both ' . DOKU_PLUGIN . 'issuelinks/conf/default.php and ' . DOKU_PLUGIN . 'issuelinks/conf/metadata.php have to exist and contain the same keys.');
Severity: Minor
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

                $this->assertArrayHasKey($key, $conf,
Severity: Critical
Found in _test/general.test.php by phan

Reference to undeclared constant \DOKU_PLUGIN
Open

                    'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'issuelinks/conf/default.php');
Severity: Minor
Found in _test/general.test.php by phan

Class extends undeclared class \DokuWikiTest
Open

class general_plugin_issuelinks_test extends DokuWikiTest
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

        $this->assertArrayHasKey('desc', $info);
Severity: Critical
Found in _test/general.test.php by phan

Variable $meta is undeclared
Open

            foreach ($meta as $key => $value) {
Severity: Minor
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

        $this->assertArrayHasKey('date', $info);
Severity: Critical
Found in _test/general.test.php by phan

Variable $conf is undeclared
Open

        if (gettype($conf) != 'NULL' && gettype($meta) != 'NULL') {
Severity: Minor
Found in _test/general.test.php by phan

Variable $conf is undeclared
Open

            foreach ($conf as $key => $value) {
Severity: Minor
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertFileExists
Open

        $this->assertFileExists($file);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

        $this->assertArrayHasKey('email', $info);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

        $this->assertArrayHasKey('name', $info);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared function \mail_isvalid()
Open

        $this->assertTrue(mail_isvalid($info['email']));
Severity: Critical
Found in _test/general.test.php by phan

Variable $conf is undeclared
Open

        $this->assertEquals(gettype($conf), gettype($meta),
Severity: Minor
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertTrue
Open

        $this->assertTrue(mail_isvalid($info['email']));
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertRegExp
Open

        $this->assertRegExp('/^https?:\/\//', $info['url']);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertEquals
Open

        $this->assertEquals(gettype($conf), gettype($meta),
Severity: Critical
Found in _test/general.test.php by phan

Variable $meta is undeclared
Open

        $this->assertEquals(gettype($conf), gettype($meta),
Severity: Minor
Found in _test/general.test.php by phan

Call to undeclared function \confToHash()
Open

        $info = confToHash($file);
Severity: Critical
Found in _test/general.test.php by phan

Variable $meta is undeclared
Open

        if (gettype($conf) != 'NULL' && gettype($meta) != 'NULL') {
Severity: Minor
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

        $this->assertArrayHasKey('base', $info);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertArrayHasKey
Open

        $this->assertArrayHasKey('url', $info);
Severity: Critical
Found in _test/general.test.php by phan

Call to undeclared method \general_plugin_issuelinks_test::assertTrue
Open

        $this->assertTrue(false !== strtotime($info['date']));
Severity: Critical
Found in _test/general.test.php by phan

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

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

Method name "general_plugin_issuelinks_test::test_plugin_conf" is not in camel caps format
Open

    public function test_plugin_conf()
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Method name "general_plugin_issuelinks_test::test_plugininfo" is not in camel caps format
Open

    public function test_plugininfo()
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Function closing brace must go on the next line following the body; found 1 blank lines before brace
Open

    }
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Only one argument is allowed per line in a multi-line function call
Open

                $this->assertArrayHasKey($key, $meta,
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Only one argument is allowed per line in a multi-line function call
Open

                $this->assertArrayHasKey($key, $conf,
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Only one argument is allowed per line in a multi-line function call
Open

        $this->assertEquals(gettype($conf), gettype($meta),
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Line exceeds 120 characters; contains 160 characters
Open

            'Both ' . DOKU_PLUGIN . 'issuelinks/conf/default.php and ' . DOKU_PLUGIN . 'issuelinks/conf/metadata.php have to exist and contain the same keys.');
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

                $this->assertArrayHasKey($key, $conf,
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

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

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

Opening parenthesis of a multi-line function call must be the last content on the line
Open

        $this->assertEquals(gettype($conf), gettype($meta),
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Multi-line function call not indented correctly; expected 16 spaces but found 20
Open

                    'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'issuelinks/conf/metadata.php');
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

            'Both ' . DOKU_PLUGIN . 'issuelinks/conf/default.php and ' . DOKU_PLUGIN . 'issuelinks/conf/metadata.php have to exist and contain the same keys.');
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

                    'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'issuelinks/conf/metadata.php');
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Multi-line function call not indented correctly; expected 16 spaces but found 20
Open

                    'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'issuelinks/conf/default.php');
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

            'Both ' . DOKU_PLUGIN . 'issuelinks/conf/default.php and ' . DOKU_PLUGIN . 'issuelinks/conf/metadata.php have to exist and contain the same keys.');
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

                $this->assertArrayHasKey($key, $meta,
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

                    'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'issuelinks/conf/default.php');
Severity: Minor
Found in _test/general.test.php by phpcodesniffer

The variable $conf_file is not named in camelCase.
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 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 $meta_file is not named in camelCase.
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 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 $meta_file is not named in camelCase.
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 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 $meta_file is not named in camelCase.
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 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 $conf_file is not named in camelCase.
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 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 $conf_file is not named in camelCase.
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 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 method test_plugin_conf is not named in camelCase.
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 by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method test_plugininfo is not named in camelCase.
Open

    public function test_plugininfo()
    {
        $file = __DIR__ . '/../plugin.info.txt';
        $this->assertFileExists($file);

Severity: Minor
Found in _test/general.test.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status