diff_cover
diff_cover copied to clipboard
The script will fail If no string 'clover' in clover xml
I checked the source code vialations_reporter.py, there is only way to check the type of xml
if xml_document.findall(".[@clover]"):
# see etc/schema/clover.xsd at https://bitbucket.org/atlassian/clover/src
line_nodes = self.get_src_path_line_nodes_clover(
xml_document, src_path
)
_number = "num"
_hits = "count"
files = [
file_tree
for file_tree in xml_document.findall(".//file")
if GitPathTool.relative_path(file_tree.get("path")) == src_path
]
I used phpunit to generate clover report, Unfortunately there is no string "clover"
........ and element file has not attribute "path="
# xmllint --format coverage_report.xml | head
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1645430035">
<project timestamp="1645430035">
<file name="/data/xxxxxxxxxx/tests/Feature/Test.php">
<class name="xxxxxxxxxx\Feature\Test" namespace="global">
<metrics complexity="57" methods="12" coveredmethods="8" conditionals="0" coveredconditionals="0" statements="365" coveredstatements="320" elements="377" coveredelements="328"/>
</class>
<line num="42" type="method" name="setUpBeforeClass" visibility="public" complexity="1" crap="2" count="0"/>
<line num="44" type="stmt" count="0"/>
<line num="45" type="stmt" count="0"/>**
If there is an approach to increase robustness, such as add multiple judgments to check the file type?
Thank you