My coverage report is not at 100% because I have a couple of #inspect methods in my classes which I use for debugging purposes. Is there a way to configure SimpleCov to ignore all the inspect methods?
Asked
Active
Viewed 3,370 times
1 Answers
27
I know I'm late to this, but I had to do the same thing and discovered the solution.
Wrap your code with # :nocov:
comments like so:
# :nocov:
def my_debug_method
do_something
end
# :nocov:
Documentation here: http://rubydoc.info/gems/simplecov/SimpleCov/Configuration#nocov_token-instance_method

Marc Greenstock
- 11,278
- 4
- 30
- 54
-
this works, but is there no way of globally defining methods to ignore everywhere in the code, based on name (+ namespace ?) . Just like the original question that asked how to ignore methods named `#inspect`, say I want to ignore methods named `to_s`, but I dont want to add two lines (`# :nocov:`) for every class that has the `to_s` method in my code – Alexis Delahaye Jul 03 '19 at 13:43