Commits

Timo Paulssen committed 79becc1

fix templates and actually add the data to the files list.

  • Participants
  • Parent commits 04739ce
  • Branches vim-coverage

Comments (0)

Files changed (1)

File coverage/vimreport.py

 
 " generated by coverage.py vim support
 " this template is shamelessly stolen from nyarly/Simplecov-Vim on github
-let s:coverage = {
-   {coverage}
-   }
+let s:coverage = {%(coverage)s}
 
-let s:generatedTime = {now_timestamp}
+let s:generatedTime = %(generate_time)d
 
 function! BestCoverage(coverageForName)
   let matchBadness = strlen(a:coverageForName)
   let [hits,misses] = BestCoverage(a:filename)
 
   if (getftime(a:filename) > s:generatedTime)
-    echom "File is newer than coverage report which was generated at " . strftime("%c", s:generatedTime)
+    echom "File is newer than coverage report which was generated at " . strftime("%%c", s:generatedTime)
   endif
 
   if (! exists("s:signs['".a:filename."']"))
 let s:filename = expand("<sfile>")
 function! s:AutocommandUncov(sourced)
   if(a:sourced == s:filename)
-    call s:ClearCoverageSigns(expand("%:p"))
+    call s:ClearCoverageSigns(expand("%%:p"))
   endif
 endfunction
 
-command! -nargs=0 Cov call s:CoverageSigns(expand("%:p"))
-command! -nargs=0 Uncov call s:ClearCoverageSigns(expand("%:p"))
+command! -nargs=0 Cov call s:CoverageSigns(expand("%%:p"))
+command! -nargs=0 Uncov call s:ClearCoverageSigns(expand("%%:p"))
 
 augroup SimpleCov
   au!
 Cov
 """
 
-import sys. time
+import sys, time
 
 from coverage import __url__, __version__
 from coverage.report import Reporter
         generate_time = int(time.time())
         file_lines = [one_file_template.format(**data) for data in self.files]
         coverage_data = "\n".join(file_lines)
-        whole_result = vim_template.format(generate_time=generate_time, coverage=coverage_data)
+        whole_result = vim_template % dict(generate_time=generate_time, coverage=coverage_data)
 
         outfile.write(whole_result)
 
                 misses.append(line)
             else:
                 hits.append(line)
+
+        self.files.append(dict(file=filename, hits=hits, misses=misses))
+