Helping to clean CPAN: April 2016
… where I get out my virtual broom and sweep up cruft in my assigned distribution for this month’s edition of the CPAN Pull Request Challenge.
This month’s module: Net::Redmine
Net::Redmine is an API to communicate with and carry out operations on a Redmine server.
First impressions
In this section I try to get a feeling for the state of the module, how up to date it is, how often people are contributing to it, how many other distributions are depending on it, how many bugs/issues it currently has, what the CPANTS kwalitee is, etc.
- last commit 10th Feb 2012 (https://github.com/gugod/net-redmine)
- latest release 10th Feb 2012 (https://metacpan.org/pod/Net::Redmine)
- 3 open issues in GitHub (one issue asks what one could do as part of CPAN PRC)
- 0 pull requests
- 1 open issue on RT (4 years old) (https://rt.cpan.org/Public/Dist/Display.html?Name=Net-Redmine)
- 1 reverse dependency via metacpan
- no test failures on cpantesters, but lots of “unknown”, “invalid” or “na” builds: http://matrix.cpantesters.org/?dist=Net-Redmine+0.09
- CPANTS report (http://cpants.cpanauthors.org/dist/Net-Redmine)
- core metrics: all ok
- extra metrics
- META.yml doesn’t declare Perl version
- experimental metrics
- META.yml doesn’t have a provides section
- build prereq doesn’t match usage
Initial inspection of the source code
After forking the repo and cloning a local copy, let’s have a look at the project to see what build system it uses, if the test suite works and the tests pass, if it could do with a Travis-CI config file (or if present, if it can be updated).
- uses Module::Install (which is deprecated) -> convert to EUMM?
- README is simple text. Convert README to markdown? Mention module purpose in README (which is only mentioned in module pod)?
- no Travis-CI config; add a .travis.yml?
- uses
Any::Moose
which is deprecated in favour ofMoo
cpanm --installdeps .
fails due to syntax error inMakefile.PL
- running
perl Makefile.PL
fails with the same error - this is a
Module::Install
problem and means that theModule::Install::AuthorTests
module is missing cpanm Module::Install::AuthorTests
- afterwards
cpanm --installdeps .
works - … however
HTML::WikiConverter
(a dependency ofHTML::WikiConverter::Markdown
, which is required forNet::Redmine
) fails its tests:
- one problem with
HTML::WikiConverter
is simply a pod coverage test:
- the other issue was:
- … which merely means that the test website no longer exists
- one could move on by simply using the
--notest
option tocpanm
, or submit a patch toHTML::WikiConverter
. Unfortunately,HTML::WikiConverter
is only a gitpan account on GitHub (and hasn’t seen a release since 2009) so--notest
looks like the way to go in this case. - now
perl Makefile.PL
runs to completion- one warning:
Cannot determine perl version info from lib/Net/Redmine.pm
- one warning:
make test
now passes, however gives warnings:
- … which should be documented somewhere, because it’s not documented in the module, and …
- hence
Test::Spelling
andTest::Perl::Critic
should be installed as well cpanm Test::Spelling Test::Perl::Critic
- Now we have spelling and perlcritic test errors…
-
the warning message concerning
SD_REDMINE_RAILS_ROOT
is incorrect; the correct environment variable isNET_REDMINE_RAILS_ROOT
. -
need a redmine server to be installed and running. To get this going, follow the following steps:
- it turns out that the module requires at most Redmine version 1.4.7,
since it needs the
scripts/runner
andscripts/server
scripts, which are no longer available from Redmine version 2.0.0
Code Coverage
Looking at the code coverage can give an indication of code quality. If the project is well covered, this means most changes made in pull requests can be made with some confidence that any problems will be caught by the test suite. If the code coverage is low, then this is something that one could address as a pull request (or set of pull requests).
In EUMM and Build::Module
projects, one simply needs to install
Devel::Cover
and run
In Dist::Zilla
projects, one needs to install the
Dist::Zilla::App::Command::cover
plugin, after which the code coverage can
be checked via:
In this distribution (without NET_REDMINE_RAILS_ROOT
env setting), the
coverage is:
24.7% statement coverage; 21.8% total coverage
With the NET_REDMINE_RAILS_ROOT
setting
the coverage climbs to
40.0% statement coverage; 35.3% total coverage
which is still quite low and could do with improving.
Overview of the pull requests made
- correct
SD_REDMINE_RAILS_ROOT
toNET_REDMINE_RAILS_ROOT
(https://github.com/gugod/net-redmine/pull/4) - fix spelling test error (https://github.com/gugod/net-redmine/pull/5)
Conclusion
I was a bit disappointed with my effort this month: only two pull requests and many, many things I still could have looked at. For instance I’d planned to do at least these things:
- declare minimum Perl version (perlver report 5.6.0 as min version)
- fix spelling and perlcritic test errors
- add a .travis.yml
- fix
SD_REDMINE_RAILS_ROOT
env var warning and document what var is used for - document development installation instructions
- rename
t/net_redmine_test.pl
tot/net_redmine_test.t
?
I was especially disappointed since I’d wanted to try this module out at $work, since we use Redmine as a wiki and trouble ticket system. At the very least it would have been interesting to see how to use the module in a live environment. Unfortunately, due to time constraints the things on my TODO list just didn’t happen. Perhaps these ideas can be useful to someone else’s upcoming Pull Request Challenge assignment.