Questions tagged [perl-tidy]

Perl::Tidy parses and beautifies Perl source code.

perltidy : a perl script indenter and reformatter

Wikipedia

42 questions
18
votes
4 answers

Perl::Critic: Life after Moose?

I've started a conversion of a project to Moose and the first thing I noticed was that my critic/tidy tests go to hell. Moose, Tidy and Critic don't seem to like each other as much as they used to. Are there docs anywhere on how to make critic/tidy…
claco
  • 739
  • 1
  • 8
  • 18
16
votes
5 answers

How can I automatically tidy up Perl source code?

A cat at my company walked over a keyboard and has left a valid 1000+ line of executable Perl code for me to maintain. Thanks to Perl's TMTOWTDI philosophy I find myself searching Google to make sense of every line of code she has produced. To add…
Ankur Gupta
  • 2,284
  • 4
  • 27
  • 40
12
votes
4 answers

How can I make perltidy work with Method::Signatures?

I'm using Eclipse combined with EPIC to write my Perl code. I configured EPIC to use Perltidy with "-pbp" (perl best practices style) to format my code. This doesn't work well when using Method::Signatures' named parameters. E.g., func (:$arg1, :…
David B
  • 29,258
  • 50
  • 133
  • 186
11
votes
1 answer

Configuring Perl::Tidy to handle custom keywords

Is there a straightforward way to configure Perl::Tidy so that it handles correctly custom keywords created with Devel::Declare? Specifically, I am using Sub::Curried, which creates a keyword curry that works more or less like sub with method…
scozy
  • 2,511
  • 17
  • 34
10
votes
2 answers

Perltidy autoformat hashref as parameter

I have the following code snippet: my $obj = $class->new({ schema => $schema, reminder => $reminder, action => $action, dt => $dt, }); My problem is, that perltidy tries to format it into something, like this: my…
Davs
  • 489
  • 4
  • 12
8
votes
2 answers

How can I prevent PerlTidy from aligning assignments but keep adding single spaces?

How can I prevent PerlTidy from aligning assignments but keep adding single spaces? This question is similar to How can I prevent PerlTidy from aligning my assignments? but I would like single spaces to be added where directed. Due to this -naws…
agsamek
  • 8,734
  • 11
  • 36
  • 43
8
votes
1 answer

How to apply/use Perl::Tidy with an existing Perl project?

This question is not so much technical than looking for advise to find the proper approach that will not hurt. Assuming the following: We have a big application developed in Perl. We want to start using perltidy on the commandline to impose…
6
votes
1 answer

How can I prevent PerlTidy from aligning my assignments?

By default, PerlTidy will line up assignments in my code. E.g. PerlTidy changes this... my $red = 1; my $green = 2; my $yellow = 3; my $cyan = 4; ...into this... my $red = 1; my $green = 2; my $yellow = 3; my $cyan = 4; How do I prevent this…
nick
  • 1,369
  • 2
  • 13
  • 28
6
votes
3 answers

perltidy formatting complex if

How can I configure perltidy to format long if statements like this: if ( ('this is an example' =~ /an.*example/ and 1 * 2 * 3 == 6) or ('hello world' =~ /world/ and 6 = 3 * 2 * 1) ) { print "hello\n"; } or like this if ( ('this is…
bliof
  • 2,957
  • 2
  • 23
  • 39
5
votes
2 answers

How can I format boolean operators with perltidy?

To my knowledge, perltidy is extremely handy and helpful when it comes to code formatting. However, I haven't found a way to fine-tune perltidy. For example, I need the && and || formatted so that there are two spaces before and after them. Like…
5
votes
4 answers

How can we catch side comments using Perl::Tidy or Perl::Critic?

My department is currently settling on some general code best practices, which we would like to somewhat enforce, providing developers with Perl::Tidy and Perl::Critic configurations. Now we are having problems with side comments. The side comment…
Nikolai Prokoschenko
  • 8,465
  • 11
  • 58
  • 97
4
votes
1 answer

Convincing Perltidy to leave whitespace alone

I am using Perltidy to reformat a few of my old Perl files to a style that is closer to my current preferences. I encountered an issue with this snippet: Fcntl::S_IRUSR & $mode Perltidy insists on removing the space after the & token, resulting…
thkala
  • 84,049
  • 23
  • 157
  • 201
4
votes
2 answers

Why is perltidy going to stdout?

I have a bash command, get-modified-perl-files, that returns all the Perl files I have modified in my repository. I would like to use perltidy on all of these files. I created a bash function to do the job: tidy() { for f in…
Pierre
  • 1,942
  • 3
  • 23
  • 43
4
votes
1 answer

Perlcritic not recognising code that has been tidied

I'm using perlcritic with perltidy and while the other rules are applied, I'm, getting the following error message: Code is not tidy at line 1, near 'package MyPackage;'. I've run perltidy to tidy the code but I am still getting the problem. In the…
Geraint Anderson
  • 3,234
  • 4
  • 28
  • 49
4
votes
0 answers

perltidy indentation on method calls with or operator

I am attempting to get perltidy to indent correctly. It works almost perfectly, but there are issues with some lines of code. For example: $foo = something() or Foo->throw( 'a string which is longer than -l line length. Gets wrapped to next…
bytepusher
  • 1,568
  • 10
  • 19
1
2 3