mojohaus / cobertura-maven-plugin

Cobertura Maven Plugin
https://www.mojohaus.org/cobertura-maven-plugin/
25 stars 20 forks source link

Cobertura Maven Plugin doesn't check regex parameters #26

Open gerrit-hohl opened 7 years ago

gerrit-hohl commented 7 years ago

Hello everyone, 😄

last week I came across the following problem: I had a few classes in which I couldn't get the needed / defined branch coverage rate. So I tried to use the element in the configuration of the plugin. As only the branch coverage rate was the problem I also defined only this parameter. So it looked something like this:

                <configuration>
                    <check>
                        <regexes>
                            <regex>
                                <pattern>my.package.MyClass</pattern>
                                <branchRate>61</branchRate>
                            </regex>
                        </regexes>
                    </check>
                </configuration>

I started my Maven build and got a very odd error from Cobertura (not the plugin) that a value couldn't be parsed. After some searching and debugging I found the problem: The parameter was missing. And if that functionality is used both parameters - and are mandatory for Cobertura. But the Cobertura Maven Plugin doesn't validate that.

It would have been much easier if the plugin would have failed with an error message which pointed this out.