Thursday, November 12, 2015

ScanMyCode : A Code Count Generator

Recently I was sitting around wondering just how much code I had in a project I've been working on single handedly for the last couple years. Since there are programs out there that do this today I thought the best approach would be to write one myself.

The main aspects I wanted to gather were total files of each type and their line count minus blank lines. I also thought I would write a few lines of code to capture the method count as well.. why not... :)

So in order to complete the task I had to create a Java application which takes the base directory and a report name. I would then generate both a HTML and a CSV file after the code was finished. I used maps for files, lines, and methods. Then I used a collection of type Extension (custom class) and used a comparable to sort it by lines of code.

The output of the HTML report looks like the following screenshot.

The code can be found at my github account:

No comments:

Post a Comment