Giter Club home page Giter Club logo

codeclimate-phpmd's Introduction

Code Climate PHP Mess Detector (PHPMD) Engine

Code Climate

codeclimate-phpmd is a Code Climate Engine that wraps the PHP Mess Detector (PHPMD) static analysis tool.

Installation

  1. If you haven't already, install the Code Climate CLI.
  2. Run codeclimate engines:enable phpmd. This command both installs the engine and enables it in your .codeclimate.yml file.
  3. You're ready to analyze! Browse into your project's folder and run codeclimate analyze.

Config Options

Format the values for these config options per the PHPMD documentation.

  • file_extensions - This is where you can configure the file extensions for the files that you want PHPMD to analyze.
  • rulesets - This is the list of rulesets that you want PHPMD to use while analyzing your files.

Sample Config

exclude_paths:
 - "/examples/**/*"
engines:
  phpmd:
    enabled: true
    config:
      file_extensions: "php"
      rulesets: "unusedcode,codesize,naming,optional_relative_path_to_custom_ruleset.xml"
ratings:
  paths:
  - "**.php"

Need help?

For help with PHPMD, check out their documentation.

If you're running into a Code Climate issue, first look over this project's GitHub Issues, as your question may have already been covered. If not, go ahead and open a support ticket with us.

codeclimate-phpmd's People

Contributors

ablyler avatar blakewilliams avatar brynary avatar dantevvp avatar dblandin avatar dbudwin avatar fede-moya avatar filipesperandio avatar gdiggs avatar josephdpurcell avatar jpignata avatar landrok avatar maxjacobson avatar mik-laj avatar mxie avatar noahd1 avatar pbrisbin avatar pointlessone avatar wfleming avatar wilson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codeclimate-phpmd's Issues

all error in output

I've got errors on every build:

PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Undefined variable: type in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php on line 5521
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PDepend\Source\AST\AbstractASTCallable::addChild() must implement interface PDepend\Source\AST\ASTNode, null given, called in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion70.php on line 97 and defined in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTCallable.php:143
Stack trace:
#0 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion70.php(97): PDepend\Source\AST\AbstractASTCallable->addChild(NULL)
#1 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(1228): PDepend\Source\Language\PHP\PHPParserVersion70->parseCallableDeclarationAddition(Object(PDepend\Source\AST\ASTMethod))
#2 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(1185): PDepend\Source\Language\PHP\AbstractPHPParser->parseCallableDeclaration(Object(PDepend\Source\AST\ASTMethod))
#3 /usr/src/ in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTCallable.php on line 143
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Only variables should be passed by reference in /usr/src/app/Category.php on line 70
PHP Notice:  Undefined variable: type in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php on line 5521
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PDepend\Source\AST\AbstractASTCallable::addChild() must implement interface PDepend\Source\AST\ASTNode, null given, called in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion70.php on line 97 and defined in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTCallable.php:143
Stack trace:
#0 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion70.php(97): PDepend\Source\AST\AbstractASTCallable->addChild(NULL)
#1 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(1228): PDepend\Source\Language\PHP\PHPParserVersion70->parseCallableDeclarationAddition(Object(PDepend\Source\AST\ASTMethod))
#2 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(1185): PDepend\Source\Language\PHP\AbstractPHPParser->parseCallableDeclaration(Object(PDepend\Source\AST\ASTMethod))
#3 /usr/src/ in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTCallable.php on line 143

PHPMD times out on Code Climate

Problem

Here is the error:

An engine timed out
E11

The phpmd engine failed to complete in time.

Engine timeouts are generally caused by either an abnormally large number of files under analysis or from attempting to analyze a file not typically intended for static analysis. We recommend excluding:

    Third party libraries
    Production assets, such as minimized or cross-compiled files
    Automated test suites

For more information, see our documentation on file and path exclusions.

I experienced this on these repos:

I expect this will be a common problem for other large PHP projects.

Proposed Solution

I see at least two options:

  1. Investigate to see why PHPMD takes longer than PHPCS or other engines.
  2. Set the default timeout limit just for the PHPMD engine to 30 mins instead of 15 mins.

Outdated PHPMD version

PHPMD version that currently locked in composer.lock results in different results of PHP Mess Detector. 2.3 has a weird bug in the coupling between objects rule that was fixed in 2.6, but codeclimate still uses outdated version.

PDepend - Uncaught Error: Call to a member function restoreClass() on null

Customer's repo erroring with:

