Questions tagged [codenarc]

CodeNarc is a static analysis tool for Groovy source code, enabling monitoring and enforcement of many coding standards and best practices.

CodeNarc is a static analysis tool for Groovy source code, enabling monitoring and enforcement of many coding standards and best practices. CodeNarc applies a set of Rules (predefined and/or custom) that are applied to each Groovy file, and generates an HTML or XML report of the results, including a list of rules violated for each source file, and a count of the number of violations per package and for the whole project.

CodeNarc is similar to popular static analysis tools such as PMD or Checkstyle. Unlike those tools which analyze Java code, CodeNarc analyzes Groovy code.

Useful Links

63 questions
2
votes
1 answer

CodeNarc - disable few rules

I am working on static Groovy scripts analysis. Only tool I've found is CodeNarc, but how can I edit rulesets, without editting CodeNarc.jar? I am calling CodeNarc from command line: java -classpath…
2
votes
1 answer

Grails Domain - Reserved Keyword Names

So I've finally introduced codenarc into my project's build process and I'm getting the following warning - GrailsDomainReservedSqlKeywordName. The problem is that I have quite a few of these warnings, namely because I've named quite a few domain…
user3240644
  • 2,211
  • 2
  • 24
  • 35
2
votes
3 answers

Grails: Turn off Codenarc NoDef rule for controller actions

Is there a way to turn off the Codenarc NoDef rule for Grails controller actions? The rule is a good practice to follow in general but since some actions return a value and some don't, we typically use def to support all variants. I looked around a…
user1866924
  • 431
  • 5
  • 17
2
votes
1 answer

Does CodeNarc work with Groovy traits?

I have a Gradle project with Groovy sources and I use CodeNarc for code quality checking. For the first time I wanted to use Groovy trait and it seems that even an empty one causes CodeNarc to fail badly: Error from…
topr
  • 4,482
  • 3
  • 28
  • 35
2
votes
1 answer

Using CodeNarc with Maven

I am trying to integrate CodeNarc with a Maven-based Groovy project. The documentation on the site for the CodeNarc Maven plugin is minimal. The usage aspects I am trying to understand are: How to point to the custom rule sets and where in the…
Michael Smolyak
  • 593
  • 2
  • 6
  • 21
2
votes
1 answer

How to generate Codenarc report for Main and Test classes using different rule-sets?

I am using CodeNarc for coding best practices in my project and it's working absolutely fine. In general Codenarc makes the report separately for all the Main classes and Test classes based on the rulesets defined in the config file(in my case…
Diganta
  • 245
  • 1
  • 7
  • 21
2
votes
2 answers

How to create customized ruleset using the codenarc plugin?

I am currently using the codenarc plugin, and I wanted to customize the codenarc ruleset property for it to check the proper indentation of my codes. Have anyone tried this? Please help. Thanks!
chemilleX3
  • 1,176
  • 5
  • 17
  • 27
1
vote
0 answers

Codenarc XML headers

My config header is
Richard Keene
  • 398
  • 3
  • 14
1
vote
1 answer

How to use CodeNarc maven plugin with groovy 2.5?

I'm using CodeNarc maven plugin to static analyze tests written in groovy. I want to update libraries to higher version and unfortunately codeNarc maven plugin version is not working with groovy 2.5. Do you have any solution for that? Maybe another…
Piotr
  • 569
  • 6
  • 20
1
vote
2 answers

hudson codenarc issue

I am developing a grails application which has codenarc plugin. And also I am using hudson build tool. I am integrating the application with hudson build tool. In the hudson I have configured violation plugin. But when I build the app I am getting…
DonX
  • 16,093
  • 21
  • 75
  • 120
1
vote
0 answers

How to install CodeNarc?

I am very new to stuff like that and I really can't understand the insufficient installation tutorial as a newbie. I use the IntelliJ IDEA on Windows where I like to add CodeNarc. I downloaded Groovy, Codenarc jar and the SLF4J jar. Then I added…
Leschge
  • 146
  • 3
  • 11
1
vote
1 answer

Where should I define properties in sonar-groovy?

I went through the https://github.com/pmayweg/sonar-groovy In README.md it specified few properties need to mention, but I am not able to identify where and in which file I have to mention them. Actual information defined in…
Sun
  • 3,444
  • 7
  • 53
  • 83
1
vote
2 answers

Codenarc plugin rules are not running in guidewire studio

I am currently working on Guidewire Studio built on top of IntelliJ. I have installed the codenarc plugin into the studio but it seems like the rules of codenarc is not running for my codes. After analyzing the codes it does not give me any…
pradyumn
  • 130
  • 13
1
vote
0 answers

CodeNarc ruleset for identifying duplicate global variables in a script

Goal : Ability, to create a custom rule set, such that, if a groovy script file has duplicate global variables defined in a groovy script, it should disallow such variable declartions in a file. I understand, this is technically a valid…
1
vote
1 answer

CodeNarc Maven Plugin

We have a project that uses Groovy extensively and we use Maven to build our artifacts. (IntelliJ as our IDE) We wanted to incorporate some automated code-style checking, and thought we might use codecarc-maven-plugin. However, since that was from…
Darius X.
  • 2,886
  • 4
  • 24
  • 51