How can I run Test :: Perl :: Critic in parallel?

I wrote a simple test case based on Test :: Perl :: Critic that runs critic in every source file in the repository ( all_critic_ok ). However, this test takes a lot of time, especially since I also use the Perl :: Tidy policy.

Usually criticizing different files is independent of other critics, so I thought I could parallelize these tests. As it turned out, TAP :: Harness can really parallelize tests, but only by file, and not by criterion.

How would you parallelize these tests? A workaround will be implemented.

+4
source share
2 answers

Hack # 68 in Perl Hacks has a recipe for continuing tests using PersistentPerl . You may be able to adapt it for this purpose.

+3
source

If you have a large number of files, then creating multiple Test :: Perl :: Critic test scripts might not be such a bad idea. For example, Perl-Critic has three Test :: Perl :: Critic scripts: one for checking application code, one for test code and one for * .run files. And each of them uses a slightly different set of rules.

So, if you can split your code into at least two logical groups and create separate Test :: Perl :: Critic scripts for them, then you can get at least 2x performance improvement by running them in parallel with Tap :: Harness.

Alternatively, you can activate the PPI cache (see the Test :: Perl :: Critic documentation for instructions). But this will only reduce performance.

If you are really interested in getting Test :: Perl :: Critic to work in parallel, then you can add your own code. You can register the commit bit at http://perlcritic.tigris.org .

0
source

All Articles