Line Counter 4


[ Install ]

I’m often asked how many lines of code there are in various systems. The problem is that there are many ways to answer that question. Some people care about real code, some only about certain files etc. With that in mind I’ve updated my pet Line Counter application to take in a configurable JSON doc so that you can report on file and line counts by what ever category you define. In the screenshot below I’m using the following configuration (if you create your own, just drag it onto the app to open it)

[

{"Include":true,"Category":"Azure","FileTypes":".csdef,.cscfg,.azurePubxml","SingleLineComment":"", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"Batch","FileTypes":".cmd,.bat","SingleLineComment":"REM", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"C#","FileTypes":".cs","NameExclusions":"", "SingleLineComment":"//", "MultilineCommentStart":"/*", "MultilineCommentEnd":"*/"},

{"Include":true,"Category":"C++","FileTypes":".h,.cpp,.idl,.rc,.rgs,.mc,.c,.hpp","SingleLineComment":"//", "MultilineCommentStart":"/*", "MultilineCommentEnd":"*/"},

{"Include":true,"Category":"Java","FileTypes":".java","SingleLineComment":"//", "MultilineCommentStart":"/*", "MultilineCommentEnd":"*/"},

{"Include":true,"Category":"JSON","FileTypes":".json","SingleLineComment":"", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"Nuget","FileTypes":".nuspec","SingleLineComment":"", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"PowerShell","FileTypes":".ps1,.ps1xml,.psm1","SingleLineComment":"#", "MultilineCommentStart":"<#", "MultilineCommentEnd":"#>"},

{"Include":true,"Category":"Projects","FileTypes":".sqlproj,.csproj,.ccproj,.vcproj,.vcxproj,.pbxproj,.pyproj,.rptproj,.wixproj","SingleLineComment":"", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"Python","FileTypes":".py", "SingleLineComment":"#", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"SQL","FileTypes":".hql,.sql,.udf,.prc","SingleLineComment":"--", "MultilineCommentStart":"/*", "MultilineCommentEnd":"*/"},

{"Include":true,"Category":"Text","FileTypes":".csv,.txt,.log","SingleLineComment":"", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"TypeScript","FileTypes":".ts", "SingleLineComment":"//", "MultilineCommentStart":"/**", "MultilineCommentEnd":"*/"},

{"Include":true,"Category":"VB","FileTypes":".vb,.vbs","SingleLineComment":"'", "MultilineCommentStart":"", "MultilineCommentEnd":""},

{"Include":true,"Category":"WEB","FileTypes":".svc,.php,.asp,.aspx,.ascx,.asmx,.cshtml,.xhtml,.htm,.html,.js,.css,.master,.asax,.wsdl,.disco,.tt","SingleLineComment":"", "MultilineCommentStart":"<!--", "MultilineCommentEnd":"-->"},

{"Include":true,"Category":"Wix","FileTypes":".wxs","SingleLineComment":"", "MultilineCommentStart":"<!--", "MultilineCommentEnd":"-->"},

{"Include":true,"Category":"XML","FileTypes":".vsixmanifest,.testsettings,.resx,.kht,.xml,.xsd,.xsl,.xslt,.xht,.proj,.config,.testrunconfig,.wsdl,.xaml,.targets,.tasks,.properties","SingleLineComment":"", "MultilineCommentStart":"<!--", "MultilineCommentEnd":"-->"}

]

Also new in this version  is support for multi-line comments, significant speed improvements and the ability to see what is excluded from scanning. Also new is that this software is now open source. Feel free to contribute at the project site.

 

image

Happy counting…

Mike

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s