Extracting PMD report details without using I/O

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

Extracting PMD report details without using I/O

Caleb Knox
Hi,

I posted this on StackOverflow, but was recommended to reach out to the mailing list. As well, the forums seem to be quite dead.

From SO:

"I am trying to generate a PMD report by using a custom ruleset. The input is a bunch of Apex classes in String format. Without outputting to a file, I'd like to then parse the report contents directly (XML format) to create a summary of violations, begin/end lines, priority, the rule name, and the message attached. This is to be done on multiple bodies of Apex code, adding to a report bean every time there is a violation.

I was trying to do this with SourceCodeProcessor, but couldn't figure out what some of the required objects/arguments looked like, nor how they were built. I still don't know how to make a RuleContext object property.

Any help is massively appreciated."

I was recommended by Johnco to pursue basically rewriting doPMD for my own needs, however, I am having some trouble. Mostly, with creating a RuleContext (not much documentation and my investigative skills are weak as I am a beginner) and a listener for the report.

If anyone has any further insight, please let me know.

Also, please let me know if this is the right way to use this mailing list.

Thanks much.

--
Caleb Knox

Endeveran

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Pmd-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/pmd-devel
Reply | Threaded
Open this post in threaded view
|

Re: Extracting PMD report details without using I/O

Juan Martín Sotuyo Dodero

Hello Caleb, Johnco here.

Following on my response on Stackoverflow (https://stackoverflow.com/questions/45043725/how-do-i-get-pmd-reports-the-details-therein-without-using-i-o)…

The RuleContext is straightforward to create (see how doPMD does it here), and if using the approach I suggested all the setup is done by PMD itself.

All the APIs you need to use are public. You don’t need to “modify” the PMD source, you can simply use pmd-core and pmd-apex modules as dependencies and use them directly from your application code.

Regards,


On Wed, Jul 12, 2017 at 11:37 AM, Caleb Knox <[hidden email]> wrote:
Hi,

I posted this on StackOverflow, but was recommended to reach out to the mailing list. As well, the forums seem to be quite dead.

From SO:

"I am trying to generate a PMD report by using a custom ruleset. The input is a bunch of Apex classes in String format. Without outputting to a file, I'd like to then parse the report contents directly (XML format) to create a summary of violations, begin/end lines, priority, the rule name, and the message attached. This is to be done on multiple bodies of Apex code, adding to a report bean every time there is a violation.

I was trying to do this with SourceCodeProcessor, but couldn't figure out what some of the required objects/arguments looked like, nor how they were built. I still don't know how to make a RuleContext object property.

Any help is massively appreciated."

I was recommended by Johnco to pursue basically rewriting doPMD for my own needs, however, I am having some trouble. Mostly, with creating a RuleContext (not much documentation and my investigative skills are weak as I am a beginner) and a listener for the report.

If anyone has any further insight, please let me know.

Also, please let me know if this is the right way to use this mailing list.

Thanks much.

--
Caleb Knox

Endeveran

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Pmd-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/pmd-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Pmd-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/pmd-devel