Re: Using Maven JXR as base for report plugin

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Using Maven JXR as base for report plugin

Enrico Olivelli
Plamen,

Il mer 23 ott 2019, 20:29 Plamen Totev <[hidden email]> ha
scritto:

> Hi,
>
> I would like to create plugin that generates test coverage report. I
> know that there are existing plugins for that, but I want the report to
> include not only line coverage but also other data such as mutation
> coverage (and maybe some code quality issues). Also I want to be able to
> generate report only for the changed lines in the last commit. To best
> of my knowledge there is no existing plugin that does that in single
> report.
>
> To create such report I need to generate HTML files from the Java
> sources files and annotate the lines with the data from the report.
> Maven JXR is great for generating HTML files but unfortunately the class
> that is responsible for generating the HTML for a single Java class
> (JavaCodeTransform) is not extensible.
>
> Do you think it would make sense to refactor it to be extensible and
> make the filters plugable so the output can be customized?


Yes, it my have sense.

As far as I know we do not have a standard way to provide extensions to
plugins, if anyone on the list has some suggestion please chime in,
otherwise I would go to make the class name (JavaCodeTransform) configurable
as a mojo parameter

Or it will be
> better to just create my own implementation using code from
> JavaCodeTransform
>
If you mean 'forking' the plugin I think it won't be a good idea, as your
fork won't receive updates from the community version

Hope that helps
Enrico

>
> Regards,
> Plamen Totev
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Using Maven JXR as base for report plugin

Plamen Totev-2
Hi Enrico,

Thanks for the reply.

On 24.10.2019 г. 0:57, Enrico Olivelli wrote:

> Il mer 23 ott 2019, 20:29 Plamen Totev <[hidden email]> ha
> scritto:
>
>> Hi,
>>
>> I would like to create plugin that generates test coverage report.
> Yes, it my have sense.
>
> As far as I know we do not have a standard way to provide extensions to
> plugins, if anyone on the list has some suggestion please chime in,
> otherwise I would go to make the class name (JavaCodeTransform)
configurable
> as a mojo parameter

I don't have the plugin in mind. The plugin contains two modules -
maven-jxr and maven-jxr-plugin. I would like to use the former to
generate the HTML report but use it in my own plugin. Having the option
to annotate the reports made by JXR plugin might have value but it is
outside the scope of what I want to do.

What I have in mind is to modify JavaCodeTransform to make it
extensible(or plugable). The way it works now is to use a chain of
filters to generate the markup, but this chain is hard-coded. For
example you can't easily wrap a single line inside span tag. The filters
are implemented as private methods inside JavaCodeTransfor. A simple
change as making them protected would allow classes that extend
JavaCodeTransform to modify the generated markup.

>> Or it will be better to just create my own implementation using code from
>> JavaCodeTransform
>>
> If you mean 'forking' the plugin I think it won't be a good idea, as your
> fork won't receive updates from the community version
Not the entire code base, only JavaCodeTransform .

Regards,
Plamen Totev

p.s. Enrico, sorry for spamming you with personal mail. I need to pay more
attention to how the "reply" button works :)