W3C home > Mailing lists > Public > public-qa-dev@w3.org > December 2006

[css-validator] counting listed warnings

From: olivier Thereaux <ot@w3.org>
Date: Fri, 15 Dec 2006 00:19:20 +0900
Message-Id: <BE31B25F-7B80-43BE-A818-A53C4741F872@w3.org>
To: QA Dev <public-qa-dev@w3.org>, Philippe Le Hegaret <plh@w3.org>, Sijtsche Smeman <sijtschesmeman@wanadoo.nl>

Hello Java gurus,

I have a small question with the CSS validator I think some of you  
may be able to enlighten me about.

Context: in recent changes to formatting and styling of CSS validator  
results, we've made the warnings (and validated stylesheet) invisible  
and toggle-able.
see: http://qa-dev.w3.org:8001/css-validator/validator?uri=http%3A%2F% 

I think it would be much better, in terms of UI, to have:
* _Warnings (12)_
instead of:
* _Warnings_

My problem is that the only "number of warnings" currently available  
through the Warnings class interface is the *total* number of  
warnings, and unless the validator is running in "show all warnings"  
mode, this is not the number we want to display.

I would like to get the number of warnings currently listed, i.e the  
number of warnings up to a certain level.

I have looked at a few ways this could be achieved, can you tell me  
which is the best way, or suggest better, and if possible help with  

1) I first thought of just counting them within the produceWarning()  
routine in org/w3c/css/css/StyleSheetGeneratorHTML2.java, and pass  
that to the "general" properties variable, but due to how  
produceWarning() is called, it doesn't work.

2) Another idea would be to create another routine, similar to  
produceWarning(), which would just be called around line 465 in org/ 
w3c/css/css/StyleSheetGeneratorHTML2.java, and do the counting. But  
that sounds a bit daft, duplicating code like that.

3) Lastly, I thought the cleanest way would probably be to add new  
properties and methods to the Warnings class (org/w3c/css/util/ 
Warnings.java), allowing it to count no just the number of all  
warnings but also the number of warnings per level. It seems like the  
cleanest way, but perhaps overkill?

Thoughts, and help, welcome.
(and apologies in advance if what I'm saying is heretic in Java - I  
am not a Java coder... :) )

Thank you.
Received on Thursday, 14 December 2006 15:19:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:36:26 UTC