Files: Extensions (table).
This commit is contained in:
parent
690a81dedc
commit
18b9921556
12
doc/TODO.txt
12
doc/TODO.txt
@ -54,6 +54,7 @@
|
||||
- List of authors
|
||||
- show only first 10 and rest on separate page?
|
||||
- DONE (T): author, commits (%), LOC?, first commit, last commit
|
||||
- TODO days/time as developer
|
||||
- DONE (T): Developer of the Month: month, author, commits, LOC?
|
||||
- DONE (T): Author of Year
|
||||
|
||||
@ -64,9 +65,7 @@
|
||||
- Average revisions per file
|
||||
- DONE (G) File Count by Date: x = date, y = files
|
||||
- (G) Average file size: x = date, y = lines/file
|
||||
- (T) File Extensions (or mime types from "file"?): extension, files (%), lines (%), lines/file
|
||||
- extensions: ext -> { files, lines? }
|
||||
- git-ls-files -> basename -> check ext
|
||||
- DONE (T) File Extensions (or mime types from "file"?): extension, files (%), lines (%), lines/file
|
||||
- (T) Largest Files?
|
||||
- (T) Files With Most Revisions?
|
||||
|
||||
@ -127,16 +126,9 @@
|
||||
- "Repo heatmap"?
|
||||
- LOC and Churn
|
||||
|
||||
[Graphics]
|
||||
- Use gnuplot, graphviz etc ?
|
||||
|
||||
[Usage]
|
||||
- $ statgit [-o html] /path/to/git /output/dir
|
||||
|
||||
[name]
|
||||
- statgit or gitstats (no google hits for either)
|
||||
|
||||
[Misc]
|
||||
- use sortable.js ?
|
||||
- could show some statistics from last year, month, etc... pisg-like?
|
||||
- style: tabs at top for different pages
|
||||
|
31
statgit
31
statgit
@ -11,8 +11,9 @@ import time
|
||||
|
||||
GNUPLOT_COMMON = 'set terminal png transparent\nset size 0.5,0.5\n'
|
||||
|
||||
def getoutput(cmd):
|
||||
print '>> %s' % cmd
|
||||
def getoutput(cmd, quiet = False):
|
||||
if not quiet:
|
||||
print '>> %s' % cmd
|
||||
output = commands.getoutput(cmd)
|
||||
return output
|
||||
|
||||
@ -204,6 +205,22 @@ class GitDataCollector(DataCollector):
|
||||
continue
|
||||
(stamp, files) = parts[0:2]
|
||||
self.files_by_stamp[int(stamp)] = int(files)
|
||||
|
||||
# extensions
|
||||
self.extensions = {} # extension -> files, lines
|
||||
lines = getoutput('git-ls-files').split('\n')
|
||||
for line in lines:
|
||||
base = os.path.basename(line)
|
||||
if base.find('.') == -1:
|
||||
ext = ''
|
||||
else:
|
||||
ext = base[(base.rfind('.') + 1):]
|
||||
|
||||
if ext not in self.extensions:
|
||||
self.extensions[ext] = {'files': 0, 'lines': 0}
|
||||
|
||||
self.extensions[ext]['files'] += 1
|
||||
self.extensions[ext]['lines'] += int(getoutput('wc -l < "%s"' % line, quiet = True))
|
||||
|
||||
def getActivityByDayOfWeek(self):
|
||||
return self.activity_by_day_of_week
|
||||
@ -447,6 +464,7 @@ class HTMLReportCreator(ReportCreator):
|
||||
f.write('<dt>Average file size</dt><dd>%.2f bytes</dd>' % ((100.0 * data.getTotalLOC()) / data.getTotalFiles()))
|
||||
f.write('</dl>\n')
|
||||
|
||||
# Files :: File count by date
|
||||
f.write('<h2>File count by date</h2>')
|
||||
|
||||
fg = open(path + '/files_by_date.dat', 'w')
|
||||
@ -458,6 +476,15 @@ class HTMLReportCreator(ReportCreator):
|
||||
|
||||
f.write('<h2>Average file size by date</h2>')
|
||||
|
||||
# Files :: Extensions
|
||||
f.write('\n<h2>Extensions</h2>\n\n')
|
||||
f.write('<table><tr><th>Extension</th><th>Files (%)</th><th>Lines (%)</th><th>Lines/file</th></tr>')
|
||||
for ext in sorted(data.extensions.keys()):
|
||||
files = data.extensions[ext]['files']
|
||||
lines = data.extensions[ext]['lines']
|
||||
f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%d (%.2f%%)</td><td>%d</td></tr>' % (ext, files, (100.0 * files) / data.getTotalFiles(), lines, (100.0 * lines) / data.getTotalLOC(), lines / files))
|
||||
f.write('</table>')
|
||||
|
||||
f.write('</body></html>')
|
||||
f.close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user