You are on page 1of 6

CodeNarc analyzes our code for defects, bad practices, inconsistencies, style

issues and more. A flexible framework for rules, rulesets and custom rules means
it's easy to configure CodeNarc to fit into your project.

Below are the steps to configure code narc in local:

1. Please take the files from codenarc open source (the Apache Ant in this folder is
already there if you have setup the GW studio)

2. Copy “tools” folder from shared directory to


C:\Ent-Std\WorkSpace- 8.0\PolicyCenter\modules\ant
3. Copy and replace build.xml from shared directory to
C:\Ent-Std\WorkSpace-8.0\PolicyCenter\modules\ant.

4. If you have already done the environment setup for Guidewire and will debug your
Gosu classes only than skip the below step.

Set up environment variable for user variables as follows with below key value pair,
Please make sure you are referring to the correct path while configuring environment
variable
ANT_HOME
C:\Apache\apache-ant-1.8.2

JAVA_HOME
C:\Program Files\Java\jdk1.7.0_51

path
%JAVA_HOME%\bin;%ANT_HOME%\bin;

5. Create a Folder in “C:\Ent-Std\WorkSpace-8.0\PolicyCenter\modules\ant” named


Source.
NOTE: We have to run this 2 times. 1st before making the changes to the files 2nd
after making the changes to the files.
Keep those files in this folder on which you think we would be making the changes
particular card.

6. Now open build.xml from C:\Ent-Std\WorkSpace-8.0\PolicyCenter\modules\ant and


go to line number 500 and modify the packaged to be scanned as follows.
Change this to -> /modules/ant/Source

 We can also Change the report name by going to the Line no -13.

7. Now open cmd prompt from C:\Ent-Std\WorkSpace-8.0\PolicyCenter\modules\ant


directory and execute below command

COMMAND:
ant gosu-codenarc -v -f build.xml –Dgosu-codenarc.report.name=MyReportName

8. After command run successfully, go to

C:\Ent-Std\WorkSpace-8.0\PolicyCenter\modules\ant\tools\gosu-
codenarc\reports,

There must be a report created with name GosuCodeNarcReport.html. There are some
sample reports for reference in the same location.
Note:
Below is the location where the you can find the gosuruleset.xml which consists
all the configurable gosu parameters and those parameters are highlighted in the
report which needs to be corrected
Mark that in the build.xml we can define the type of file which will be scanned in
the defined package, right now we are able to do for “gs” and “gsx” only.

You might also like