0

I am new to Gradle and Codenarc but I found no example showing how to exclude a package from codenarc reports.

For example, I have a groovy application that uses, for instance, the package myapp.main and myapp.legacy

I want all my ruleset applied to myapp.main but none to myapp.legacy. How can I accomplish that?

Fernando
  • 2,131
  • 3
  • 27
  • 46

2 Answers2

1

There are a couple of places where to look for such information:

  1. The Gradle User Guide, which has a chapter for each plugin.
  2. The Gradle Build Language Reference (specifically the CodeNarc task type).
  3. The samples in the full Gradle distribution.
  4. The Gradle forums.

According to 2., an include or exclude filter should do the trick. For example:

codenarcMain {
    exclude "myapp/legacy/**"
}
Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259
0

The other answer seems to be a little bit old. For codenarc documentation itself it is best to refer to its website.

As explained there you can include or exclude files, packages or classes from rules by specifying every rules' properties in the config file. An example is bellow:

CatchThrowable.doNotApplyToClassNames=BaseController,AbstractTest

FieldName.applyToClassNames=org.codenarc.CodeNarc,org.codenarc.extra.*
Ali Asgari
  • 801
  • 7
  • 18