1Code::TidyAll(3)      User Contributed Perl Documentation     Code::TidyAll(3)
2
3
4

NAME

6       Code::TidyAll - Engine for tidyall, your all-in-one code tidier and
7       validator
8

VERSION

10       version 0.82
11

SYNOPSIS

13           use Code::TidyAll;
14
15           my $ct = Code::TidyAll->new_from_conf_file(
16               '/path/to/conf/file',
17               ...
18           );
19
20           # or
21
22           my $ct = Code::TidyAll->new(
23               root_dir => '/path/to/root',
24               plugins  => {
25                   perltidy => {
26                       select => 'lib/**/*.(pl|pm)',
27                       argv => '-noll -it=2',
28                   },
29                   ...
30               }
31           );
32
33           # then...
34
35           $ct->process_paths($file1, $file2);
36

DESCRIPTION

38       This is the engine used by tidyall - read that first to get an
39       overview.
40
41       You can call this API from your own program instead of executing
42       "tidyall".
43

METHODS

45       This class offers the following methods:
46
47   Code::TidyAll->new(%params)
48       The regular constructor. Must pass at least plugins and root_dir.
49
50   $tidyall->new_from_conf_file( $conf_file, %params )
51       Takes a conf file path, followed optionally by a set of key/value
52       parameters.  Reads parameters out of the conf file and combines them
53       with the passed parameters (the latter take precedence), and calls the
54       regular constructor.
55
56       If the conf file or params defines tidyall_class, then that class is
57       constructed instead of "Code::TidyAll".
58
59       Constructor parameters
60
61       •   plugins
62
63           Specify a hash of plugins, each of which is itself a hash of
64           options. This is equivalent to what would be parsed out of the
65           sections in the configuration file.
66
67       •   selected_plugins
68
69           An arrayref of plugins to be used. This overrides the "mode"
70           parameter.
71
72           This is really only useful if you're getting configuration from a
73           config file and want to narrow the set of plugins to be run.
74
75           Note that plugins will still only run on files which match their
76           "select" and "ignore" configuration.
77
78       •   cache_model_class
79
80           The cache model class. Defaults to "Code::TidyAll::CacheModel"
81
82       •   cache
83
84           The cache instance (e.g. an instance of "Code::TidyAll::Cache" or a
85           "CHI" instance.) An instance of "Code::TidyAll::Cache" is
86           automatically instantiated by default.
87
88       •   backup_ttl
89
90       •   check_only
91
92           If this is true, then we simply check that files pass validation
93           steps and that tidying them does not change the file. Any changes
94           from tidying are not actually written back to the file.
95
96       •   no_cleanup
97
98           A boolean indicating if we should skip cleaning temporary files or
99           not.  Defaults to false.
100
101       •   inc
102
103           An arrayref of directories to prepend to @INC. This can be set via
104           the command-line as "-I", but you can also set it in a config file.
105
106           This affects both loading and running plugins.
107
108       •   data_dir
109
110       •   iterations
111
112       •   mode
113
114       •   no_backups
115
116       •   no_cache
117
118       •   output_suffix
119
120       •   quiet
121
122       •   root_dir
123
124       •   ignore
125
126       •   verbose
127
128           These options are the same as the equivalent "tidyall" command-line
129           options, replacing dashes with underscore (e.g. the "backup-ttl"
130           option becomes "backup_ttl" here).
131
132       •   msg_outputter
133
134           This is a subroutine reference that is called whenever a message
135           needs to be printed in some way. The sub receives a "sprintf()"
136           format string followed by one or more parameters. The default sub
137           used simply calls "printf "$format\n", @_" but Test::Code::TidyAll
138           overrides this to use the "Test::Builder->diag" method.
139
140   $tidyall->process_paths( $path, ... )
141       This method iterates through a list of paths, processing all the files
142       it finds. It will descend into subdirectories if "recursive" flag is
143       true.  Returns a list of Code::TidyAll::Result objects, one for each
144       file.
145
146   $tidyall->process_file( $file )
147       Process the one file, meaning:
148
149       •   Check the cache and return immediately if file has not changed.
150
151       •   Apply appropriate matching plugins.
152
153       •   Print success or failure result to STDOUT, depending on
154           quiet/verbose settings.
155
156       •   Write to the cache if caching is enabled.
157
158       •   Return a Code::TidyAll::Result object.
159
160   $tidyall->process_source( $source, $path )
161       Like "process_file", but process the source string instead of a file,
162       and does not read from or write to the cache. You must still pass the
163       relative path from the root as the second argument, so that we know
164       which plugins to apply. Returns a Code::TidyAll::Result object.
165
166   $tidyall->plugins_for_path($path)
167       Given a relative path from the root, returns a list of
168       Code::TidyAll::Plugin objects that apply to it, or an empty list if no
169       plugins apply.
170
171   $tidyall->find_matched_files
172       Returns a list of sorted files that match at least one plugin in
173       configuration.
174
175   Code::TidyAll->find_conf_file( $conf_names, $start_dir )
176       Start in the start_dir and work upwards, looking for a file matching
177       one of the conf_names. Returns the pathname if found or throw an error
178       if not found.
179

SUPPORT

181       Bugs may be submitted at
182       <https://github.com/houseabsolute/perl-code-tidyall/issues>.
183

SOURCE

185       The source code repository for Code-TidyAll can be found at
186       <https://github.com/houseabsolute/perl-code-tidyall>.
187

AUTHORS

189       •   Jonathan Swartz <swartz@pobox.com>
190
191       •   Dave Rolsky <autarch@urth.org>
192

CONTRIBUTORS

194       •   Adam Herzog <adam@adamherzog.com>
195
196       •   Andreas Vögele <andreas@andreasvoegele.com>
197
198       •   Andy Jack <andyjack@cpan.org>
199
200       •   Bernhard Schmalhofer <Bernhard.Schmalhofer@gmx.de>
201
202       •   Finn Smith <finn@timeghost.net>
203
204       •   George Hartzell <georgewh@gene.com>
205
206       •   Graham Knop <haarg@haarg.org>
207
208       •   Gregory Oschwald <goschwald@maxmind.com>
209
210       •   Joe Crotty <joe.crotty@returnpath.net>
211
212       •   Kenneth Ölwing <kenneth.olwing@skatteverket.se>
213
214       •   Mark Fowler <mark@twoshortplanks.com>
215
216       •   Mark Grimes <mgrimes@cpan.org>
217
218       •   Martin Gruner <martin.gruner@otrs.com>
219
220       •   Mohammad S Anwar <mohammad.anwar@yahoo.com>
221
222       •   Nick Tonkin <ntonkin@bur-ntonkin-m1.corp.endurance.com>
223
224       •   Olaf Alders <olaf@wundersolutions.com>
225
226       •   Pedro Melo <melo@simplicidade.org>
227
228       •   Ricardo Signes <rjbs@cpan.org>
229
230       •   Sergey Romanov <sromanov-dev@yandex.ru>
231
232       •   Shlomi Fish <shlomif@shlomifish.org>
233
234       •   timgimyee <tim.gim.yee@gmail.com>
235
237       This software is copyright (c) 2011 - 2022 by Jonathan Swartz.
238
239       This is free software; you can redistribute it and/or modify it under
240       the same terms as the Perl 5 programming language system itself.
241
242       The full text of the license can be found in the LICENSE file included
243       with this distribution.
244
245
246
247perl v5.36.0                      2022-07-22                  Code::TidyAll(3)
Impressum