phpdox
phpdox copied to clipboard
phpcs enricher is functional (no violations are shown)
I generate phpcs violations to XML log file via this command:
bin/phpcs --report-xml=build/phpcs.xml
Then in my phpdox.xml.dist file I have enabled the following enrichers (phploc, git, phpmd, phpcs):
<!-- add phploc output -->
<source type="phploc" />
<!-- git vcs information -->
<source type="git">
<git binary="git" />
<history enabled="true" cache="${phpDox.project.workdir}/gitlog.xml" />
</source>
<!-- PHP Code Sniffer findings -->
<source type="phpcs">
<file name="phpcs.xml" />
</source>
<!-- PHPMessDetector -->
<source type="pmd">
<file name="pmd.xml" />
</source>
It seems that all enrichers besides phpcs one are working correctly.
Partial output from running phpdox command:
... [25.06.2015 - 18:03:36] Starting generator [25.06.2015 - 18:03:36] Loading enrichers [25.06.2015 - 18:03:36] Enricher PHPLoc xml initialized successfully [25.06.2015 - 18:03:36] Enricher GIT information initialized successfully [25.06.2015 - 18:03:36] Enricher PHPCS XML initialized successfully [25.06.2015 - 18:03:36] Enricher PHPMessDetector XML initialized successfully [25.06.2015 - 18:03:36] Enricher Build Information initialized successfully [25.06.2015 - 18:03:36] Starting event loop. ....
Is there a problem with PHPCS enricher or maybe I just can't find the place where violations should be listed? They are not near listed PHPMD violations.
phpdox version: latest dev-master php codesniffer version: 2.3.3
The enricher for PHPCS' own file format has been contributed by @exi and i never actively tried it myself.
As a quick workaround you could change the logformat for PHPCS to checkstyle and then use the checkstyle enricher which does exactly the same thing otherwise.
I'll try to look into this next week. @exi: Do you have a chance to look at this as well?
@theseer I'll have a look
@theseer I did not quite figure out the bug yet, but as the phpcs enricher is based upon the checkstyle enricher, i just verified that they produce identical intermediate xml and the bug is present in the checkstyle enricher as well. I get empty html results using the checkstyle enricher too. The final xml written on disk is missing any enrichments. The intermediate dom objects when dumped from within the generator are correct in both cases.
@theseer ok, forget what i said, i was just to tired to read. i'll debug it some more
@edvinasme could you give me a sample phpcs.xml and phpdox.xml and some minimal code example that i can use to reproduce this? phpcs output seems to work for me just fine.
@edvinasme if you click on a class, violations are listed under the topic "checkstyle". checkstyle and phpcs enricher are both using the "checkstyle" headline
I do not see the checkstyle headline at all, I am trying to figure out why. If you have any example working configs it would be great.
to test it on the phpdox codebase, i used:
<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">
<project name="phpDox" source="${basedir}/src" workdir="${basedir}/build/api/xml">
<collector publiconly="false" backend="parser" />
<generator output="${basedir}/build/api/docs">
<enrich base="${basedir}/output">
<source type="build" />
<source type="phpcs">
<file name="phpcs.xml" />
</source>
</enrich>
<build engine="html" enabled="true" output="html">
<template dir="${phpDox.home}/templates/html" />
<file extension="xhtml" />
</build>
<build engine="xml" enabled="true" output="xml" />
</generator>
</project>
</phpdox>
where i saved the output like this: phpcs --report-xml=output/phpcs.xml src
Any update on this?
Sorry I have been busy, I will check it asap and will report the results.
+1
+1
+1 I'm pretty sure I have the same issue where phpcs generates an xml file, phpdox reads this file without any warnings or errors yet there is no trace of any phpcs information inside the outputted html from phpdox. My phploc information is all present and correct so I think I'm using the enrichers correctly.
+1
+1