engine phpmd failed with status 255 and stderr 
Exception: Argument 1 passed to PDepend\Source\AST\ASTConstantDeclarator::setValue() must be an instance of PDepend\Source\AST\ASTValue, null given, called in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php on line 6205 in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTConstantDeclarator.php
#0 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(6205): PDepend\Source\AST\ASTConstantDeclarator->setValue(NULL)
#1 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(6135): PDepend\Source\Language\PHP\AbstractPHPParser->parseConstantDeclarator()
#2 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(886): PDepend\Source\Language\PHP\AbstractPHPParser->parseConstantDefinition()
#3 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(713): PDepend\Source\Language\PHP\AbstractPHPParser->parseTypeBody(Object(PDepend\Source\AST\ASTClass))
#4 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(5712): PDepend\Source\Language\PHP\AbstractPHPParser->parseClassDeclaration()
#5 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(388): PDepend\Source\Language\PHP\AbstractPHPParser->parseOptionalStatement()
#6 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Engine.php(575): PDepend\Source\Language\PHP\AbstractPHPParser->parse()
#7 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Engine.php(323): PDepend\Engine->performParseProcess()
#8 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/Parser.php(123): PDepend\Engine->analyze()
#9 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/PHPMD.php(222): PHPMD\Parser->parse(Object(PHPMD\Report))
#10 /usr/src/app/Runner.php(116): PHPMD\PHPMD->processFiles('/code/magento/a...', 'cleancode,codes...', Array, Object(PHPMD\RuleSetFactory))
#11 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1852): CodeClimate\PHPMD\Runner->run(Array)
#12 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1772): fork_daemon->invoke_callback(Array, Array, false)
#13 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1673): fork_daemon->fork_work_unit(Array, '', -1)
#14 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1423): fork_daemon->process_work_unit(-1)
#15 /usr/src/app/engine.php(37): fork_daemon->process_work(true)
#16 {main}
PHP Fatal error:  Uncaught Error: Call to a member function restoreClass() on null in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Builder/BuilderContext/GlobalBuilderContext.php:116
Stack trace:
#0 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClass.php(212): PDepend\Source\Builder\BuilderContext\GlobalBuilderContext->registerClass(Object(PDepend\Source\AST\ASTClass))
#1 [internal function]: PDepend\Source\AST\ASTClass->__wakeup()
#2 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1973): unserialize('O:9:"TypeError"...')
#3 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1570): fork_daemon->socket_receive(Resource id #2691)
#4 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1622): fork_daemon->fetch_results(false, 0, -1)
#5 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(841): fork_daemon->post_results(-1)
#6 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1420): fork_daemon->sig in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Builder/BuilderContext/GlobalBuilderContext.php on line 116

oss repo - error with PDepend, parser issue?

https://github.com/FrailmoonEnterprises/AlivarAPI

OSS repo erroring with:

engine phpmd failed with status 1 and stderr 
Exception: Argument 1 passed to PDepend\Source\Parser\TokenStack::add() must be an instance of PDepend\Source\Tokenizer\Token, integer given, called in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php on line 6842 in /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/TokenStack.php
#0 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(6842): PDepend\Source\Parser\TokenStack->add(-1)
#1 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(2587): PDepend\Source\Language\PHP\AbstractPHPParser->consumeToken(-1)
#2 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(5039): PDepend\Source\Language\PHP\AbstractPHPParser->parseExpression()
#3 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(4996): PDepend\Source\Language\PHP\AbstractPHPParser->parseArrayElement(false)
#4 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion53.php(91): PDepend\Source\Language\PHP\AbstractPHPParser->parseArrayElements(Object(PDepend\Source\AST\ASTArray), 7, false)
#5 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion54.php(216): PDepend\Source\Language\PHP\PHPParserVersion53->parseArray(Object(PDepend\Source\AST\ASTArray), false)
#6 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(4957): PDepend\Source\Language\PHP\PHPParserVersion54->parseArray(Object(PDepend\Source\AST\ASTArray), false)
#7 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(2653): PDepend\Source\Language\PHP\AbstractPHPParser->doParseArray()
#8 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(2586): PDepend\Source\Language\PHP\AbstractPHPParser->parseOptionalExpression()
#9 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(5049): PDepend\Source\Language\PHP\AbstractPHPParser->parseExpression()
#10 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(4996): PDepend\Source\Language\PHP\AbstractPHPParser->parseArrayElement(false)
#11 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion53.php(91): PDepend\Source\Language\PHP\AbstractPHPParser->parseArrayElements(Object(PDepend\Source\AST\ASTArray), 7, false)
#12 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserVersion54.php(216): PDepend\Source\Language\PHP\PHPParserVersion53->parseArray(Object(PDepend\Source\AST\ASTArray), false)
#13 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(4957): PDepend\Source\Language\PHP\PHPParserVersion54->parseArray(Object(PDepend\Source\AST\ASTArray), false)
#14 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(2653): PDepend\Source\Language\PHP\AbstractPHPParser->doParseArray()
#15 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(4354): PDepend\Source\Language\PHP\AbstractPHPParser->parseOptionalExpression()
#16 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(2774): PDepend\Source\Language\PHP\AbstractPHPParser->parseAssignmentExpression(Object(PDepend\Source\AST\ASTArrayIndexExpression))
#17 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(5725): PDepend\Source\Language\PHP\AbstractPHPParser->parseOptionalExpression()
#18 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php(388): PDepend\Source\Language\PHP\AbstractPHPParser->parseOptionalStatement()
#19 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Engine.php(575): PDepend\Source\Language\PHP\AbstractPHPParser->parse()
#20 /usr/src/app/vendor/pdepend/pdepend/src/main/php/PDepend/Engine.php(323): PDepend\Engine->performParseProcess()
#21 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/Parser.php(123): PDepend\Engine->analyze()
#22 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/PHPMD.php(222): PHPMD\Parser->parse(Object(PHPMD\Report))
#23 /usr/src/app/Runner.php(116): PHPMD\PHPMD->processFiles('/code/user/inst...', 'cleancode,codes...', Array, Object(PHPMD\RuleSetFactory))
#24 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1852): CodeClimate\PHPMD\Runner->run(Array)
#25 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1772): fork_daemon->invoke_callback(Array, Array, false)
#26 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1673): fork_daemon->fork_work_unit(Array, '', -1)
#27 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1423): fork_daemon->process_work_unit(-1)
#28 /usr/src/app/engine.php(37): fork_daemon->process_work(true)
#29 {main}
  • Happens with Code Climate CLI and .com analysis.
  • checking with @powelljf3 to see if he can reproduce with PHPMD itself, locally

