I am using Perl::Tidy and Perl::Critic while testing my software on several platforms (different Linux distributions and macOS).
I now get different formatting from Perl::Tidy on Linux and macOS which makes Perl::Critic fail because the code is not tidy.
The difference is in the indentation of arguments for used modules.
For example, on Linux (Fedora with the default Perl::Tidy v20220217):
use Carp;
use English qw(-no_match_vars);
use POSIX qw(uname);
use Readonly;
and on macOS with Perl::Tidy v20220613
use Carp;
use English qw(-no_match_vars);
use POSIX qw(uname); ## qw is indented to be aligned
use Readonly;
I did not find an option to define the behaviour and cannot control the version of Perl::Tidy on all the systems where the tests are run.
Is there a way to make Perl::Tidy indent these lines consistently regardless of the version? Is there a command line option that I missed?
Currently, I am just ignoring the block:
#<<< Perl::Tidy indents "qw" differently on older versions
use Carp;
use English qw(-no_match_vars);
use POSIX qw(uname);
use Readonly;
#>>>
But maybe there is a better way.
The 20220613 version added a new option to control this alignment. From the changelog:
So if you invoke
perltidywith the-vxl='q'option on the Mac you're using, you'll get the older behavior. If this is done as part of an automated process, maybe adjust whatever is runningperltidyto check the version first to see if the option should be included or not automatically.