There is one set of exclusions for both check and report. I cannot rerun 
locally so that takes a while. But my point remains that it behaves as if 
the check uses the single-digit to compute the total in the first place.
As you see, the report shows 73%, whilst the check reports 0.6. With more 
digits it would still be 0.6xx. Or, with different rounding, still 0.7 < 
73%. The precision - or the lack thereof - appears to be applied to 
internal calcs as well. Adding precision is a workable workaround, but I do 
see a bug here. There is a discrepancy more than explainable by rounding at 
output formatting only.

On Friday, 10 December 2021 at 16:21:40 UTC+10 Marc R. Hoffmann wrote:

> Hi Joris,
>
> the output formatting of the check goal is determined by the precision 
> given in the limit configuration. Can you please change the config to
>
>    <minimum>0.700</minimum>
>
> and show me the new output? (see 
> https://www.jacoco.org/jacoco/trunk/doc/check-mojo.html)
>
> Also note that the report goal and the check goal are independent from 
> each other. If you have any excludes configured in the report goal make 
> sure you have the same configuration in the check goal.
>
> Regards,
> -marc
>
>
> On 10. Dec 2021, at 01:00, Joris van der Geer <jor...@gmail.com> wrote:
>
> Sure, it is the "0.6" versus "73%" discrepancy, caused by the checker.
>  
> Abbreviated config in pom.xml:
>
>                 <id>jacoco-check</id>
>                 <phase>prepare-package</phase>
>                 <goals>
>                   <goal>check</goal>
>                 </goals>
>                 <configuration>
>                   <rules>
>                     <rule 
> implementation="org.jacoco.maven.RuleConfiguration">
>                       <element>BUNDLE</element>
>                       <limits>
>                         <limit 
> implementation="org.jacoco.report.check.Limit">
>                           <counter>COMPLEXITY</counter>
>                           <value>COVEREDRATIO</value>
>
> *                          <minimum>0.7</minimum>*                        
> </limit>
>                       </limits>
>                     </rule>
>                   </rules>
>                 </configuration>
>
> Maven output error :
>
> Rule violated for bundle mybundle: complexity covered ratio is *0.6*, but 
> expected minimum is *0.7*
>
> Output report table :
>
>             Missed Instructions  Cov.  Missed 
> Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classe
> a           3352,171                    86%  72172                    70%  
> 78        218   88         581     8            88             0          
>  12 
> b           120731                       85%   3078                      
> 72%  39        95     34         244    9            41             0      
>        4
> c            64480                         88%   614                      
>   70%   9         48    13         110     3            38             0    
>          7
> d           59434                          88%   917                      
>   65%   9         23     7           98       0            10            0  
>             2
> e           39512                          92%   319                      
>   86%   6         43    12         113     3             32            0    
>          7
> f           271,801                       98%   341                        
>  93%   4         47     7          132     1             25            0    
>          5
> g          44                               100%  4                        
>      100%  0          3      0            10     0                1        
>     0             1
> h                                              100%                        
>           n/a    0           3     0              3     0                
>  3            0             1
> Total    644 of 6,833               90%  123 of 468             *73%* 145  
>     480  161      1,291 24          238            0             39
>      
> Created with JaCoCo <http://www.jacoco.org/jacoco> *0.8.5*.201910111838
>
> On Friday, 10 December 2021 at 08:50:48 UTC+10 Marc R. Hoffmann wrote:
>
>> Can you please show the configuration of your check goal the the exact 
>> output you see?
>>
>>
>>
>> On 9. Dec 2021, at 23:21, Joris van der Geer <jor...@gmail.com> wrote:
>>
>> The value as used in Maven's 'JaCoCo report check' limit is rounded the 
>> wrong way. As you see, the report shows 72%, yet the error messasge from 
>> the check says it is 0.6. That is the discrepancy. Likely the check does 
>> not use the 'total' field but does its own averaging the wrong way.
>>
>> On Friday, 10 December 2021 at 08:14:58 UTC+10 Marc R. Hoffmann wrote:
>>
>>> Hi Joris,
>>>
>>> The limit for mnimum coverage is incorrectly computed by averaging 
>>> rounded numbers, instead of rouding the average.
>>>
>>>
>>> This is not how JaCoCo reports work. The coverage percentage is always 
>>> covered items divided by total items on the respective granularity. Nowhere 
>>> we do calculate an “average” value.
>>>
>>> Regards,
>>> -marc
>>>  
>>>
>>> On 9. Dec 2021, at 23:06, Joris van der Geer <jor...@gmail.com> wrote:
>>>
>>> The limit for mnimum coverage is incorrectly computed by averaging 
>>> rounded numbers, instead of rouding the average.
>>>
>>> A discrepancy of well over 10% can result between the HTML summary 
>>> report and the pass/fail criterion.
>>>
>>> For example, if the limit is set at 0.7 - note, one decimal - , and the 
>>> summary table shows 72% in the HTML report, then the limit is taken as 0.6, 
>>> equivalent to 60%
>>>
>>> That is 12% off. The problem is that the average is calculated over 
>>> rounded  / truncated numbers, instead of rounding the result. This 
>>> aggravates rounding errors due to accumulation. The actual difference 
>>> between rounded and not rounded gets inflated by each element.
>>>
>>> HTML report :
>>>    
>>>    - a               70%
>>>    - b               72%
>>>    - c               70%
>>>    - d               65%
>>>    - e               86%
>>>    - f                93%
>>>    - g               100%
>>>    - ----------------------
>>>    - average   73%
>>>
>>>
>>> JaCoCo version 0.8.5.201910111838
>>>
>>> Maven build : "Rule violated for bundle mybundle: complexity covered 
>>> ratio is 0.6, but expected minimum is 0.7"
>>>  
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "JaCoCo and EclEmma Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to jacoco+un...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jacoco/5d4469de-4955-4ce3-9395-7c91615978aen%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jacoco/5d4469de-4955-4ce3-9395-7c91615978aen%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>>
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "JaCoCo and EclEmma Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jacoco+un...@googlegroups.com.
>>
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jacoco/2160d4ea-8e51-4cb3-af4c-c2705f30845dn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jacoco/2160d4ea-8e51-4cb3-af4c-c2705f30845dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jacoco+un...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/45fbb104-be08-4070-8dae-8ba92556aa02n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/45fbb104-be08-4070-8dae-8ba92556aa02n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/550bf95a-a866-4028-b7fa-ea0d810ac655n%40googlegroups.com.

Reply via email to