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

The script will fail If no string 'clover' in clover xml #272

Open
xiak opened this issue Feb 24, 2022 · 0 comments
Open

The script will fail If no string 'clover' in clover xml #272

xiak opened this issue Feb 24, 2022 · 0 comments

Comments

@xiak
Copy link

xiak commented Feb 24, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant