| Subject | Details |
| :------------- | :---------------------------------------------------------------------------- |
| Issue type | Bug |
| Plugin | Php Inspections (EA Extended), last version |
| Language level | e.g. PHP 7 |
Consider the following code:
<?php
function foo ($url) {
if (false) {
}
else {
$errormsg = "Failed";
if ( false ) {
$errormsg .= "Failed 1";
}
else {
$errormsg .= "Failed 2";
}
}
}
It seems that the inspection is launch multiple times for the same error:
In the original code, I had the inspection launched up to 6 times for both variables.
In the inspection panel, it's actually not so bad:
But in the XML output files PHPStorm export, we find the duplicates again.
The inspection should only be fired once for every variable and the XML output file should only contain a single occurence of it.
Additionnal details
I'm trying to build a tool to parse the xml files and report resolved inspections and new inspections between each import of the files. This bug is very problematic as the inspections are not even sorted the same way as two consecutive inspections would be and it mess up my tool.
Thanks!
Declining, this is desired behaviour - it helps to see which code branches are affected.
Would it be possible to make sure inspections from the same code are reported consecutively at least? In the xml file it looks like this:
"Error line 10"
"Error line 10"
"Error line 12"
"Error line 12"
"Error line 10"
"Error line 10"
"Error line 12"
"Error line 12"
I could consider them separate errors as there is no way to know it's the same issue, but at least it would be coherent with the rest of the file format.
Thanks
Oh, addressing this should not be a problem!
Great! Thanks!
Hey, sorry to bother you but this issue is quite critical for my project. Do you know when you will be able to look at it?
Thanks!
Moved on the top of issues list. I'll try to fix it Mon/Tue, will poke you with details where to take a fresh plugin version.
Great, thank you!
Hey @orklah, which PhpStorm version is it (I can not reproduce the issue for some reason)?
@orklah: can you try this binary in your environment and share feedback if the issue has been fixed (binary, btw do you know how to install plugin from the local file?)?
Hi, Thanks, i'll try that right away!
Yes, I already installed from local file a few times.
I still have the issue.
I can reproduce it very well on the attached file (I had to rename to .txt for github)
rss.txt
and it generate the xml attached (had to rename as well)
OnlyWritesOnParameterInspection.txt
It is just at the beggining of the file:
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>512</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>512</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>509</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>509</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>512</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>512</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>509</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>509</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>512</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>512</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>509</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
<problem>
<file>file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php</file>
<line>509</line>
<module>inspections_parser</module>
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/analyze_zone/wordpress-5.0.2-fr_FR/wordpress/wp-includes/rss.php" />
<problem_class severity="WEAK WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Parameter/variable is not used</problem_class>
<description>Parameter/variable is overridden, but is never used or appears outside of the scope.</description>
</problem>
There is a variable on line 509 and another on line 512 and each are reported 6 times. But in the file it's 512-512-509-509-512-512...
Thanks!
Ok, able to reproduce now, checking.
Fixed now, I updated the binary (please ensure the plugin version will be 3.0.10.2)
There are less cases but still some on the same lines
OnlyWritesOnParameterInspection.txt
Is there something you can do?
@orklah : is the last comment still relevant? If so, please, file a new bug.