Exception error: Call to a member function getPriority() on null

Repo getting exception errors when DuplicatedArrayKey and MissingImport checks added.

Customer reports:

It seems that we have activated some checks, that were added to phpmd in version 2.7.0 (DuplicatedArrayKey and MissingImport). If I remove the two checks, everything seems to be working.

I have also tested with an older version (2.6.1) of phpmd against my local version (2.7.0) and with the older version I get the same error as I get on CodeClimate.


The errors don't fail the build, but produces logs like:

Exception: Call to a member function getPriority() on null in /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php
#0 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(288): PHPMD\RuleSetFactory->parseRuleReferenceNode(Object(PHPMD\RuleSet), Object(SimpleXMLElement))
#1 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(265): PHPMD\RuleSetFactory->parseRuleNode(Object(PHPMD\RuleSet), Object(SimpleXMLElement))
#2 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(141): PHPMD\RuleSetFactory->parseRuleSetNode('/code/./codesiz...')
#3 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(125): PHPMD\RuleSetFactory->createSingleRuleSet('/code/./codesiz...')
#4 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/PHPMD.php(217): PHPMD\RuleSetFactory->createRuleSets('/code/./codesiz...')
#5 /usr/src/app/Runner.php(116): PHPMD\PHPMD->processFiles('/code/artisan', '/code/./codesiz...', Array, Object(PHPMD\RuleSetFactory))
#6 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1852): CodeClimate\PHPMD\Runner->run(Array)
#7 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1772): fork_daemon->invoke_callback(Array, Array, false)
#8 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1673): fork_daemon->fork_work_unit(Array, '', -1)
#9 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1445): fork_daemon->process_work_unit(-1)
#10 /usr/src/app/Runner.php(31): fork_daemon->process_work(false)
#11 /usr/src/app/engine.php(35): CodeClimate\PHPMD\Runner->queueDirectory('/code')
#12 {main}Exception: Call to a member function getPriority() on null in /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php
#0 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(288): PHPMD\RuleSetFactory->parseRuleReferenceNode(Object(PHPMD\RuleSet), Object(SimpleXMLElement))
#1 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(265): PHPMD\RuleSetFactory->parseRuleNode(Object(PHPMD\RuleSet), Object(SimpleXMLElement))
#2 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(141): PHPMD\RuleSetFactory->parseRuleSetNode('/code/./codesiz...')
#3 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php(125): PHPMD\RuleSetFactory->createSingleRuleSet('/code/./codesiz...')
#4 /usr/src/app/vendor/phpmd/phpmd/src/main/php/PHPMD/PHPMD.php(217): PHPMD\RuleSetFactory->createRuleSets('/code/./codesiz...')
#5 /usr/src/app/Runner.php(116): PHPMD\PHPMD->processFiles('/code/app/Http/...', '/code/./codesiz...', Array, Object(PHPMD\RuleSetFactory))
#6 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1852): CodeClimate\PHPMD\Runner->run(Array)
#7 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1772): fork_daemon->invoke_callback(Array, Array, false)
#8 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1673): fork_daemon->fork_work_unit(Array, '', -1)
#9 /usr/src/app/vendor/barracudanetworks/forkdaemon-php/fork_daemon.php(1445): fork_daemon->process_work_unit(-1)
#10 /usr/src/app/Runner.php(31): fork_daemon->process_work(false)
#11 /usr/src/app/engine.php(35): CodeClimate\PHPMD\Runner->queueDirectory('/code')
#12 {main}

Improve default PHPMD checks

Problem

By default, PHPMD has the following two checks which I believe are problematic:

  • The camelCase variable names apply to Zend and Symfony but not Drupal and Wordpress.
  • Avoiding "else" statements is controversial: I don't believe there is consensus that the use of else statements correlates with poor code. And it is a little redundant in that it would be caught by Cyclomatic Complexity and NPath Complexity metrics.

Proposed Resolution

  • Turn off the CamelCaseClassName, CamelCasePropertyName, CamelCaseMethodName, CamelCaseParameterName, CamelCaseVariableName checks by default.
  • Turn off the ElseExpression check by default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.