Skip to content

arturo182/CodeStat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeStat

A simple program that counts lines of code and makes stats. Because we all love stats!

Creating filters

CodeStat uses filters to know what kind of files to include and exclude when counting lines. Filter is a .json file located in the filters directory, here is a sample filter:

{
	"comments": "^//.*$",
	"excludes": [
		"*~*"
	],
	"includes": [
		"*.txt"
	],
	"name": "Example filter"
}

The filter above is named "Example filter" it scans .txt files and skips files that have "~" in their name (usually backup files). Comments are determined using a regular expression.

Creating export formats

If you want to export a report created by CodeStat you have to choose one of the export formats. Export formats are also .json files but they are located in exports directory, here's a sample export format file:

{
	"name": "Textile table",
	"extension": "Textile (*.textile)",
	"prepend": "h1. CodeStat report",
	"item": "|%FILENAME%|%FILESIZE% (%FILESIZEB% bytes)|%LINES_SOURCE% (%PERCENT_SOURCE%)|%LINES_COMMENTS% (%PERCENT_COMMENTS%)|%LINES_EMPTY% (%PERCENT_EMPTY%)|%LINES_TOTAL%|",
	"append": "|*Total files: %TOTAL_FILECOUNT%*|*%TOTAL_FILESIZE% (%TOTAL_FILESIZEB% bytes)*|*%TOTAL_LINES_SOURCE% (%TOTAL_PERCENT_SOURCE%)*|*%TOTAL_LINES_COMMENTS% (%TOTAL_PERCENT_COMMENTS%)*|*%TOTAL_LINES_EMPTY% (%TOTAL_PERCENT_EMPTY%)*|*%TOTAL_LINES%*|
	_This file was generated by \"CodeStat\":http://github.com/arturo182/CodeStat on %CURRENT_DATE% %CURRENT_TIME%._"
}

When the stats are exported to a file first the prepend text is inserted, after that the item text is inserted for every file and lastly the append text is inserted.

There are some variables that can be used in export blocks

For the item block

  • %FILENAME%
  • %FILESIZE%
  • %FILESIZEB%
  • %LINES_SOURCE%
  • %LINES_COMMENTS%
  • %LINES_EMPTY%
  • %LINES_TOTAL%
  • %PERCENT_SOURCE%
  • %PERCENT_COMMENTS%
  • %PERCENT_EMPTY%

For prepend and append blocks

  • %TOTAL_FILECOUNT%
  • %TOTAL_FILESIZE%
  • %TOTAL_FILESIZEB%
  • %TOTAL_LINES_SOURCE%
  • %TOTAL_LINES_COMMENTS%
  • %TOTAL_LINES_EMPTY%
  • %TOTAL_LINES%
  • %TOTAL_PERCENT_SOURCE%
  • %TOTAL_PERCENT_COMMENTS%
  • %TOTAL_PERCENT_EMPTY%
  • %CURRENT_DATE%
  • %CURRENT_TIME%

Credits

Main icon by famfamfam.com.

About

Program for counting lines of code and creating stats. Written in Qt.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published