Resolving Codenarc Compilation Warnings

After seeing several developers on my team make simple style errors, I looked into updating our custom codenarc ruleset. Most of the rules were turned off and it had not been updated in almost 10 minor releases.  In general, the updates were wonderful. The code is cleaner and new pull requests are much easier to read! After the update; however, I noticed pages of warnings all in the style:

Codenarc Compilation Warnings
The task was still passing so I kept going for a while and made a note to fix it later.  Recently, I was digging through the Codenarc docs again and came across this:

NOTE: If a rule requiring a later compiler phase is included in the active CodeNarc ruleset and enabled and one or more of the required classes is not on the classpath, then CodeNarc will log a Log4J WARN message for each source file that contains the missing references.

in the section on Enhanced Classpath Rules

According to the documentation, the Grails plugin and Ant task support the enhanced rules, but our configuration uses the Gradle codenarc plugin which does not.  I turned off the enhanced rules and the warnings resolved.  If you are using Codenarc 0.19+ and you are seeing this error, this might be the problem for you too.

About the Author

Object Partners profile.
Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
SwiftGen with Image & Color Asset Catalogs
You might remember back in 2015 when iOS 9 was introduced, and we were finally given a way to manage all of our assets in one place with Asset Catalogs. A few years later, support […]
Managing your Helm deployments with Helmfile
As we’ve been using Kubernetes to build software delivery platforms for our clients, we’ve found Helm to be a reasonable solution to templating and managing deployments to Kubernetes.  Although templating alternatives such as Kustomize have […]
AWS CodeBuild Test Reports for Gradle builds
Although AWS documentation has instructions for adding Test Reports for a maven build they currently lack instructions for a gradle build. You can find the maven instructions here: https://aws.amazon.com/blogs/devops/test-reports-with-aws-codebuild/ Assuming you have your gradle wrapper […]
Structuring SwiftUI Previews for API Calls
SwiftUI, together with Combine and Xcode 11+, provide a powerful toolset for quickly creating an app with a native UI. In Xcode 11+, the preview pane was introduced in order to provide live snapshots of […]