I wanted objective criteria for the quality of the code, and of course I remembered my long-standing achievements (a collection of non-functional tests, see
here and
here ).
Even then, the idea was to arrange them not as a collection of tests, but as a separate utility, but we managed to do it only now, we meet
perlqual (from perl quality).
While transferring previously accumulated tests, I added only a check on DELMEAFTER (to write DELMEAFTER 2016-01-01 in the code and test that I forgot to delete).
As I repeatedly wrote, tests cannot determine good code, but they can detect bad ones. Although with the current fashion for neural networks with deep learning, you can try to make a robot that will recognize good code, but for this you need to have a very large code base for which we know for sure that it is good, I don’t think that
CPAN will go beyond the standard.
So, good code means:
- code that is covered by tests by at least 70% - 100% is not always easy to achieve, but below 70 means that there are simply no tests
- code whose complexity metrics do not go beyond the recommended limits
- code that complies with Perl Best Practice recommendations
- code adhering to a single coding style
- code in which nothing is left forgotten (debugging, marks)
- code decorated in the standard distribution
- code with documentation
All parameters of these checks are configured in the config, the default config lives in the script itself in the __DATA__ section, you can put a copy in your homepage or in the project folder and customize it.
The utility displays the result in
TAP format and I think it will be useful for a preliminary assessment of the code prior to code review.
It is clear that he was doing for himself and perhaps not everywhere turned out to be quite universal, therefore, comments and suggestions are welcome.
I hope the utility will be useful.