btkelly / gnag

A Gradle plugin that helps facilitate GitHub PR checking and automatic commenting of violations.
http://gnag.watch
Apache License 2.0
125 stars 14 forks source link

How to use detekt's XML report? #222

Open jcornaz opened 5 years ago

jcornaz commented 5 years ago

Hello,

This plugin seems great, and we are eager to use it.

However, we already have detekt setup with baselines, and even custom rules we wrote ourselves.

So how can we tell Gnag to simply let our detekt plugin do its work and use the detekt XML report?

stkent commented 5 years ago

Hi @jcornaz!

Gnag is designed to make it easy to add checkers to your project without requiring much (or any) custom configuration. As such, it is not set up to handle cases like yours (where you are providing quite a bit of custom configuration).

I see a couple options for how we could add "escape hatches" to Gnag to allow full customization of embedded tools:

  1. Add a catch-all parameter to the configuration blocks for each tool to accept a raw string of options to be passed to the underlying tool.
  2. Add the ability to specify custom paths to report files from external tools, and then process those files only (rather than first generating them). In your case, this option would mean you'd disable Detekt in the gnag configuration block, then point Gnag to the output of your customized Detekt task instead. There might also need to be some task dependency setup in this case to ensure the file is fresh when Gnag needs it.

Ultimately this is @btkelly's call to make - let's see what he thinks!

jcornaz commented 5 years ago

Gnag is designed to make it easy to add checkers to your project without requiring much (or any) custom configuration. As such, it is not set up to handle cases like yours (where you are providing quite a bit of custom configuration).

That's very unfortunate. I just wanted a tool to automatically comments pull requests based on the detekt's finding. It looks like Gnag is not what I was looking for.

Fleshgrinder commented 4 years ago

Even a trivial setup in which you just want to use buildUponDefaultConfig = true is not possible, basically forcing you to copy the complete detekt configuration into your repository.