codeclimate / codeclimate-phpmd

Code Climate PHPMD Engine
MIT License
10 stars 12 forks source link

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

Open efueger opened 5 years ago

efueger commented 5 years ago

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}