#[cfg_attr(tarpaulin, skip)] allows according to the documentation to skip either a function or a module from the coverage. It works great when putting it directly on a function but if I want to ignore a whole module it won't work.
Let's say I have my main.rs file which declares a ignore_me module located at ./ignore_me.rs, this following snippet won't achieve the skip.
#[cfg_attr(tarpaulin, skip)]
mod ignore_me;
The problem is that no module is redefined in the target file because thanks to how rust namespacing works, you are already in the right module. So there is no way to put the macro "directly" on to the module other that the way I showed above (or maybe there is, so I would love to hear about it !) and putting the macro on top of every single function/trait in the module is very heavy.
To be clear, tarpaulin will still work well and report everything that needs to be, it just won't ignore the targeted modules.
Ah it must only work on inline modules then. I'll look at the work to update the source analysis to ignore external modules and let you know when it's done.
Woh thanks for your fast answer. Just so you know, It looks like the #[cfg(test)] on external modules is also not taken into account when you run tarpaulin with --ignore-tests (not ignored). Works great on inline #[cfg(test)] though.
Ah that makes sense as well. I don't think with the current method there's any guarantee on the order files are parsed. So it might involve retrospectively going back and marking files that have been parsed as ignored. Might be a bit fiddly but I know what needs doing :smile:
So I'm working on this now. But I did remember tarpaulin has an --exclude-files command for the #[cfg_attr(tarpaulin, skip)] on a mod x; use-case.
Still working on this but it could help you out in the meantime.
So sorry about the delay but I've just got this finished, tested and added into tarpaulin! You can try it out on the develop branch and let me know if there are anymore issues :+1:
I'll test this today and give you some feedbacks.
It looks good to me ! Can you comment here again when it will be published ?
So I pushed the release out now, so it'll be published once the travis build finishes. So given past experience roughly half an hours time :+1:
Most helpful comment
Ah that makes sense as well. I don't think with the current method there's any guarantee on the order files are parsed. So it might involve retrospectively going back and marking files that have been parsed as ignored. Might be a bit fiddly but I know what needs doing :smile: