CONTENTS

NAME

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

VERSION

version 0.74

SYNOPSIS

use Code::TidyAll;

my $ct = Code::TidyAll->new_from_conf_file(
    '/path/to/conf/file',
    ...
);

# or

my $ct = Code::TidyAll->new(
    root_dir => '/path/to/root',
    plugins  => {
        perltidy => {
            select => 'lib/**/*.(pl|pm)',
            argv => '-noll -it=2',
        },
        ...
    }
);

# then...

$ct->process_paths($file1, $file2);

DESCRIPTION

This is the engine used by tidyall - read that first to get an overview.

You can call this API from your own program instead of executing tidyall.

METHODS

This class offers the following methods:

Code::TidyAll->new(%params)

The regular constructor. Must pass at least plugins and root_dir.

$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.

If the conf file or params defines tidyall_class, then that class is constructed instead of Code::TidyAll.

Constructor parameters

$tidyall->process_paths( $path, ... )

This method iterates through a list of paths, processing all the files it finds. It will descend into subdirectories if recursive flag is true. Returns a list of Code::TidyAll::Result objects, one for each file.

$tidyall->process_file( $file )

Process the one file, meaning:

$tidyall->process_source( $source, $path )

Like process_file, but process the source string instead of a file, and does not read from or write to the cache. You must still pass the relative path from the root as the second argument, so that we know which plugins to apply. Returns a Code::TidyAll::Result object.

$tidyall->plugins_for_path($path)

Given a relative path from the root, returns a list of Code::TidyAll::Plugin objects that apply to it, or an empty list if no plugins apply.

$tidyall->find_matched_files

Returns a list of sorted files that match at least one plugin in configuration.

Code::TidyAll->find_conf_file( $conf_names, $start_dir )

Start in the start_dir and work upwards, looking for a file matching one of the conf_names. Returns the pathname if found or throw an error if not found.

SUPPORT

Bugs may be submitted at https://github.com/houseabsolute/perl-code-tidyall/issues.

I am also usually active on IRC as 'autarch' on irc://irc.perl.org.

SOURCE

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

AUTHORS

CONTRIBUTORS

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 - 2019 by Jonathan Swartz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

The full text of the license can be found in the LICENSE file included with this distribution.