Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out ot the box usage in combination with composer of all rules failes throws error Property $exceptions does not exist. #80

Closed
DannyvdSluijs opened this issue Apr 24, 2013 · 10 comments
Labels

Comments

@DannyvdSluijs
Copy link
Contributor

When having composer.json with

"require-dev": {
        "phpmd/phpmd": "dev-master",

And build.xml with

<target name="phpmd" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
        <exec executable="./vendor/bin/phpmd">
            <arg path="${basedir}/" />
            <arg value="xml" />
            <arg value="cleancode,codesize,controversial,design,naming,unusedcode" />
            <arg value="--exclude" />
            <arg value="${basedir}/cache,${basedir}/vendor,${basedir}/build" />
            <arg value="--reportfile" />
            <arg value="${basedir}/build/logs/pmd.xml" />
        </exec>
    </target>

And running the command

ant phpmd

The following output is shown:

Buildfile: /var/www/bob/build.xml

phpmd:
     [exec] Property $exceptions does not exist.
     [exec] Result: 1

BUILD SUCCESSFUL
@yakobe
Copy link

yakobe commented Jul 4, 2013

and info on what is causing this? i have the same problem.

@ravage84
Copy link
Member

ravage84 commented Oct 8, 2014

@DannyvdSluijs Is this still an issue?

Also it's not wise to fetch dev-master as you could fetch buggy version.

@DannyvdSluijs
Copy link
Contributor Author

Will try to find some time for this tomorrow.

@cstrosser
Copy link

We recently started experiencing this exact problem after the update to 2.2.1. Reverting to 2.2.0 makes the problem go away. It seems to be limited to something within the naming.xml file, which when disabled, eliminates the "exceptions" message. If I compared correctly, it seems there was one change to the naming.xml file in the 2.2 release. Was there maybe an inadvertent BC break?

<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="PHPMD settings"
    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>PHPMD rules for ZF2</description>

    <rule ref="rulesets/codesize.xml"/>
    <rule ref="rulesets/design.xml"/>
    <rule ref="rulesets/unusedcode.xml"/>

    <rule ref="rulesets/naming.xml">
        <exclude name="ShortVariable" />
        <exclude name="LongVariable" />
        <exclude name="BooleanGetMethodName" />
    </rule>
</ruleset>

@ravage84
Copy link
Member

@cstrosser please create a separate issue next time, even if it could be related.

Those are the relevant changes between 2.2.0 and 2.2.1:
2.2.0...phpmd:2.2.1#diff-0fb615195fc1c30dc57b0516a3ccfeb6R73
2.2.0...phpmd:2.2.1#diff-0fb615195fc1c30dc57b0516a3ccfeb6R97
2.2.0...phpmd:2.2.1#diff-ffdb8bc5d60830fdf97b6ec671fac4bcR78
2.2.0...phpmd:2.2.1#diff-59d8d3eb64698d9c050a2e6a58f0298cR67
2.2.0...phpmd:2.2.1#diff-8b075d4f7a3d7126e3d442f2e7e49af1R33
2.2.0...phpmd:2.2.1#diff-8b075d4f7a3d7126e3d442f2e7e49af1R86

Not sure why it is complaining about a missing $exceptions though.
As you can see it swallows a missing field silently:
2.2.0...phpmd:2.2.1#diff-0fb615195fc1c30dc57b0516a3ccfeb6R99

May be it does not at some other place @manuelpichler ?

@cstrosser
Copy link

Looks like the OutOfBoundsException wasn't imported. (EDIT: appears fixed in master branch)

https://github.com/phpmd/phpmd/blob/58c4b00f924d301e8c5281f40cfa9a66f3df9eee/src/main/php/PHPMD/Rule/Naming/ShortMethodName.php

@ravage84
Copy link
Member

True, could you test it with the current master?

@cstrosser
Copy link

Tested against master, and can confirm no exception is thrown.

@ravage84
Copy link
Member

Many thanks. @manuelpichler is there something that blocks a patch release?

@ravage84 ravage84 added the Bug label Mar 25, 2015
@manuelpichler
Copy link
Contributor

@ravage84 No, a patch release seems to be valid here.

@ravage84 ravage84 added this to the 2.x (unspecific) milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants