You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating System / Distribution & Version: Debian Buster
Current Behavior
The violation UndefinedVariable does not contain externalInfoUrl in its element like this:
<pmdversion="@project.version@"timestamp="2020-01-08T10:31:06+00:00">
<filename="/tmp/test.php">
<violationbeginline="3"endline="3"rule="UndefinedVariable"ruleset="Clean Code Rules"priority="3">
Avoid using undefined variables such as '$x' which will lead to PHP notices.
</violation>
</file>
</pmd>
Expected Behavior
I expect the output below:
<?xml version="1.0" encoding="UTF-8" ?>
<pmdversion="@project.version@"timestamp="2020-01-08T10:31:15+00:00">
<filename="/tmp/test.php">
<violationbeginline="3"endline="3"rule="UndefinedVariable"ruleset="Clean Code Rules"externalInfoUrl="https://phpmd.org/rules/cleancode.html#undefinedvariable"priority="3">
Avoid using undefined variables such as '$x' which will lead to PHP notices.
</violation>
</file>
</pmd>
Steps To Reproduce:
Prepare the file test.php:
<?phpfunctionprintX() {
echo$x;
}
And, then run the following command:
$ phpmd test.php xml cleancode
Checks before submitting
Be sure that there isn't already an issue about this. See: Issues list
Be sure that there isn't already a pull request about this. See: Pull requests
I have added every step to reproduce the bug.
If possible I added relevant code examples.
This issue is about 1 bug and nothing more.
The issue has a descriptive title. For example: "JSON rendering failed on Windows for filenames with space".
I think the following patch resolves the issue, but I'm not sure this exactly works.
diff --git a/src/main/resources/rulesets/cleancode.xml b/src/main/resources/rulesets/cleancode.xml
index 3f01727..4a81006 100644
--- a/src/main/resources/rulesets/cleancode.xml+++ b/src/main/resources/rulesets/cleancode.xml@@ -182,7 +182,7 @@ function make() {
since="2.8.0"
message="Avoid using undefined variables such as '{0}' which will lead to PHP notices."
class="PHPMD\Rule\CleanCode\UndefinedVariable"
- externalInfoUrl="">+ externalInfoUrl="https://phpmd.org/rules/cleancode.html#undefinedvariable">
<description>
Detects when a variable is used that has not been defined before.
</description>
The text was updated successfully, but these errors were encountered:
Current Behavior
The violation
UndefinedVariable
does not containexternalInfoUrl
in its element like this:Expected Behavior
I expect the output below:
Steps To Reproduce:
Prepare the file
test.php
:And, then run the following command:
Checks before submitting
I think the following patch resolves the issue, but I'm not sure this exactly works.
The text was updated successfully, but these errors were encountered: