.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Test::PerlTidy 3" .TH Test::PerlTidy 3 "2023-05-18" "perl v5.36.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test::PerlTidy \- check that all your files are tidy. .SH "VERSION" .IX Header "VERSION" version 20230226 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& # In a file like \*(Aqt/perltidy.t\*(Aq: \& \& use Test::PerlTidy qw( run_tests ); \& \& run_tests(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This rather unflattering comment was made in a piece by Ken Arnold: .PP .Vb 6 \& "Perl is a vast swamp of lexical and syntactic swill and nobody \& knows how to format even their own code well, but it\*(Aqs the only \& major language I can think of (with the possible exception of the \& recent, yet very Java\-like C#) that doesn\*(Aqt have at least one \& style that\*(Aqs good enough." \& http://www.artima.com/weblogs/viewpost.jsp?thread=74230 .Ve .PP Hmmm... He is sort of right in a way. Then again the piece he wrote was related to Python which is somewhat strict about formatting itself. .PP Fear not though \- now you too can have your very own formatting gestapo in the form of Test::PerlTidy! Simply add a test file as suggested above and any file ending in .pl, .pm, .t or .PL will cause a test fail unless it is exactly as perltidy would like it to be. .SH "REASONS TO DO THIS" .IX Header "REASONS TO DO THIS" If the style is mandated in tests then it will be adhered to. .PP If perltidy decides what is a good style then there should be no quibbling. .PP If the style never changes then cvs diffs stop catching changes that are not really there. .PP Readability might even improve. .SH "HINTS" .IX Header "HINTS" If you want to change the default style then muck around with \&'.perltidyrc'; .PP To quickly make a file work then try 'perltidy \-b the_messy_file.pl'. .SH "HOW IT WORKS" .IX Header "HOW IT WORKS" Runs \fBperltidy\fR on files and reports errors if any of the files differ after having been tidied. Does not permanently modify the files being tested. .PP By default, \fBperltidy\fR will be run on files under the current directory and its subdirectories with extensions matching: \&\f(CW\*(C`.pm .pl .PL .t\*(C'\fR .SH "METHODS" .IX Header "METHODS" .SS "run_tests ( [ \fI\fP\f(CI%args\fP\fI\fP ] )" .IX Subsection "run_tests ( [ %args ] )" This is the main entry point for running tests. .PP A number of options can be specified when running the tests, e.g.: .PP .Vb 5 \& run_tests( \& path => $start_dir, \& perltidyrc => $path_to_config_file, \& exclude => [ qr{\e.t$}, \*(Aqinc/\*(Aq], \& ); .Ve .IP "debug" 4 .IX Item "debug" Set \f(CW\*(C`debug\*(C'\fR to a true value to enable additional diagnostic output, in particular info about any processing done as a result of specifying the \f(CW\*(C`exclude\*(C'\fR option. Default is false. .IP "exclude" 4 .IX Item "exclude" \&\f(CW\*(C`run_tests()\*(C'\fR will look for files to test under the current directory and its subdirectories. By default, it will exclude files in the "\f(CW\*(C`./blib/\*(C'\fR" directory. Set \f(CW\*(C`exclude\*(C'\fR to a listref of exclusion criteria if you need to specify additional rules by which files will be excluded. .Sp If an item in the \f(CW\*(C`exclude\*(C'\fR list is a string, e.g. "\f(CW\*(C`./blib/\*(C'\fR", it will be assumed to be a path prefix. Files will be excluded if that string matches their path at the beginning. .Sp If an item in the \f(CW\*(C`exclude\*(C'\fR list is a regex object, e.g. "\f(CW\*(C`qr{\e.t$}\*(C'\fR", files will be excluded if that regex matches their path. .Sp Note that the paths of files to be tested are canonified using File::Spec\f(CW\*(C`\->canonpath\*(C'\fR before any matching is attempted, which can impact how the exclusion rules apply. If your exclusion rules do not seem to be working, turn on the \f(CW\*(C`debug\*(C'\fR option to see the paths of the files that are being kept/excluded. .IP "path" 4 .IX Item "path" Set \f(CW\*(C`path\*(C'\fR to the path to the top-level directory which contains the files to be tested. Defaults to the current directory (i.e. "\f(CW\*(C`.\*(C'\fR"). .IP "perltidyrc" 4 .IX Item "perltidyrc" By default, \fBperltidy\fR will attempt to read its options from the \&\fI.perltidyrc\fR file on your system. Set \f(CW\*(C`perltidyrc\*(C'\fR to the path to a custom file if you would like to control the \fBperltidy\fR options used during testing. .IP "mute" 4 .IX Item "mute" By default, \f(CW\*(C`run_tests()\*(C'\fR will output diagnostics about any errors reported by \fBperltidy\fR, as well as any actual differences found between the pre-tidied and post-tidied files. Set \f(CW\*(C`mute\*(C'\fR to a true value to turn off that diagnostic output. .IP "skip_all" 4 .IX Item "skip_all" Set \f(CW\*(C`skip_all\*(C'\fR to a true value to skip all tests. Default is false. .IP "perltidy_options" 4 .IX Item "perltidy_options" Pass these to \fBPerl::Tidy::perltidy()\fR. (Added in version 20200411 .) .SS "list_files ( [ \fIstart_path\fP | \fI\fP\f(CI%args\fP\fI\fP ] )" .IX Subsection "list_files ( [ start_path | %args ] )" Generate the list of files to be tested. Generally not called directly. .SS "load_file ( \fIpath_to_file\fP )" .IX Subsection "load_file ( path_to_file )" Load the file to be tested from disk and return the contents. Generally not called directly. .SS "is_file_tidy ( \fIpath_to_file\fP [ , \fIpath_to_perltidyrc\fP ] [, \fI\fP\f(CI$named_args\fP\fI\fP] )" .IX Subsection "is_file_tidy ( path_to_file [ , path_to_perltidyrc ] [, $named_args] )" Test if a file is tidy or not. Generally not called directly. .PP \&\f(CW$named_args\fR can be a hash ref which may have a key called 'perltidy_options' that refers to a hash ref of options that will be passed to \fBPerl::Tidy::perltidy()\fR. ($named_args was added in version 20200411). .SH "SEE ALSO" .IX Header "SEE ALSO" Perl::Tidy .SH "ORIGINAL AUTHOR" .IX Header "ORIGINAL AUTHOR" Edmund von der Burg, \f(CW\*(C`\*(C'\fR .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Duncan J. Ferguson, \f(CW\*(C`\*(C'\fR .PP Stephen, \f(CW\*(C`\*(C'\fR .PP Larry Leszczynski, \f(CW\*(C`\*(C'\fR .PP Shlomi Fish, .SH "SUGGESTIONS" .IX Header "SUGGESTIONS" Please let me know if you have any comments or suggestions. .PP .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2007 Edmund von der Burg, all rights reserved. .SH "LICENSE" .IX Header "LICENSE" This library is free software . You can redistribute it and/or modify it under the same terms as perl itself. .SH "SUPPORT" .IX Header "SUPPORT" .SS "Websites" .IX Subsection "Websites" The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. .IP "\(bu" 4 MetaCPAN .Sp A modern, open-source \s-1CPAN\s0 search engine, useful to view \s-1POD\s0 in \s-1HTML\s0 format. .Sp .IP "\(bu" 4 \&\s-1RT: CPAN\s0's Bug Tracker .Sp The \s-1RT\s0 ( Request Tracker ) website is the default bug/issue tracking system for \s-1CPAN.\s0 .Sp .IP "\(bu" 4 \&\s-1CPANTS\s0 .Sp The \s-1CPANTS\s0 is a website that analyzes the Kwalitee ( code metrics ) of a distribution. .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Testers .Sp The \s-1CPAN\s0 Testers is a network of smoke testers who run automated tests on uploaded \s-1CPAN\s0 distributions. .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Testers Matrix .Sp The \s-1CPAN\s0 Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Testers Dependencies .Sp The \s-1CPAN\s0 Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. .Sp .SS "Bugs / Feature Requests" .IX Subsection "Bugs / Feature Requests" Please report any bugs or feature requests by email to \f(CW\*(C`bug\-test\-perltidy at rt.cpan.org\*(C'\fR, or through the web interface at . You will be automatically notified of any progress on the request by the system. .SS "Source Code" .IX Subsection "Source Code" The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) .PP .PP .Vb 1 \& git clone https://github.com/shlomif/Test\-PerlTidy .Ve .SH "AUTHOR" .IX Header "AUTHOR" Shlomi Fish .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests on the bugtracker website .PP When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2023 by Edmund von der Burg. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.