phpdox icon indicating copy to clipboard operation
phpdox copied to clipboard

phpcs enricher is functional (no violations are shown)

Open ghost opened this issue 10 years ago • 15 comments

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

ghost avatar Jun 25 '15 18:06 ghost

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 avatar Jun 27 '15 12:06 theseer

@theseer I'll have a look

exi avatar Jun 27 '15 15:06 exi

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

exi avatar Jun 27 '15 21:06 exi

@theseer ok, forget what i said, i was just to tired to read. i'll debug it some more

exi avatar Jun 27 '15 21:06 exi

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

exi avatar Jun 27 '15 22:06 exi

@edvinasme if you click on a class, violations are listed under the topic "checkstyle". checkstyle and phpcs enricher are both using the "checkstyle" headline

exi avatar Jun 27 '15 22:06 exi

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.

ghost avatar Jul 03 '15 14:07 ghost

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

exi avatar Jul 03 '15 14:07 exi

Any update on this?

theseer avatar Jul 13 '15 22:07 theseer

Sorry I have been busy, I will check it asap and will report the results.

ghost avatar Aug 07 '15 16:08 ghost

+1

gvanbeck avatar Jan 08 '16 14:01 gvanbeck

+1

nymo avatar Feb 24 '16 15:02 nymo

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

ghost avatar Mar 10 '16 16:03 ghost

+1

Starli0n avatar Sep 15 '16 17:09 Starli0n

+1

lehoaian avatar Dec 06 '16 11:12 lehoaian