trezona-lecomte / coverage Goto Github PK
View Code? Open in Web Editor NEWEmacs minor mode for Code coverage highlighting
Emacs minor mode for Code coverage highlighting
Currently we will automatically detect the project root if the project uses git, however for any other version control root the user will have to manually customise the coverage-dir
.
At the moment the way coverage-mode
is built it redraws all of the buffers in coverage-buffer-list
regardless of whether they've changed or not.
The first step towards optimising this is to only redraw buffers when the results for that project have changed. This will likely need to rely on the timestamp of the results.
Hi, thanks for a great plugin!
I had an issue where SimpleCov is generating .resultset.json
with capital letter for drive ("C:
") but coverage.el
expects a lower-case value ("c:
"). The case of all other characters in the file-path match, and I am able to rectify the situation by lower-casing the letter in the .resultset.json
file.
I spent some time trying to patch SimpleCov so that it would generate the filenames in the expected format, but then I realised that the problem wasn't with the generated, or expected typecase, but with the means of comparison.
I modified coverage.el
as follows. I don't know if you want to add this directly to your code since it may not be desired on other platforms but I provide here in case others are having similar issue.
I'm not very experienced with lisp, so there may be a neater way to do this, but for now rather than performing a straight associative lookup, it will iterate the keys and perform a case-insensitive comparison returning the first that matches.
Best,
Rob
(defun coverage-get-results-for-file (target-path result-path)
"Return coverage for the file at TARGET-PATH from RESULT-PATH."
(cl-coerce (cdr
(car
(cl-remove-if-not 'identity
(mapcar (lambda (l)
;; === Begin New ===
(seq-find
(lambda (x)
(string-equal
(downcase target-path)
(downcase (symbol-name (car x)))))
(cdr (assoc 'coverage l)))
;; === End New ===
;; (assoc-string target-path
;; (assoc 'coverage l))
)
(coverage-get-json-from-file result-path)))))
'list))
Currently we re-read all of the coverage results from the .resultset.json
file every time coverage-redraw-buffers
is evaluated, which is every 1 second at the moment. Instead, let's check the timestamp
field first and only read the results if it has changed.
I'm trying to run coverage on doom-emacs and am getting an error:
Error running timer ‘coverage-redraw-buffers’: (wrong-type-argument number-or-marker-p (lines . [1 1 1 1 1 nil 1 1 nil 1 nil nil nil nil 1 nil 1 4 4 nil 4 4 nil 1 nil 1 nil 2 nil nil nil nil 1 1 1 nil nil nil nil nil nil 1 nil 1 nil 1 nil nil nil 4 nil 1 nil 1 0 nil 0 nil nil nil nil nil nil 0 nil nil nil nil nil 1 nil 1 nil nil nil nil nil nil 1 nil nil nil 1 nil 1 nil nil nil])) [3 times]
The project is a standard Rails project and the .resultset.json file looks like:
"RSpec": {
"coverage": {
"/home/martin/work/scentre/identity_service/app/controllers/auth0/change_email_controller.rb": {
"lines": [
1,
1,
1,
null,
1,
8,
8,
6,
null,
6,
2,
2,
2,
null,
null,
4,
2,
null,
2,
null,
null,
6,
null,
null,
1,
null,
1,
12,
null,
null,
1,
4,
8,
null,
null,
null
]
},
....
Any ideas on what the issue may be?
I'm using Rails 3.2, RSpec, SimpleCov & emacs 25. When I run my tests it creates a coverage directory and it has a .resultset.json file but I'm getting this error in my Messages buffer;
Error running timer ‘coverage-redraw-buffers’: (search-failed "\"timestamp\": [0-9]+")
Do you plan to support different languages?
I've created highlighting for jest JavaScript converage json file (probably will work also with jasmine) Take a look here https://github.com/jcubic/jest-coverage.el
What about PHP I think that I will extend my mode to include php as well (the coverage file is xml based).
Please add a tag so that Melpa Stable creates a package. Currently Melpa Stable only has 0.3.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.