Closed jdewit closed 11 years ago
Hi @jdewit, glad you like the plugin!
Do you have anything set in your g:phpqa_messdetector_ruleset
global variable? This is either the name of an existing rule set or a path to an XML file with the rule set defined. It seems that PHP mess detector is trying to use a non existent rule set called "Gene", which is strange.
When you get the error again, run:
:echo g:phpqa_messdetector_ruleset
And see what gets spit out. Paste it here if you're unsure. If it isn't obvious we'll go into some more detailed debugging.
Thanks
Thanks for the reply joonty.
I had dowloaded a ruleset for Symfony2 so I thought that may have been the problem.
in my gvimrc.local let g:phpqa_messdetector_ruleset = "/usr/share/php/PHP/CodeSniffer/Standards/Symfony2/ruleset.xml" let g:phpqa_codesniffer_args = "--standard=Symfony2"
But I also tried just setting it to the default Zend ruleset and I get the same "Gene" error. let g:phpqa_messdetector_ruleset = "/usr/share/php/PHP/CodeSniffer/Standards/Zend/ruleset.xml" let g:phpqa_codesniffer_args = "--standard=Zend"
echoing as you suggested outputs the ruleset path properly. For the Zend ruleset it shows: /usr/share/php/PHP/CodeSniffer/Standards/Zend/ruleset.xml
setting let g:phpqa_open_loc = 0 makes it less annoying although I think I'm missing out on some functionality with that.
phpmd and phpcs are both the latest versions.
Would love to get to the bottom of this!
Ok, plan b! What version of mess detector do you have?
phpmd --version
Thanks
phpmd 1.4.1 by Manuel Pichler phpcs 1.4.3 (stable) by Squiz Pty Ltd.
Vim is compiled with perl
On Xubuntu xfce 4.8
I tried deleting some rulesets and it's not just the "Gene" ruleset that it cannot find. After deleting this...
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<rule ref="Squiz.ControlStructures.ControlSignature"/>
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<rule ref="Squiz.Scope.MemberVarScope"/>
It now errors out on the next ruleset cannot find specified ruleset "PEAR"
I'm going to try reinstalling phpmd again.
No need to reinstall PHPMD! I've worked it out - your issue is due to the fact that the ruleset you printed is actually a code sniffer ruleset, not a mess detector ruleset.
A mess detector ruleset looks like this:
<?xml version="1.0"?>
<ruleset name="Example mess detection"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Example mess detection ruleset</description>
<rule ref="rulesets/codesize.xml" />
<!--<rule ref="rulesets/codesize.xml/NPathComplexity" />-->
<rule ref="rulesets/design.xml/ExitExpression" />
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/DepthOfInheritance" />
<rule ref="rulesets/design.xml/CouplingBetweenObjects" />
<rule ref="rulesets/naming.xml/LongVariable" />
<rule ref="rulesets/naming.xml/ShortMethodName" />
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
<!--<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />-->
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
</ruleset>
I can reproduce the error by passing a code sniffer ruleset to mess detector. Easy enough to get them confused!
That solves it! Thanks very much for your help.
No problem!
Thanks for this plugin!
I'm getting the error
"M Cannot find specified rule-set "Gene". (PHPMD)"
Any ideas on how to resolve this? I can't find anything and am at a loss.
Let me know if you need any info.