.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 "Code::TidyAll 3pm" .TH Code::TidyAll 3pm "2021-02-19" "perl v5.32.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" Code::TidyAll \- Engine for tidyall, your all\-in\-one code tidier and validator .SH "VERSION" .IX Header "VERSION" version 0.78 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Code::TidyAll; \& \& my $ct = Code::TidyAll\->new_from_conf_file( \& \*(Aq/path/to/conf/file\*(Aq, \& ... \& ); \& \& # or \& \& my $ct = Code::TidyAll\->new( \& root_dir => \*(Aq/path/to/root\*(Aq, \& plugins => { \& perltidy => { \& select => \*(Aqlib/**/*.(pl|pm)\*(Aq, \& argv => \*(Aq\-noll \-it=2\*(Aq, \& }, \& ... \& } \& ); \& \& # then... \& \& $ct\->process_paths($file1, $file2); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the engine used by tidyall \- read that first to get an overview. .PP You can call this \s-1API\s0 from your own program instead of executing \f(CW\*(C`tidyall\*(C'\fR. .SH "METHODS" .IX Header "METHODS" This class offers the following methods: .SS "Code::TidyAll\->new(%params)" .IX Subsection "Code::TidyAll->new(%params)" The regular constructor. Must pass at least \fIplugins\fR and \fIroot_dir\fR. .ie n .SS "$tidyall\->new_with_conf_file( $conf_file, %params )" .el .SS "\f(CW$tidyall\fP\->new_with_conf_file( \f(CW$conf_file\fP, \f(CW%params\fP )" .IX Subsection "$tidyall->new_with_conf_file( $conf_file, %params )" Takes a conf file path, followed optionally by a set of key/value parameters. Reads parameters out of the conf file and combines them with the passed parameters (the latter take precedence), and calls the regular constructor. .PP If the conf file or params defines \fItidyall_class\fR, then that class is constructed instead of \f(CW\*(C`Code::TidyAll\*(C'\fR. .PP \fIConstructor parameters\fR .IX Subsection "Constructor parameters" .IP "\(bu" 4 plugins .Sp Specify a hash of plugins, each of which is itself a hash of options. This is equivalent to what would be parsed out of the sections in the configuration file. .IP "\(bu" 4 selected_plugins .Sp An arrayref of plugins to be used. This overrides the \f(CW\*(C`mode\*(C'\fR parameter. .Sp This is really only useful if you're getting configuration from a config file and want to narrow the set of plugins to be run. .Sp Note that plugins will still only run on files which match their \f(CW\*(C`select\*(C'\fR and \&\f(CW\*(C`ignore\*(C'\fR configuration. .IP "\(bu" 4 cache_model_class .Sp The cache model class. Defaults to \f(CW\*(C`Code::TidyAll::CacheModel\*(C'\fR .IP "\(bu" 4 cache .Sp The cache instance (e.g. an instance of \f(CW\*(C`Code::TidyAll::Cache\*(C'\fR or a \f(CW\*(C`CHI\*(C'\fR instance.) An instance of \f(CW\*(C`Code::TidyAll::Cache\*(C'\fR is automatically instantiated by default. .IP "\(bu" 4 backup_ttl .IP "\(bu" 4 check_only .Sp If this is true, then we simply check that files pass validation steps and that tidying them does not change the file. Any changes from tidying are not actually written back to the file. .IP "\(bu" 4 no_cleanup .Sp A boolean indicating if we should skip cleaning temporary files or not. Defaults to false. .IP "\(bu" 4 inc .Sp An arrayref of directories to prepend to \f(CW@INC\fR. This can be set via the command-line as \f(CW\*(C`\-I\*(C'\fR, but you can also set it in a config file. .Sp This affects both loading and running plugins. .IP "\(bu" 4 data_dir .IP "\(bu" 4 iterations .IP "\(bu" 4 mode .IP "\(bu" 4 no_backups .IP "\(bu" 4 no_cache .IP "\(bu" 4 output_suffix .IP "\(bu" 4 quiet .IP "\(bu" 4 root_dir .IP "\(bu" 4 ignore .IP "\(bu" 4 verbose .Sp These options are the same as the equivalent \f(CW\*(C`tidyall\*(C'\fR command-line options, replacing dashes with underscore (e.g. the \f(CW\*(C`backup\-ttl\*(C'\fR option becomes \&\f(CW\*(C`backup_ttl\*(C'\fR here). .IP "\(bu" 4 msg_outputter .Sp This is a subroutine reference that is called whenever a message needs to be printed in some way. The sub receives a \f(CW\*(C`sprintf()\*(C'\fR format string followed by one or more parameters. The default sub used simply calls \f(CW\*(C`printf "$format\en", @_\*(C'\fR but Test::Code::TidyAll overrides this to use the \f(CW\*(C`Test::Builder\->diag\*(C'\fR method. .ie n .SS "$tidyall\->process_paths( $path, ... )" .el .SS "\f(CW$tidyall\fP\->process_paths( \f(CW$path\fP, ... )" .IX Subsection "$tidyall->process_paths( $path, ... )" This method iterates through a list of paths, processing all the files it finds. It will descend into subdirectories if \f(CW\*(C`recursive\*(C'\fR flag is true. Returns a list of Code::TidyAll::Result objects, one for each file. .ie n .SS "$tidyall\->process_file( $file )" .el .SS "\f(CW$tidyall\fP\->process_file( \f(CW$file\fP )" .IX Subsection "$tidyall->process_file( $file )" Process the one \fIfile\fR, meaning: .IP "\(bu" 4 Check the cache and return immediately if file has not changed. .IP "\(bu" 4 Apply appropriate matching plugins. .IP "\(bu" 4 Print success or failure result to \s-1STDOUT,\s0 depending on quiet/verbose settings. .IP "\(bu" 4 Write to the cache if caching is enabled. .IP "\(bu" 4 Return a Code::TidyAll::Result object. .ie n .SS "$tidyall\->process_source( $source, $path )" .el .SS "\f(CW$tidyall\fP\->process_source( \f(CW$source\fP, \f(CW$path\fP )" .IX Subsection "$tidyall->process_source( $source, $path )" Like \f(CW\*(C`process_file\*(C'\fR, but process the \fIsource\fR string instead of a file, and does not read from or write to the cache. You must still pass the relative \&\fIpath\fR from the root as the second argument, so that we know which plugins to apply. Returns a Code::TidyAll::Result object. .ie n .SS "$tidyall\->plugins_for_path($path)" .el .SS "\f(CW$tidyall\fP\->plugins_for_path($path)" .IX Subsection "$tidyall->plugins_for_path($path)" Given a relative \fIpath\fR from the root, returns a list of Code::TidyAll::Plugin objects that apply to it, or an empty list if no plugins apply. .ie n .SS "$tidyall\->find_matched_files" .el .SS "\f(CW$tidyall\fP\->find_matched_files" .IX Subsection "$tidyall->find_matched_files" Returns a list of sorted files that match at least one plugin in configuration. .ie n .SS "Code::TidyAll\->find_conf_file( $conf_names, $start_dir )" .el .SS "Code::TidyAll\->find_conf_file( \f(CW$conf_names\fP, \f(CW$start_dir\fP )" .IX Subsection "Code::TidyAll->find_conf_file( $conf_names, $start_dir )" Start in the \fIstart_dir\fR and work upwards, looking for a file matching one of the \fIconf_names\fR. Returns the pathname if found or throw an error if not found. .SH "SUPPORT" .IX Header "SUPPORT" Bugs may be submitted at . .PP I am also usually active on \s-1IRC\s0 as 'autarch' on \f(CW\*(C`irc://irc.perl.org\*(C'\fR. .SH "SOURCE" .IX Header "SOURCE" The source code repository for Code-TidyAll can be found at . .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Jonathan Swartz .IP "\(bu" 4 Dave Rolsky .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Adam Herzog .IP "\(bu" 4 Andy Jack .IP "\(bu" 4 Finn Smith .IP "\(bu" 4 George Hartzell .IP "\(bu" 4 Graham Knop .IP "\(bu" 4 Gregory Oschwald .IP "\(bu" 4 Joe Crotty .IP "\(bu" 4 Kenneth Ă–lwing .IP "\(bu" 4 Mark Fowler .IP "\(bu" 4 Mark Grimes .IP "\(bu" 4 Martin Gruner .IP "\(bu" 4 Mohammad S Anwar .IP "\(bu" 4 Nick Tonkin .IP "\(bu" 4 Olaf Alders .IP "\(bu" 4 Pedro Melo .IP "\(bu" 4 Ricardo Signes .IP "\(bu" 4 Sergey Romanov .IP "\(bu" 4 Shlomi Fish .IP "\(bu" 4 timgimyee .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2011 \- 2020 by Jonathan Swartz. .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. .PP The full text of the license can be found in the \fI\s-1LICENSE\s0\fR file included with this distribution.