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

Parser fails when multiple classes are declared within single file #92

Closed
tania-pets opened this issue Sep 5, 2023 · 0 comments
Closed

Comments

@tania-pets
Copy link

First of all, thank you for this useful action, great job!

There is an issue when the codebase contains files that declare multiple classes. The clover.xml will look something like the below:

    <file name="{filePath}">
      <class name="{class1}" namespace="global">
        <metrics complexity="3" methods="3" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="6" coveredstatements="0" elements="9" coveredelements="0"/>
      </class>
      <class name="{class2}" namespace="global">
        <metrics complexity="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
      </class>
      <line num="17" type="method" name="xxx" visibility="public" complexity="1" crap="2" count="0"/>
      .....    
      <metrics loc="43" ncloc="40" classes="1" methods="3" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="6" coveredstatements="0" elements="9" coveredelements="0"/>
    </file>

That means a single <file> element will have multiple <class> children.

In that case, the parse will fail with ::error::Cannot read properties of undefined (reading '@_statements') here

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