-
Bug
-
Resolution: Unresolved
-
Minor
When cppcheck finds a missingOverride, it puts 2 <location>s in the xml. like htis:
<error id="missingOverride" severity="style" msg="The function 'reset' overrides a function in a base class but is not marked with a 'override' specifier." verbose="The function 'reset' overrides a function in a base class but is not marked with a 'override' specifier.">
<location file="derived.hpp" line="115" column="7" info="Function in derived class"/>
<location file="base.hpp" line="117" column="15" info="Virtual function in base class"/>
<symbol>reset</symbol>
</error>
Clearly, the error is in the derived.hpp file. However, the result with the cppcheck parser is that it lists this as an issue in the base.hpp file, and the derived.hpp is not even mentioned, so you are left in the dark as to where to the problem is, even though the information is available in the xml.
Proposed fix: if multiple locations, take the first, not the last. And maybe add the last as text to the detail of the issue, just like the 'info' part is added already.
I'm not sure if this information is already available in the https://github.com/tomasbjerre/violations-lib/blob/b78d51060e05717d2e733f969ef77eea56ce08ca/src/main/java/se/bjurr/violations/lib/parsers/CPPCheckParser.java of the violations library.
If it is available, then the adapter
https://github.com/jenkinsci/analysis-model/blob/main/src/main/java/edu/hm/hafner/analysis/parser/violations/CppCheckAdapter.java
needs to be improved.