Use a template language for reporting

30 views
Skip to first unread message

Joris Dauphin

unread,
Sep 8, 2013, 12:46:41 PM9/8/13
to oclin...@googlegroups.com
What about use a template language as ctemplate for reporters ?

It emphasizes separating logic from presentation.

+ it will allow modifying/adding new reporting mode without coding.
+ one code for several output.

- It is not "interactive", so only useful for final output.
- it is a new dependency.

I already used ctemplate for one of my project (with only one output in my case).

Longyi Qi

unread,
Sep 9, 2013, 3:05:17 PM9/9/13
to Joris Dauphin, oclin...@googlegroups.com
A very good suggestion!


On Sun, Sep 8, 2013 at 11:46 AM, Joris Dauphin <joris....@gmail.com> wrote:
What about use a template language as ctemplate for reporters ?

It emphasizes separating logic from presentation.

+1
 

+ it will allow modifying/adding new reporting mode without coding.
 
+1 

+ one code for several output.

+1
 

- It is not "interactive", so only useful for final output.

It's okay to me, I believe the "view" should be separated from "controller". When the "view" requires additional logic, then a new or derived "controller" should be introduced.
 
- it is a new dependency.

I really worry about this.
 

I already used ctemplate for one of my project (with only one output in my case).

Is this project open sourced that I can take a look at? Thanks.

Longyi
 

--
You received this message because you are subscribed to the Google Groups "OCLint Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oclint-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Joris Dauphin

unread,
Sep 10, 2013, 4:26:51 AM9/10/13
to oclin...@googlegroups.com, Joris Dauphin
On Monday, September 9, 2013 9:05:17 PM UTC+2, Longyi Qi wrote:
A very good suggestion!

So, I will implement it. 
 
I already used ctemplate for one of my project (with only one output in my case).

Is this project open sourced that I can take a look at? Thanks.

ccccc (the name is not really good I know :-/ )

Longyi Qi

unread,
Sep 11, 2013, 10:30:50 AM9/11/13
to Joris Dauphin, oclin...@googlegroups.com
Looks like with ctemplate, we can even support a much richer HTML reporter easily in addition to what we have today.

Question, is the .tpl file converted into binary during project compilation time? Or it feels like a plugin, that even new custom templates can be added in runtime?

ccccc is a good project (except the GPL v3 license, XP), I hope to work together with you to have some cool metrics in OCLint as well. ;) 

Longyi





Joris Dauphin

unread,
Sep 11, 2013, 1:19:00 PM9/11/13
to oclin...@googlegroups.com, Joris Dauphin
On Wednesday, September 11, 2013 4:30:50 PM UTC+2, Longyi Qi wrote:
Looks like with ctemplate, we can even support a much richer HTML reporter easily in addition to what we have today.

They have nice feature to escape special characters for different format :-) 

Question, is the .tpl file converted into binary during project compilation time? Or it feels like a plugin, that even new custom templates can be added in runtime?

Both is possible.
I use external *.tpl so no recompilation is needed,
but we can embed into the executable the template.

ccccc is a good project (except the GPL v3 license, XP), I hope to work together with you to have some cool metrics in OCLint as well. ;) 

I used clang-c interface, so there is a minimal port to do. but yes, it is possible :-)

I have also some rules to implement/port :-)


I have tried to implement the ctemplateReporter:

- ctemplate2.2 doesn't support c++11, but trunk does :/ (in fact it misses some space in a macro which is bad interpreted in c++11).
- I don't know yet how to provide the *.tpl to the Reporter...
- as ctemplate doesn't manage simple calculation, I have to add some variable for some existing reporter (PDM use different priority (2*priority-1), and date format is different for one reporter).

Longyi Qi

unread,
Sep 26, 2013, 9:21:38 PM9/26/13
to Joris Dauphin, oclin...@googlegroups.com
Hi Joris,
I would suggest to put this on hold for now. We might be able to come up with something simpler just for templates without depending on another library.

If you would like to think about this instead, how easy we can come up with a serialized object for all results?

Thanks,
Longyi



Joris Dauphin

unread,
Sep 30, 2013, 4:44:36 AM9/30/13
to oclin...@googlegroups.com, Joris Dauphin
On Friday, September 27, 2013 3:21:38 AM UTC+2, Longyi Qi wrote:
Hi Joris,
I would suggest to put this on hold for now. We might be able to come up with something simpler just for templates without depending on another library.

the (unfinished) works done:

- Reporter mostly done.
- reporter template mostly done.
- No cmake stuff.

I don't continue to work on this (at least until a ctemplate release).

Longyi Qi

unread,
Nov 14, 2013, 10:00:51 AM11/14/13
to Joris Dauphin, oclin...@googlegroups.com
I am actually impressed by looking at what you have done. See, we already have three types of rules, namely source code reader rules, ast traverser rules, ast matcher rules. And it's definitely possible to have another type of reporter as an alternative.

However, I hope to keep the minimal dependencies for oclint/oclint repo, but we can definitely have a new report, maybe `oclint/oclint-ctemplate-reporter` and make our ctemplate based reporters there.

Again, thank you for your effort research into this.

Sincerely,
Longyi



--
Reply all
Reply to author
Forward
0 new messages