clean/phpdoc-md

View on GitHub

Showing 24 of 24 total issues

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

    private function getMethodDetails($method)
    {
        $docblock = $this->docBlockFactory->create($method->getDocComment() ?: '/** */');

        $data = [
Severity: Minor
Found in src/ClassParser.php - About 1 hr to fix

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

    <?php namespace Clean\PhpDocMd\Markdown\Stash;
    
    use Clean\View\Phtml;
    
    class Readme extends Phtml
    Severity: Major
    Found in src/Markdown/Stash/Readme.php and 1 other location - About 1 hr to fix
    src/Markdown/GitHub/Readme.php on lines 1..22

    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 105.

    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

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

    <?php namespace Clean\PhpDocMd\Markdown\GitHub;
    
    use Clean\View\Phtml;
    
    class Readme extends Phtml
    Severity: Major
    Found in src/Markdown/GitHub/Readme.php and 1 other location - About 1 hr to fix
    src/Markdown/Stash/Readme.php on lines 1..22

    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 105.

    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 using undefined variables such as '$config' which will lead to PHP notices.
    Open

                throw new \RuntimeException(sprintf("Unknown markdown format '%s'. Only 'github' or 'bitbucket' allowed. Check your .phpdoc-md config file", $config->format));
    Severity: Minor
    Found in src/snippets.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

    Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

        $re = preg_replace(
    Severity: Minor
    Found in src/snippets.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 $p. Configured minimum length is 3.
    Open

            return ($p = $this->reflection->getParentClass()) ? $p->getName() : null;
    Severity: Minor
    Found in src/ClassParser.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

    Missing class import via use statement (line '11', column '28').
    Open

            $this->links = new \stdClass;
    Severity: Minor
    Found in src/Markdown/GitHub/Readme.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

    Missing class import via use statement (line '11', column '28').
    Open

            $this->links = new \stdClass;
    Severity: Minor
    Found in src/Markdown/Stash/Readme.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

    Missing class import via use statement (line '87', column '29').
    Open

                $atlasdoc = new \Clean\PhpAtlas\ClassMethod($className);
    Severity: Minor
    Found in src/ClassParser.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

    Missing class import via use statement (line '27', column '23').
    Open

                throw new \RuntimeException(sprintf("Unknown markdown format '%s'. Only 'github' or 'bitbucket' allowed. Check your .phpdoc-md config file", $config->format));
    Severity: Minor
    Found in src/snippets.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

    The method info has a boolean flag argument $verbose, which is a certain sign of a Single Responsibility Principle violation.
    Open

    function info($message, $verbose = false) {
    Severity: Minor
    Found in src/snippets.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Avoid unused private methods such as 'getPHPDocLink'.
    Open

        private function getPHPDocLink($method) {
            return strtolower(sprintf('https://secure.php.net/manual/en/%s.%s.php', $method->class, $method->name));
        }
    Severity: Minor
    Found in src/ClassParser.php by phpmd

    UnusedPrivateMethod

    Since: 0.2

    Unused Private Method detects when a private method is declared but is unused.

    Example

    class Something
    {
        private function foo() {} // unused
    }

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

    Avoid using static access to class '\phpDocumentor\Reflection\DocBlockFactory' in method '__construct'.
    Open

            $this->docBlockFactory = DocBlockFactory::createInstance();
    Severity: Minor
    Found in src/ClassParser.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 '$exception'.
    Open

    function error($message, $exception = null) {
    Severity: Minor
    Found in src/snippets.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 '$firstArgument'.
    Open

        public function public2Method($firstArgument, $secondArgument)
    Severity: Minor
    Found in example/ExtendExtendClass.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 '$secondArgument'.
    Open

        public function public2Method($firstArgument, $secondArgument)
    Severity: Minor
    Found in example/ExtendExtendClass.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 '$two'.
    Open

        public function addValues($one, $two)
    Severity: Minor
    Found in example/BasicClass.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 '$config'.
    Open

                throw new \RuntimeException(sprintf("Unknown markdown format '%s'. Only 'github' or 'bitbucket' allowed. Check your .phpdoc-md config file", $config->format));
    Severity: Minor
    Found in src/snippets.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 private methods such as 'boo'.
    Open

        private function boo()
        {
            // code...
        }
    Severity: Minor
    Found in example/BasicClass.php by phpmd

    UnusedPrivateMethod

    Since: 0.2

    Unused Private Method detects when a private method is declared but is unused.

    Example

    class Something
    {
        private function foo() {} // unused
    }

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

    The function error() contains an exit expression.
    Open

        exit(1);
    Severity: Minor
    Found in src/snippets.php by phpmd

    ExitExpression

    Since: 0.2

    An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

    Example

    class Foo {
        public function bar($param)  {
            if ($param === 42) {
                exit(23);
            }
        }
    }

    Source https://phpmd.org/rules/design.html#exitexpression

    Severity
    Category
    Status
    Source
    Language