Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add ability to specify patterns to be excluded from coverage report #6

Merged
merged 4 commits into from Feb 26, 2016

Conversation

Projects
None yet
2 participants
Contributor

scottclowe commented Feb 22, 2016

Closes #4.

Adds -cover_exclude option, which can be to specify patterns for directories and files which should be excluded from the coverage report. This can be used multiple times to specify multiple patterns.

The implementation method was as discussed on the thread for #4.

I have not altered README.md, so there is currently no documentation for this feature.

scottclowe added some commits Feb 22, 2016

@scottclowe scottclowe ENH: mocov_find_files.m Add exclude patterns option
Will exclude matching directories and files from the list.
172eeca
@scottclowe scottclowe ENH: Add -cover_exclude option for excluding patterns
This adds an option to the API to specify patterns which should not
be included in the coverage report.

Closes #4.
4ab5b2a

@nno nno and 1 other commented on an outdated diff Feb 25, 2016

MOcov/mocov_find_files.m
@@ -67,7 +86,9 @@
if ~ignore_fn
path_fn=fullfile(root_dir, fn);
- if isdir(path_fn)
+ if ~isempty(regexp(fn,exclude_re,'once'));
@nno

nno Feb 25, 2016

Contributor

Currently this would also exclude directories that match the pattern. Is that intended, or would it make more sense to limit this to files (not directories) only? In any case, can you please add this in the documentation (around line 15)?

@scottclowe

scottclowe Feb 26, 2016

Contributor

Fixed in commit 074542d.

@nno nno and 1 other commented on an outdated diff Feb 25, 2016

MOcov/mocov_find_files.m
@@ -67,7 +86,9 @@
if ~ignore_fn
path_fn=fullfile(root_dir, fn);
- if isdir(path_fn)
+ if ~isempty(regexp(fn,exclude_re,'once'));
+ continue;
+ elseif isdir(path_fn)
@nno

nno Feb 25, 2016

Contributor

Line 92 seems to need also the 4th argument (exclude_re) to the find_files_recursively call.

@scottclowe

scottclowe Feb 26, 2016

Contributor

Well spotted! Fixed in new commit 2c721d7.

Contributor

nno commented Feb 25, 2016

Thanks. this looks very good. I added two minor comments.
What are your thoughts about limiting this to files only, or to both files and directory?

Contributor

nno commented Feb 26, 2016

Thanks @scottclowe, looks great. I will wait for travis to finish; if it is happy, I will merge.

Contributor

scottclowe commented Feb 26, 2016

I fixed the two issues you picked up on. Thanks for pointing them out!

I would like to be able to omit both files and directories. We could have two arguments, one which files must match and another for directories but I think this is cleaner.

There are two use-cases which this fix will improve

  1. The problem when a script/function, such as getPackagePath.m discussed on #5, needs to be kept in the same directory otherwise the code will break. This can now be omitted from coverage and so it will be left in the same place.
  2. When test functions or external code is in the same top-level folder as the code which needs to be tested, or the code base has multiple modules and each module has its own test folder within the module folder.

@nno nno added a commit that referenced this pull request Feb 26, 2016

@nno nno Merge pull request #6 from scottclowe/enh_exclude-files
NF: Add ability to specify patterns to be excluded from coverage report
41ae7db

@nno nno merged commit 41ae7db into MOcov:master Feb 26, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Contributor

scottclowe commented Feb 26, 2016

Support for this API change still needs to be implemented in MOxUnit/MOxUnit.

I can do that too if you'd like?

@scottclowe scottclowe added a commit to scottclowe/MOxUnit that referenced this pull request Feb 26, 2016

@scottclowe scottclowe API: _runtests.m Add -cover-exclude support
Added to MOcov in MOcov/MOcov#6.
560e36e

@scottclowe scottclowe referenced this pull request in MOxUnit/MOxUnit Feb 26, 2016

Merged

API: Add support for -coverage_exclude input #22

Contributor

nno commented Feb 26, 2016

@scottclowe, thanks for the offer; I would appreciate it if you could implement that in MOxUnit and send a PR.

Contributor

nno commented Feb 26, 2016

@scottclowe sent out a PR at MOxUnit/MOxUnit#22

@scottclowe scottclowe added a commit to scottclowe/MOxUnit that referenced this pull request Feb 26, 2016

@scottclowe scottclowe API: _runtests.m Add -cover-exclude support
Added to MOcov in MOcov/MOcov#6.
3394aee

@scottclowe scottclowe added a commit to scottclowe/MOxUnit that referenced this pull request Feb 26, 2016

@scottclowe scottclowe API: _runtests.m Add -cover-exclude support
Added to MOcov in MOcov/MOcov#6.
ef6b65f

@scottclowe scottclowe added a commit to scottclowe/MOxUnit that referenced this pull request Feb 26, 2016

@scottclowe scottclowe API: _runtests.m Add -cover-exclude support
Added to MOcov in MOcov/MOcov#6.
c992947
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment