Code-TidyAll-0.67/0000775000175000017500000000000013157756244013540 5ustar autarchautarchCode-TidyAll-0.67/dist.ini0000644000175000017500000000313013157756244015177 0ustar autarchautarchname = Code-TidyAll author = Jonathan Swartz author = Dave Rolsky license = Perl_5 copyright_year = 2011 copyright_holder = Jonathan Swartz [@DROLSKY] dist = Code-TidyAll exclude_files = node_modules/.* exclude_files = php5/.* prereqs_skip = JSON::MaybeXS prereqs_skip = Mason::Tidy prereqs_skip = Mason::Tidy::App prereqs_skip = Perl::Tidy prereqs_skip = Perl::Tidy::Sweetened prereqs_skip = Pod::Checker prereqs_skip = Pod::Spell prereqs_skip = Pod::Tidy prereqs_skip = SVN::Look prereqs_skip = Win32 stopwords_file = .ispell_english use_github_issues = 1 -remove = DROLSKY::TidyAll ; This ends up matching legitimate markdown -remove = Git::CheckFor::MergeConflicts -remove = Test::CleanNamespaces ; Many plugins won't compile without optional prereqs -remove = Test::Compile ; The Pod::Tidy tidying leaves spaces at the ends of lines -remove = Test::EOL -remove = Test::Pod::Coverage::Configurable ; Can't resolve L for some reason -remove = Test::Pod::LinkCheck -remove = Test::Pod::No404s -remove = Test::Portability -remove = Test::Synopsis -remove = Test::TidyAll ;authordep Pod::Tidy [Prereqs::Soften] module = Parallel::ForkManager [Prereqs / DevelopRequires] CHI = 0 Code::TidyAll::Plugin::Perl::AlignMooseAttributes = 0 JSON::MaybeXS = 0 Mason::Tidy = 0 Mason::Tidy::App = 0 Parallel::ForkManager = 0 Perl::Critic::Policy::Moose::RequireMakeImmutable = 0 Perl::Tidy = 20150815 Perl::Tidy::Sweetened = 1.00 Pod::Checker = 0 Pod::Spell = 0 Pod::Tidy = 0 SVN::Look = 0 [MetaNoIndex] file = lib/Code/TidyAll/Util.pm ; This tidies the generated Pod [TidyAll] Code-TidyAll-0.67/META.yml0000644000175000017500000006327013157756244015017 0ustar autarchautarch--- abstract: 'Engine for tidyall, your all-in-one code tidier and validator' author: - 'Jonathan Swartz ' - 'Dave Rolsky ' build_requires: Encode: '0' ExtUtils::MakeMaker: '0' File::Spec: '0' Test::Class::Most: '0' Test::Differences: '0' Test::Fatal: '0' Test::More: '0.96' Test::Warnings: '0' autodie: '0' lib: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Code-TidyAll no_index: file: - lib/Code/TidyAll/Util.pm provides: Code::TidyAll: file: lib/Code/TidyAll.pm version: '0.67' Code::TidyAll::Cache: file: lib/Code/TidyAll/Cache.pm version: '0.67' Code::TidyAll::CacheModel: file: lib/Code/TidyAll/CacheModel.pm version: '0.67' Code::TidyAll::CacheModel::Shared: file: lib/Code/TidyAll/CacheModel/Shared.pm version: '0.67' Code::TidyAll::Config::INI::Reader: file: lib/Code/TidyAll/Config/INI/Reader.pm version: '0.67' Code::TidyAll::Git::Precommit: file: lib/Code/TidyAll/Git/Precommit.pm version: '0.67' Code::TidyAll::Git::Prereceive: file: lib/Code/TidyAll/Git/Prereceive.pm version: '0.67' Code::TidyAll::Git::Util: file: lib/Code/TidyAll/Git/Util.pm version: '0.67' Code::TidyAll::Plugin: file: lib/Code/TidyAll/Plugin.pm version: '0.67' Code::TidyAll::Plugin::CSSUnminifier: file: lib/Code/TidyAll/Plugin/CSSUnminifier.pm version: '0.67' Code::TidyAll::Plugin::JSBeautify: file: lib/Code/TidyAll/Plugin/JSBeautify.pm version: '0.67' Code::TidyAll::Plugin::JSHint: file: lib/Code/TidyAll/Plugin/JSHint.pm version: '0.67' Code::TidyAll::Plugin::JSLint: file: lib/Code/TidyAll/Plugin/JSLint.pm version: '0.67' Code::TidyAll::Plugin::JSON: file: lib/Code/TidyAll/Plugin/JSON.pm version: '0.67' Code::TidyAll::Plugin::MasonTidy: file: lib/Code/TidyAll/Plugin/MasonTidy.pm version: '0.67' Code::TidyAll::Plugin::PHPCodeSniffer: file: lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm version: '0.67' Code::TidyAll::Plugin::PerlCritic: file: lib/Code/TidyAll/Plugin/PerlCritic.pm version: '0.67' Code::TidyAll::Plugin::PerlTidy: file: lib/Code/TidyAll/Plugin/PerlTidy.pm version: '0.67' Code::TidyAll::Plugin::PerlTidySweet: file: lib/Code/TidyAll/Plugin/PerlTidySweet.pm version: '0.67' Code::TidyAll::Plugin::PodChecker: file: lib/Code/TidyAll/Plugin/PodChecker.pm version: '0.67' Code::TidyAll::Plugin::PodSpell: file: lib/Code/TidyAll/Plugin/PodSpell.pm version: '0.67' Code::TidyAll::Plugin::PodTidy: file: lib/Code/TidyAll/Plugin/PodTidy.pm version: '0.67' Code::TidyAll::Plugin::SortLines: file: lib/Code/TidyAll/Plugin/SortLines.pm version: '0.67' Code::TidyAll::Result: file: lib/Code/TidyAll/Result.pm version: '0.67' Code::TidyAll::Role::HasIgnore: file: lib/Code/TidyAll/Role/HasIgnore.pm version: '0.67' Code::TidyAll::Role::RunsCommand: file: lib/Code/TidyAll/Role/RunsCommand.pm version: '0.67' Code::TidyAll::Role::Tempdir: file: lib/Code/TidyAll/Role/Tempdir.pm version: '0.67' Code::TidyAll::SVN::Precommit: file: lib/Code/TidyAll/SVN/Precommit.pm version: '0.67' Code::TidyAll::SVN::Util: file: lib/Code/TidyAll/SVN/Util.pm version: '0.67' Code::TidyAll::Util::Zglob: file: lib/Code/TidyAll/Util/Zglob.pm version: '0.67' Test::Code::TidyAll: file: lib/Test/Code/TidyAll.pm version: '0.67' recommends: Parallel::ForkManager: '0' requires: Capture::Tiny: '0' Config::INI::Reader: '0' Cwd: '0' Data::Dumper: '0' Date::Format: '0' Digest::SHA: '0' Exporter: '0' File::Find: '0' File::Spec: '0' File::Which: '0' File::Zglob: '0' File::pushd: '0' Getopt::Long: '0' IPC::Run3: '0' IPC::System::Simple: '0' List::Compare: '0' List::SomeUtils: '0' Log::Any: '0' Module::Runtime: '0' Moo: '2.000000' Moo::Role: '0' Path::Tiny: '0.098' Scalar::Util: '0' Scope::Guard: '0' Specio: '0.40' Specio::Declare: '0' Specio::Library::Builtins: '0' Specio::Library::Numeric: '0' Specio::Library::Path::Tiny: '0.04' Specio::Library::String: '0' Test::Builder: '0' Text::Diff: '1.44' Text::Diff::Table: '0' Text::ParseWords: '0' Time::Duration::Parse: '0' Try::Tiny: '0' base: '0' constant: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/houseabsolute/perl-code-tidyall/issues homepage: http://metacpan.org/release/Code-TidyAll repository: git://github.com/houseabsolute/perl-code-tidyall.git version: '0.67' x_Dist_Zilla: perl: version: '5.024001' plugins: - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@DROLSKY/MakeMaker' version: '6.010' - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - CONTRIBUTING.md - LICENSE - Makefile.PL - README.md - cpanfile exclude_match: - (?^u:node_modules/.*) - (?^u:php5/.*) follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@DROLSKY/Git::GatherDir' version: '2.042' - class: Dist::Zilla::Plugin::ManifestSkip name: '@DROLSKY/ManifestSkip' version: '6.010' - class: Dist::Zilla::Plugin::License name: '@DROLSKY/License' version: '6.010' - class: Dist::Zilla::Plugin::ExecDir name: '@DROLSKY/ExecDir' version: '6.010' - class: Dist::Zilla::Plugin::ShareDir name: '@DROLSKY/ShareDir' version: '6.010' - class: Dist::Zilla::Plugin::Manifest name: '@DROLSKY/Manifest' version: '6.010' - class: Dist::Zilla::Plugin::CheckVersionIncrement name: '@DROLSKY/CheckVersionIncrement' version: '0.121750' - class: Dist::Zilla::Plugin::TestRelease name: '@DROLSKY/TestRelease' version: '6.010' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@DROLSKY/ConfirmRelease' version: '6.010' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@DROLSKY/UploadToCPAN' version: '6.010' - class: Dist::Zilla::Plugin::VersionFromMainModule name: '@DROLSKY/VersionFromMainModule' version: '0.03' - class: Dist::Zilla::Plugin::Authority name: '@DROLSKY/Authority' version: '1.009' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@DROLSKY/AutoPrereqs' version: '6.010' - class: Dist::Zilla::Plugin::CopyFilesFromBuild name: '@DROLSKY/CopyFilesFromBuild' version: '0.170880' - class: Dist::Zilla::Plugin::GitHub::Meta name: '@DROLSKY/GitHub::Meta' version: '0.44' - class: Dist::Zilla::Plugin::GitHub::Update config: Dist::Zilla::Plugin::GitHub::Update: metacpan: 1 name: '@DROLSKY/GitHub::Update' version: '0.44' - class: Dist::Zilla::Plugin::MetaResources name: '@DROLSKY/MetaResources' version: '6.010' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.010' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000033' version: '0.004' name: '@DROLSKY/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::Meta::Contributors name: '@DROLSKY/Meta::Contributors' version: '0.003' - class: Dist::Zilla::Plugin::MetaConfig name: '@DROLSKY/MetaConfig' version: '6.010' - class: Dist::Zilla::Plugin::MetaJSON name: '@DROLSKY/MetaJSON' version: '6.010' - class: Dist::Zilla::Plugin::MetaYAML name: '@DROLSKY/MetaYAML' version: '6.010' - class: Dist::Zilla::Plugin::NextRelease name: '@DROLSKY/NextRelease' version: '6.010' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@DROLSKY/Test::More with subtest' version: '6.010' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Modules for use with tidyall' version: '6.010' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@DROLSKY/Test::Version which fixes https://github.com/plicease/Test-Version/issues/7' version: '6.010' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::DROLSKY phase: build run_under_travis: 0 skip: [] name: '@DROLSKY/Dist::Zilla::PluginBundle::DROLSKY' version: '0.054' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 1 modules: [] phase: release run_under_travis: 0 skip: - Dist::Zilla::Plugin::DROLSKY::Contributors - Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch - Dist::Zilla::Plugin::DROLSKY::License - Dist::Zilla::Plugin::DROLSKY::TidyAll - Dist::Zilla::Plugin::DROLSKY::WeaverConfig - Pod::Weaver::PluginBundle::DROLSKY name: '@DROLSKY/PromptIfStale' version: '0.054' - class: Dist::Zilla::Plugin::Test::PodSpelling config: Dist::Zilla::Plugin::Test::PodSpelling: directories: - bin - lib spell_cmd: '' stopwords: - API - CPAN - DROLSKY - "DROLSKY's" - JSON - JavaScript - Misc - PHP - PREREQS - PayPal - Raggett - Rolsky - "Rolsky's" - STDERR - STDIN - STDOUT - Simakov - TIDYALL - Thalhammer - Vim - argv - ascii - atomicity - cmd - conf - config - cssunminifier - ctrl - dir - drolsky - filename - iff - ispell - js - jsbeautify - jshint - jslint - lib - listref - masontidy - noll - npm - ok - ops - params - pathname - perlcritic - perlcriticrc - perltidy - phpcs - plugins - podspell - podtidy - pre - prereqs - repo - repos - ro - runtime - rw - shebang - sourceforge - svn - tidiers - tidyall - "tidyall'd" - timestamped - ttl - txn - validator - validators - zglob wordlist: Pod::Wordlist name: '@DROLSKY/Test::PodSpelling' version: '2.007004' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@DROLSKY/PodSyntaxTests' version: '6.010' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@DROLSKY/RunExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::MojibakeTests name: '@DROLSKY/MojibakeTests' version: '0.8' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes name: '@DROLSKY/Test::CPAN::Changes' version: '0.012' - class: Dist::Zilla::Plugin::Test::CPAN::Meta::JSON name: '@DROLSKY/Test::CPAN::Meta::JSON' version: '0.004' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@DROLSKY/Test::NoTabs' version: '0.15' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@DROLSKY/Test::ReportPrereqs' version: '0.027' - class: Dist::Zilla::Plugin::Test::Version name: '@DROLSKY/Test::Version' version: '1.09' - class: Dist::Zilla::Plugin::DROLSKY::Contributors name: '@DROLSKY/DROLSKY::Contributors' version: '0.85' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.14.1 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@DROLSKY/Git::Contributors' version: '0.030' - class: Dist::Zilla::Plugin::SurgicalPodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@DROLSKY' finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.015' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.015' - class: Pod::Weaver::Plugin::SingleEncoding name: '@DROLSKY/SingleEncoding' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/List' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@DROLSKY/Verbatim' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/header' version: '4.015' - class: Pod::Weaver::Section::Name name: '@DROLSKY/Name' version: '4.015' - class: Pod::Weaver::Section::Version name: '@DROLSKY/Version' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/prelude' version: '4.015' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.015' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.015' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.015' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.015' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.015' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.015' - class: Pod::Weaver::Section::Collect name: TYPES version: '4.015' - class: Pod::Weaver::Section::Leftovers name: '@DROLSKY/Leftovers' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/postlude' version: '4.015' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SUPPORT' version: '1.06' - class: Pod::Weaver::Section::AllowOverride name: '@DROLSKY/allow override SUPPORT' version: '0.05' - class: Pod::Weaver::Section::GenerateSection name: '@DROLSKY/generate SOURCE' version: '1.06' - class: Pod::Weaver::Section::Authors name: '@DROLSKY/Authors' version: '4.015' - class: Pod::Weaver::Section::Contributors name: '@DROLSKY/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@DROLSKY/Legal' version: '4.015' - class: Pod::Weaver::Section::Region name: '@DROLSKY/footer' version: '4.015' name: '@DROLSKY/SurgicalPodWeaver' version: '0.0023' - class: Dist::Zilla::Plugin::DROLSKY::WeaverConfig name: '@DROLSKY/DROLSKY::WeaverConfig' version: '0.85' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: '@DROLSKY/README.md in build' version: '0.163250' - class: Dist::Zilla::Plugin::GenerateFile::FromShareDir config: Dist::Zilla::Plugin::GenerateFile::FromShareDir: destination_filename: CONTRIBUTING.md dist: Dist-Zilla-PluginBundle-DROLSKY encoding: UTF-8 has_xs: '0' location: build source_filename: CONTRIBUTING.md Dist::Zilla::Role::RepoFileInjector: allow_overwrite: 1 repo_root: . version: '0.007' name: '@DROLSKY/Generate CONTRIBUTING.md' version: '0.013' - class: Dist::Zilla::Plugin::InstallGuide name: '@DROLSKY/InstallGuide' version: '1.200007' - class: Dist::Zilla::Plugin::CPANFile name: '@DROLSKY/CPANFile' version: '6.010' - class: Dist::Zilla::Plugin::DROLSKY::License name: '@DROLSKY/DROLSKY::License' version: '0.85' - class: Dist::Zilla::Plugin::CheckStrictVersion name: '@DROLSKY/CheckStrictVersion' version: '0.001' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000033' version: '0.004' name: '@DROLSKY/CheckSelfDependency' version: '0.011' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@DROLSKY/CheckPrereqsIndexed' version: '0.020' - class: Dist::Zilla::Plugin::DROLSKY::Git::CheckFor::CorrectBranch config: Dist::Zilla::Role::Git::Repo: git_version: 2.14.1 repo_root: . name: '@DROLSKY/DROLSKY::Git::CheckFor::CorrectBranch' version: '0.85' - class: Dist::Zilla::Plugin::EnsureChangesHasContent name: '@DROLSKY/EnsureChangesHasContent' version: '0.02' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - tidyall.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.14.1 repo_root: . name: '@DROLSKY/Git::Check' version: '2.042' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%v%n%n%c Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - CONTRIBUTING.md - Changes - LICENSE - Makefile.PL - README.md - cpanfile - tidyall.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.14.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit generated files' version: '2.042' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v0.67 tag_format: v%v tag_message: v%v Dist::Zilla::Role::Git::Repo: git_version: 2.14.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Git::Tag' version: '2.042' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.14.1 repo_root: . name: '@DROLSKY/Git::Push' version: '2.042' - class: Dist::Zilla::Plugin::BumpVersionAfterRelease config: Dist::Zilla::Plugin::BumpVersionAfterRelease: finders: - ':ExecFiles' - ':InstallModules' global: 0 munge_makefile_pl: 1 name: '@DROLSKY/BumpVersionAfterRelease' version: '0.015' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: 'Bump version after release' Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: - (?^:.+) changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.14.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@DROLSKY/Commit version bump' version: '2.042' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.14.1 repo_root: . name: '@DROLSKY/Push version bump' version: '2.042' - class: Dist::Zilla::Plugin::Prereqs::Soften config: Dist::Zilla::Plugin::Prereqs::Soften: copy_to: [] modules: - Parallel::ForkManager modules_from_features: ~ to_relationship: recommends name: Prereqs::Soften version: '0.006003' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: DevelopRequires version: '6.010' - class: Dist::Zilla::Plugin::MetaNoIndex name: MetaNoIndex version: '6.010' - class: Dist::Zilla::Plugin::TidyAll name: TidyAll version: '0.04' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.010' - class: Dist::Zilla::Plugin::FinderCode name: '@DROLSKY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.010' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.010' x_authority: cpan:DROLSKY x_contributors: - 'Adam Herzog ' - 'Andy Jack ' - 'Finn Smith ' - 'George Hartzell ' - 'Graham Knop ' - 'Gregory Oschwald ' - 'Joe Crotty ' - 'Mark Fowler ' - 'Mark Grimes ' - 'Martin Gruner ' - 'Mohammad S Anwar ' - 'Olaf Alders ' - 'Pedro Melo ' - 'Ricardo Signes ' - 'Sergey Romanov ' - 'Shlomi Fish ' - 'timgimyee ' x_serialization_backend: 'YAML::Tiny version 1.70' Code-TidyAll-0.67/perltidyrc0000644000175000017500000000041613157756244015643 0ustar autarchautarch-l=100 -i=4 -ci=4 -se -b -bar -boc -vt=0 -vtc=0 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nolq -npro -nsfs --opening-hash-brace-right --no-outdent-long-comments -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" --iterations=2 Code-TidyAll-0.67/appveyor.yml0000644000175000017500000000176413157756244016136 0ustar autarchautarch--- skip_tags: true cache: - C:\strawberry environment: nodejs_version: "6" install: - if not exist "C:\strawberry" cinst strawberryperl -y - set PATH=C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;%PATH% - cd %APPVEYOR_BUILD_FOLDER% - cpanm --installdeps . -n # Is there a better way to get the list of DevelopRequires modules? - cpanm -n CHI Code::TidyAll::Plugin::Perl::AlignMooseAttributes JSON::MaybeXS Mason::Tidy Mason::Tidy::App Parallel::ForkManager Perl::Critic::Policy::Moose::RequireMakeImmutable Perl::Tidy Perl::Tidy::Sweetened Pod::Checker Pod::Spell Pod::Tidy SVN::Look - ps: Install-Product node $env:nodejs_version # See https://www.chadsikorra.com/blog/appveyor-chocolatey-php - without # this some of the PHP prereq packages fail to install - ps: Set-Service wuauserv -StartupType "Automatic"; Start-Service wuauserv - cinst php build_script: - perl -e 1 test_script: - prove -lrv t/ xt/ ### __app_cisetup__ # --- {} ### __app_cisetup__ Code-TidyAll-0.67/t/0000775000175000017500000000000013157756244014003 5ustar autarchautarchCode-TidyAll-0.67/t/00-report-prereqs.t0000644000175000017500000001342613157756244017403 0ustar autarchautarch#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: Code-TidyAll-0.67/t/Basic.t0000644000175000017500000000015513157756244015210 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Basic; TestFor::Code::TidyAll::Basic->runtests; Code-TidyAll-0.67/t/Conf.t0000644000175000017500000000015313157756244015052 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Conf; TestFor::Code::TidyAll::Conf->runtests; Code-TidyAll-0.67/t/inc1/0000775000175000017500000000000013157756244014635 5ustar autarchautarchCode-TidyAll-0.67/t/inc1/Foo.pm0000644000175000017500000000047113157756244015716 0ustar autarchautarchpackage Foo; use strict; use warnings; use Moo; extends 'Code::TidyAll::Plugin'; use Test::More; sub transform_source { for my $dir (qw( t/inc1 t/inc2 )) { ok( ( grep {m{$dir}} @INC ), "\@INC still inclues $dir when plugin is run" ); } return $_[1]; } 1; Code-TidyAll-0.67/t/Zglob.t0000644000175000017500000000015513157756244015244 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Zglob; TestFor::Code::TidyAll::Zglob->runtests; Code-TidyAll-0.67/t/00-report-prereqs.dd0000644000175000017500000001327513157756244017531 0ustar autarchautarchdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' } }, 'develop' => { 'requires' => { 'CHI' => '0', 'Code::TidyAll' => '0.56', 'Code::TidyAll::Plugin::Perl::AlignMooseAttributes' => '0', 'Code::TidyAll::Plugin::SortLines::Naturally' => '0.000003', 'Code::TidyAll::Plugin::Test::Vars' => '0.02', 'JSON::MaybeXS' => '0', 'Mason::Tidy' => '0', 'Mason::Tidy::App' => '0', 'Parallel::ForkManager' => '1.19', 'Perl::Critic' => '1.126', 'Perl::Critic::Policy::Moose::RequireMakeImmutable' => '0', 'Perl::Tidy' => '20160302', 'Perl::Tidy::Sweetened' => '1.00', 'Pod::Checker' => '0', 'Pod::Spell' => '0', 'Pod::Tidy' => '0', 'Pod::Wordlist' => '0', 'SVN::Look' => '0', 'Test::CPAN::Changes' => '0.19', 'Test::CPAN::Meta::JSON' => '0.16', 'Test::Mojibake' => '0', 'Test::More' => '0.96', 'Test::NoTabs' => '0', 'Test::Pod' => '1.41', 'Test::Spelling' => '0.12', 'Test::Vars' => '0.009', 'Test::Version' => '2.05', 'lib' => '0' } }, 'runtime' => { 'recommends' => { 'Parallel::ForkManager' => '0' }, 'requires' => { 'Capture::Tiny' => '0', 'Config::INI::Reader' => '0', 'Cwd' => '0', 'Data::Dumper' => '0', 'Date::Format' => '0', 'Digest::SHA' => '0', 'Exporter' => '0', 'File::Find' => '0', 'File::Spec' => '0', 'File::Which' => '0', 'File::Zglob' => '0', 'File::pushd' => '0', 'Getopt::Long' => '0', 'IPC::Run3' => '0', 'IPC::System::Simple' => '0', 'List::Compare' => '0', 'List::SomeUtils' => '0', 'Log::Any' => '0', 'Module::Runtime' => '0', 'Moo' => '2.000000', 'Moo::Role' => '0', 'Path::Tiny' => '0.098', 'Scalar::Util' => '0', 'Scope::Guard' => '0', 'Specio' => '0.40', 'Specio::Declare' => '0', 'Specio::Library::Builtins' => '0', 'Specio::Library::Numeric' => '0', 'Specio::Library::Path::Tiny' => '0.04', 'Specio::Library::String' => '0', 'Test::Builder' => '0', 'Text::Diff' => '1.44', 'Text::Diff::Table' => '0', 'Text::ParseWords' => '0', 'Time::Duration::Parse' => '0', 'Try::Tiny' => '0', 'base' => '0', 'constant' => '0', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'Encode' => '0', 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test::Class::Most' => '0', 'Test::Differences' => '0', 'Test::Fatal' => '0', 'Test::More' => '0.96', 'Test::Warnings' => '0', 'autodie' => '0', 'lib' => '0' } } }; $x; }Code-TidyAll-0.67/t/lib/0000775000175000017500000000000013157756244014551 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestHelper/0000775000175000017500000000000013157756244016630 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestHelper/Plugin/0000775000175000017500000000000013157756244020066 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestHelper/Plugin/AlwaysPhonetic.pm0000644000175000017500000000130113157756244023347 0ustar autarchautarchpackage TestHelper::Plugin::AlwaysPhonetic; use Moo; extends 'Code::TidyAll::Plugin'; my %phonetic = ( A => 'ALFA', B => 'BRAVO', C => 'CHARLIE', D => 'DELTA', E => 'ECHO', F => 'FOXTROT', G => 'GOLF', H => 'HOTEL', I => 'INDIA', J => 'JULIETT', K => 'KILO', L => 'LIMA', M => 'MIKE', N => 'NOVEMBER', O => 'OSCAR', P => 'PAPA', Q => 'QUEBEC', R => 'ROMEO', S => 'SIERRA', T => 'TANGO', U => 'UNIFORM', V => 'VICTOR', W => 'WHISKEY', X => 'X-RAY', Y => 'YANKEE', Z => 'ZULU', ); sub transform_source { my ( $self, $source ) = @_; return join '-', map { $phonetic{$_} } split //, $source; } Code-TidyAll-0.67/t/lib/TestHelper/Plugin/CheckUpper.pm0000644000175000017500000000030113157756244022445 0ustar autarchautarchpackage TestHelper::Plugin::CheckUpper; use Moo; extends 'Code::TidyAll::Plugin'; sub validate_source { my ( $self, $source ) = @_; die "lowercase found" if $source =~ /[a-z]/; } 1; Code-TidyAll-0.67/t/lib/TestHelper/Plugin/RepeatFoo.pm0000644000175000017500000000040713157756244022307 0ustar autarchautarchpackage TestHelper::Plugin::RepeatFoo; use Moo; extends 'Code::TidyAll::Plugin'; has 'times' => ( is => 'ro' ); sub transform_source { my ( $self, $source ) = @_; my $times = $self->times || die "no times specified"; return $source x $times; } 1; Code-TidyAll-0.67/t/lib/TestHelper/Plugin/AToZ.pm0000644000175000017500000000044413157756244021241 0ustar autarchautarchpackage TestHelper::Plugin::AToZ; use Moo; extends 'Code::TidyAll::Plugin'; sub preprocess_source { my ( $self, $source ) = @_; $source =~ tr/Aa/Zz/; return $source; } sub postprocess_source { my ( $self, $source ) = @_; $source =~ tr/Zz/Aa/; return $source; } 1; Code-TidyAll-0.67/t/lib/TestHelper/Plugin/ReverseFoo.pm0000644000175000017500000000033413157756244022501 0ustar autarchautarchpackage TestHelper::Plugin::ReverseFoo; use Path::Tiny qw(path); use Moo; extends 'Code::TidyAll::Plugin'; sub transform_file { my ( $self, $file ) = @_; $file->spew( scalar( reverse( $file->slurp ) ) ); } 1; Code-TidyAll-0.67/t/lib/TestHelper/Plugin/UpperText.pm0000644000175000017500000000041713157756244022364 0ustar autarchautarchpackage TestHelper::Plugin::UpperText; use Moo; extends 'Code::TidyAll::Plugin'; sub transform_source { my ( $self, $source ) = @_; if ( $source =~ /^[A-Z]*$/mi ) { return uc($source); } else { die "non-alpha content found"; } } 1; Code-TidyAll-0.67/t/lib/TestHelper/Test/0000775000175000017500000000000013157756244017547 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestHelper/Test/Class.pm0000644000175000017500000000365313157756244021157 0ustar autarchautarchpackage TestHelper::Test::Class; use Capture::Tiny qw(capture_stdout); use Code::TidyAll; use Code::TidyAll::Util qw(tempdir_simple); use File::Which qw(which); use Test::Class::Most; use strict; use warnings; __PACKAGE__->SKIP_CLASS("abstract base class"); sub require_executable { my $self = shift; my $exe = shift; return 1 if which($exe); $self->builder->skip("These tests require that $exe be in your \$PATH"); return 0; } sub create_dir { my ( $self, $files ) = @_; my $root_dir = tempdir_simple(); while ( my ( $path, $content ) = each(%$files) ) { my $full_path = $root_dir->child($path); $full_path->parent->mkpath( { mode => 0755 } ); $full_path->spew($content); } return $root_dir; } sub tidy { my ( $self, %params ) = @_; my $desc = $params{desc}; if ( !defined($desc) ) { ($desc) = ( ( caller(1) )[3] =~ /([^:]+$)/ ); } my $root_dir = $self->create_dir( $params{source} ); my $options = $params{options} || {}; my $ct = Code::TidyAll->new( plugins => $params{plugins}, root_dir => $root_dir, %$options ); my @results; my $output = capture_stdout { @results = $ct->process_all() }; my $error_count = grep { $_->error } @results; if ( $params{errors} ) { ok( $error_count > 0, "$desc - error_count > 0" ); if ( eval { @{ $params{errors} } } ) { like( $output, $_, "$desc - errors" ) for @{ $params{errors} }; } else { like( $output, $params{errors}, "$desc - errors" ); } } else { is( $error_count, 0, "$desc - error_count == 0" ); } while ( my ( $path, $content ) = each( %{ $params{dest} } ) ) { is( $root_dir->child($path)->slurp, $content, "$desc - $path content" ); } if ( my $like_output = $params{like_output} ) { like( $output, $like_output, "$desc - output" ); } } 1; Code-TidyAll-0.67/t/lib/TestFor/0000775000175000017500000000000013157756244016137 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestFor/Code/0000775000175000017500000000000013157756244017011 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/0000775000175000017500000000000013157756244020353 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Git.pm0000644000175000017500000002764313157756244021446 0ustar autarchautarchpackage TestFor::Code::TidyAll::Git; use Capture::Tiny qw(capture capture_stderr); use Code::TidyAll::Git::Util qw(git_files_to_commit git_modified_files); use Code::TidyAll::Util qw(tempdir_simple); use Code::TidyAll; use File::pushd qw(pushd); use IPC::System::Simple qw(capturex runx); use Path::Tiny qw(cwd path); use Test::Class::Most parent => 'TestHelper::Test::Class'; use Try::Tiny; use constant IS_WIN32 => $^O eq 'MSWin32'; my ( $precommit_hook_template, $prereceive_hook_template, $tidyall_ini_template ); my $Cwd = cwd()->realpath; $ENV{GIT_AUTHOR_NAME} = $ENV{GIT_COMMITTER_NAME} = 'G. Author'; $ENV{GIT_AUTHOR_EMAIL} = $ENV{GIT_COMMITTER_EMAIL} = 'git-author@example.com'; sub test_git : Tests { my ($self) = @_; my ( $temp_dir, $work_dir, $pushd ) = $self->_make_working_dir_and_repo; subtest 'add foo.txt', sub { $work_dir->child('foo.txt')->spew("abc\n"); cmp_deeply( [ git_files_to_commit($work_dir) ], [], 'no files to commit' ); runx(qw( git add foo.txt )); cmp_deeply( [ map { $_->stringify } git_files_to_commit($work_dir) ], [ $work_dir->child('foo.txt')->stringify ], 'one file to commit' ); }; subtest 'attempt to commit untidy file', sub { my $output = capture_stderr { system(qw( git commit -q -m changed -a )) }; like( $output, qr/1 file did not pass tidyall check/, '1 file did not pass tidyall check' ); like( $output, qr/needs tidying/, 'needs tidying' ); $self->_assert_something_to_commit; }; subtest 'successfully commit tidied file', sub { $work_dir->child('foo.txt')->spew("ABC\n"); my $output = capture_stderr { runx(qw( git commit -q -m changed -a )) }; like( $output, qr/\[checked\] foo\.txt/, 'checked foo.txt' ); $self->_assert_nothing_to_commit; }; subtest 'add another file which is tidied', sub { $work_dir->child('bar.txt')->spew('ABC'); runx(qw( git add bar.txt )); runx(qw( git commit -q -m bar.txt )); $work_dir->child('bar.txt')->spew('def'); cmp_deeply( [ git_files_to_commit($work_dir) ], [], 'no files to commit' ); cmp_deeply( [ map { $_->stringify } git_modified_files($work_dir) ], ["$work_dir/bar.txt"], 'one file was modified' ); }; my ( $shared_dir, $clone_dir ); subtest 'create bare repo and clone it', sub { $shared_dir = $temp_dir->child('shared'); $clone_dir = $temp_dir->child('clone'); runx( qw( git clone -q --bare ), map { _quote_for_win32($_) } $work_dir, $shared_dir ); runx( qw( git clone -q ), map { _quote_for_win32($_) } $shared_dir, $clone_dir ); chdir($clone_dir); $self->_assert_nothing_to_commit; }; my $prereceive_hook_file = $shared_dir->child(qw( hooks pre-receive )); my $prereceive_hook = sprintf( $prereceive_hook_template, $self->_lib_dirs ); $prereceive_hook_file->spew($prereceive_hook); $prereceive_hook_file->chmod(0775); subtest 'untidy file and attempt to commit it via commit -a', sub { $clone_dir->child('foo.txt')->spew("def\n"); runx(qw( git commit -q -m changed -a )); $self->_assert_nothing_to_commit; $self->_assert_branch_is_ahead_of_origin; }; subtest 'cannot push untidy file', sub { my $output = capture_stderr { system(qw( git push )) }; like( $output, qr/master -> master/, 'master -> master' ); like( $output, qr/1 file did not pass tidyall check/, '1 file did not pass tidyall check' ); like( $output, qr/needs tidying/, 'needs tidying' ); $self->_assert_branch_is_ahead_of_origin; }; subtest 'can push tidied file', sub { $clone_dir->child('foo.txt')->spew("DEF\n"); capture_stderr { runx(qw( git commit -q -m changed -a )) }; $self->_assert_nothing_to_commit; my $output = capture_stderr { system(qw( git push )) }; like( $output, qr/master -> master/, 'push succeeded' ); $self->_assert_nothing_to_push; }; subtest 'untidy file and commit it', sub { $clone_dir->child('foo.txt')->spew("def\n"); runx(qw( git commit -q -m changed -a )); $self->_assert_nothing_to_commit; $self->_assert_branch_is_ahead_of_origin; }; subtest 'cannot push when file is untidy', sub { $self->_assert_branch_is_ahead_of_origin; my $output = capture_stderr { system(qw( git push )) }; like( $output, qr/needs tidying/, 'needs tidying' ); $self->_assert_branch_is_ahead_of_origin; }; subtest 'cannot push when file is untidy (2nd try)', sub { $self->_assert_branch_is_ahead_of_origin; my $output = capture_stderr { system(qw( git push )) }; like( $output, qr/needs tidying/, 'needs tidying' ); like( $output, qr/Identical push seen 2 times/, 'Identical push seen 2 times' ); $self->_assert_branch_is_ahead_of_origin; }; } sub _quote_for_win32 { # The docs for IPC::System::Simple lie about how iallt works on # Windows. On Windows it _always_ invokes a shell, so we need to quote a # path with spaces. return $_[0] unless IS_WIN32 && $_[0] =~ / /; return qq{"$_[0]"}; } sub test_copied_status : Tests { my ($self) = @_; my ( $temp_dir, $work_dir, $pushd ) = $self->_make_working_dir_and_repo; my $foo_file = $work_dir->child('foo.txt'); # If the file isn't long enough the new file doesn't end up with the # "copied" status. $foo_file->spew( "ABC\n" x 500 ); runx(qw( git add foo.txt )); runx(qw( git commit -m foo )); my $bar_file = $work_dir->child('bar.txt'); $bar_file->spew( "ABC\n" x 500 ); $foo_file->spew(q{}); runx(qw( git add foo.txt bar.txt )); my $output = capture_stderr { runx(qw( git commit -m bar )) }; unlike( $output, qr/uninitialized value/i, 'no warnings from Code::TidyAll::Git::Util module' ); } sub test_precommit_stash_issues : Tests { my ($self) = @_; my ( $temp_dir, $work_dir, $pushd ) = $self->_make_working_dir_and_repo; my $foo_file = $work_dir->child('foo.txt'); $foo_file->spew("ABC\n"); my $bar_file = $work_dir->child('bar.txt'); $bar_file->spew("DEF\n"); subtest 'commit two tidy files', sub { $self->_assert_something_to_commit; runx(qw( git add foo.txt bar.txt )); my $output = capture_stderr( sub { runx(qw( git commit -q -m two )) } ); like( $output, qr/\Q[checked] foo.txt/, 'tidyall checked foo.txt' ); like( $output, qr/\Q[checked] bar.txt/, 'tidyall checked bar.txt' ); $self->_assert_nothing_to_commit; }; $foo_file->spew("abc\n"); $bar_file->spew("abc\n"); subtest 'cannot commit untidy files', sub { $self->_assert_something_to_commit; my $output = capture_stderr( sub { system(qw( git commit -q -a -m untidy )) } ); like( $output, qr/2 files did not pass tidyall check/, 'commit failed because 2 files are untidy' ); $self->_assert_something_to_commit; }; $foo_file->spew("ABC\n"); my $baz_file = $work_dir->child('baz.txt'); $baz_file->spew("ABC\n"); subtest 'commit one valid file and working directory is left intact', sub { runx(qw( git add foo.txt )); my ( $stdout, $stderr ) = capture( sub { system(qw( git commit -q -m foo )) } ); like( $stdout, qr/modified:\s+bar\.txt/, 'commit shows bar.txt as still modified' ); is_deeply( [ git_files_to_commit($work_dir) ], [], 'no files to commit' ); is_deeply( [ git_modified_files($work_dir) ], [$bar_file], 'bar.txt is still modified in working directory' ); my $status = capturex(qw( git status --porcelain -unormal )); like( $status, qr/^\?\?\s+baz.txt/m, 'baz.txt is still untracked in working directory' ); }; $foo_file->spew("abc\n"); subtest 'commit one invalid file and working directory is left intact', sub { runx(qw( git add foo.txt )); my ( undef, $stderr ) = capture( sub { system(qw( git commit -q -m foo )) } ); like( $stderr, qr/needs tidying/, 'commit fails because file is not tidied' ); is_deeply( [ git_files_to_commit($work_dir) ], [$foo_file], 'foo.txt is still in the index' ); is_deeply( [ git_modified_files($work_dir) ], [ $bar_file, $foo_file ], 'bar.txt is still modified in working directory' ); my $status = capturex(qw( git status --porcelain -unormal )); like( $status, qr/^\?\?\s+baz.txt/m, 'baz.txt is still untracked in working directory' ); }; runx(qw( git clean -q -dxf )); # We need to add to the stash so we can make sure that it's not popped # incorrectly later. $foo_file->spew("abC\n"); runx(qw( git stash -q )); subtest 'precommit hook does not pop when it did not stash', sub { $foo_file->spew("ABCD\n"); runx(qw( git commit -q -a -m changed )); # The bug we're fixing is that this commit would always pop the stash, # even though the Precommit hook's call to "git stash" hadn't _added_ # to the stash. This meant we'd end up potentially popping some random # thing off the stash, making a huge mess. my $e; try { runx(qw( git commit -q --amend -m amended )) } catch { $e = $_ }; is( $e, undef, 'no bogus pop amending a commit when the stash has old content' ); }; } sub _make_working_dir_and_repo { my $self = shift; $self->require_executable('git'); my $temp_dir = tempdir_simple; my $work_dir = $temp_dir->child('work'); my $hooks_dir = $work_dir->child(qw( .git hooks )); runx( qw( git init -q ), _quote_for_win32($work_dir) ); ok( -d $_, "$_ exists" ) for ( $work_dir, $hooks_dir ); my $pushd = pushd($work_dir); $work_dir->child('tidyall.ini')->spew( sprintf($tidyall_ini_template) ); $work_dir->child('.gitignore')->spew('.tidyall.d'); runx(qw( git add tidyall.ini .gitignore )); runx(qw( git commit -q -m added tidyall.ini .gitignore )); my $precommit_hook_file = $hooks_dir->child('pre-commit'); my $precommit_hook = sprintf( $precommit_hook_template, $self->_lib_dirs ); $precommit_hook_file->spew($precommit_hook); $precommit_hook_file->chmod(0755); return ( $temp_dir, $work_dir, $pushd ); } sub _lib_dirs { join q{ }, map { $Cwd->child($_) } qw( lib t/lib ); } sub _assert_nothing_to_commit { like( capturex( 'git', 'status' ), qr/nothing to commit/, 'nothing to commit' ); } sub _assert_something_to_commit { unlike( capturex( 'git', 'status' ), qr/nothing to commit/, 'something to commit' ); } sub _assert_nothing_to_push { unlike( capturex( 'git', 'status' ), qr/Your branch is ahead/, 'branch is up to date with origin' ); } sub _assert_branch_is_ahead_of_origin { like( capturex( 'git', 'status' ), qr/Your branch is ahead/, 'branch is ahead of origin' ); } $precommit_hook_template = '#!' . $^X . "\n" . <<'EOF'; use lib qw(%s); use Code::TidyAll::Git::Precommit; use strict; use warnings; Code::TidyAll::Git::Precommit->check( tidyall_options => { verbose => 1 } ); EOF $prereceive_hook_template = '#!' . $^X . "\n" . <<'EOF'; use lib qw(%s); use Code::TidyAll::Git::Prereceive; use strict; use warnings; Code::TidyAll::Git::Prereceive->check(); EOF if (IS_WIN32) { for my $t ( $precommit_hook_template, $prereceive_hook_template ) { ( my $perl = $^X ) =~ s{\\}{/}g; $t = qq{#!/bin/sh\n$perl -e '$t'}; } } $tidyall_ini_template = <<'EOF'; [+TestHelper::Plugin::UpperText] select = **/*.txt EOF 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin.pm0000644000175000017500000000525513157756244022154 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin; use strict; use warnings; use autodie; use Capture::Tiny qw(capture); use Code::TidyAll::Util qw(tempdir_simple); use Code::TidyAll; use Path::Tiny qw(path); use Test::Class::Most parent => 'TestHelper::Test::Class'; use Test::Differences qw( eq_or_diff ); __PACKAGE__->SKIP_CLASS('Virtual base class'); my $Test = Test::Builder->new; sub startup : Tests(startup => no_plan) { my $self = shift; $self->{root_dir} = tempdir_simple(); my @extra = $self->_extra_path(); $ENV{PATH} .= q{:} . join ':', @extra if @extra; return; } sub plugin_class { my ($self) = @_; return ( split( '::', ref($self) ) )[-1]; } sub test_filename {'foo.txt'} sub tidyall { my ( $self, %p ) = @_; my $ct = Code::TidyAll->new( quiet => 1, root_dir => $self->{root_dir}, plugins => ( $p{plugin_conf} ? $p{plugin_conf} : $self->_plugin_conf( $p{conf} ) ), ); my ( $source, $result, $output, $error ); if ( $p{source} ) { $source = $p{source}; $source =~ s/\\n/\n/g; ( $output, $error ) = capture { $result = $ct->process_source( $source, $self->test_filename ) }; } elsif ( $p{source_file} ) { ( $output, $error ) = capture { $result = $ct->process_file( $p{source_file} ) }; } else { die 'The tidyall() method requires a source or source_file parameter'; } my $desc = $p{desc} || $p{source} || $p{source_file}; $Test->diag($output) if $output && $ENV{TEST_VERBOSE}; $Test->diag($error) if $error && $ENV{TEST_VERBOSE}; if ( my $expect_tidy = $p{expect_tidy} ) { $expect_tidy =~ s/\\n/\n/g; is( $result->state, 'tidied', "state=tidied [$desc]" ); eq_or_diff( $result->new_contents, $expect_tidy, "new contents [$desc]" ); is( $result->error, undef, "no error [$desc]" ); } elsif ( my $expect_ok = $p{expect_ok} ) { is( $result->state, 'checked', "state=checked [$desc]" ); is( $result->error, undef, "no error [$desc]" ); if ( $result->new_contents ) { $source ||= path( $p{source_file} )->slurp; is( $result->new_contents, $source, "same contents [$desc]" ); } } elsif ( my $expect_error = $p{expect_error} ) { is( $result->state, 'error', "state=error [$desc]" ); like( $result->error || '', $expect_error, "error message [$desc]" ); } } sub _plugin_conf { my $self = shift; my $conf = shift; my $plugin_class = $self->plugin_class; return { $plugin_class => { select => '*', %{ $conf || {} } } }; } sub _extra_path { return; } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/SpacesInPaths.pm0000644000175000017500000000702713157756244023422 0ustar autarchautarchpackage TestFor::Code::TidyAll::SpacesInPaths; use strict; use warnings; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; use Code::TidyAll::Util qw(tempdir_simple); sub _extra_path { ( 'node_modules/.bin', 'php5/usr/bin', ); } sub test_css_unminifier : Tests { my $self = shift; return unless $self->require_executable('node'); return unless $self->require_executable('cssunminifier'); my $file = $self->_spaces_dir->child('foo bar.css'); my $source = "body {\nfont-family:helvetica;\nfont-size:15pt;\n}"; $file->spew($source); $self->tidyall( plugin_conf => { CSSUnminifier => { select => '**/*.css' }, }, source_file => $file, expect_tidy => "body {\n font-family: helvetica;\n font-size: 15pt;\n}\n" ); } sub test_js_plugins : Tests { my $self = shift; return unless $self->require_executable('node'); return unless $self->require_executable('js-beautify') || $ENV{TRAVIS}; return unless $self->require_executable('jshint'); return unless $self->require_executable('jslint'); my $file = $self->_spaces_dir->child('foo bar.js'); $file->spew('var my_object = {};'); $self->tidyall( plugin_conf => { ( $ENV{TRAVIS} ? () : ( JSBeautify => { select => '**/*.js' } ) ), JSHint => { select => '**/*.js' }, JSLint => { select => '**/*.js' }, }, source_file => $file, expect_ok => 1, ); } sub test_mason_tidy : Tests { my $self = shift; my $file = $self->_spaces_dir->child('foo bar.mason'); my $source = "%if(\$foo) {\n%bar(1,2);\n%}"; $file->spew($source); $self->tidyall( plugin_conf => { MasonTidy => { argv => '-m 1 ', select => '**/*.mason' }, }, source_file => $file, expect_tidy => "% if (\$foo) {\n% bar( 1, 2 );\n% }", ); } sub test_perl_plugins : Tests { my $self = shift; my $file = $self->_spaces_dir->child('foo bar.pl'); my $source = <<'EOF'; use strict; use warnings; my $foo = 42; print $foo or die $!; __END__ =pod =head1 NAME Some useless junk =cut EOF $file->spew($source); my %plugins = ( PerlCritic => { argv => '--gentle', select => '**/*.pl' }, PerlTidy => { select => '**/*.pl' }, PerlTidySweet => { select => '**/*.pl' }, PodChecker => { select => '**/*.pl' }, PodTidy => { select => '**/*.pl' }, ); # No ispell on Windows $plugins{PodSpell} = { select => '**/*.pl' } unless $^O eq 'MSWin32'; $self->tidyall( plugin_conf => \%plugins, source_file => $file, expect_ok => 1, ); } sub test_php_code_sniffer : Tests { my $self = shift; return unless $self->require_executable('php'); return unless $self->require_executable('phpcs'); my $file = $self->_spaces_dir->child('foo bar.php'); my $source = ''; $file->spew($source); $self->tidyall( plugin_conf => { PHPCodeSniffer => { argv => '--severity=6', select => '**/*.php' }, }, source_file => $file, expect_ok => 1, ); } sub _spaces_dir { my $self = shift; return $self->{spaces_dir} ||= do { my $dir = $self->{root_dir}->child('has spaces'); $dir->mkpath( { mode => 0755 } ); $dir; }; } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Util.pm0000644000175000017500000000072013157756244021623 0ustar autarchautarchpackage TestFor::Code::TidyAll::Util; use Code::TidyAll::Util qw(tempdir_simple); use Path::Tiny; use Test::Class::Most parent => 'TestHelper::Test::Class'; sub test_tempdir_simple : Tests { my $dir; { my $tempdir = tempdir_simple(); $dir = path($tempdir); ok( -d $tempdir, 'tempdir exists' ); } ok( -d $dir->parent, 'parent exists' ); ok( !-d $dir, 'tempdir does not exist after it goes out of scope' ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Basic.pm0000644000175000017500000005557613157756244021752 0ustar autarchautarchpackage TestFor::Code::TidyAll::Basic; use Capture::Tiny qw(capture capture_stdout capture_merged); use Code::TidyAll::CacheModel::Shared; use Code::TidyAll::Util qw(tempdir_simple); use Code::TidyAll; use File::Find qw(find); use File::pushd qw(pushd); use IPC::Run3 qw( run3 ); use Path::Tiny qw(cwd path); use Test::Class::Most parent => 'TestHelper::Test::Class'; use Test::Fatal; sub test_plugin {"+TestHelper::Plugin::$_[0]"} my %UpperText = ( test_plugin('UpperText') => { select => '**/*.txt', ignore => 'plugin_ignore/*' } ); my %ReverseFoo = ( test_plugin('ReverseFoo') => { select => '**/foo*' } ); my %RepeatFoo = ( test_plugin('RepeatFoo') => { select => '**/foo*' } ); my %CheckUpper = ( test_plugin('CheckUpper') => { select => '**/*.txt' } ); my %AToZ = ( test_plugin('AToZ') => { select => '**/*.txt' } ); my $cli_conf = <<'EOF'; backup_ttl = 15m verbose = 1 ignore = global_ignore/* [+TestHelper::Plugin::UpperText] select = **/*.txt ignore = plugin_ignore/* [+TestHelper::Plugin::RepeatFoo] select = **/foo* times = 3 EOF sub test_basic : Tests { my $self = shift; $self->tidy( plugins => {}, source => { 'foo.txt' => 'abc' }, dest => { 'foo.txt' => 'abc' }, desc => 'one file no plugins', ); $self->tidy( plugins => {%UpperText}, source => { 'foo.txt' => 'abc' }, dest => { 'foo.txt' => 'ABC' }, desc => 'one file UpperText', ); $self->tidy( plugins => { test_plugin('UpperText') => { select => '**/*.txt', only_modes => 'upper' }, test_plugin('ReverseFoo') => { select => '**/foo*', only_modes => 'reversals' } }, source => { 'foo.txt' => 'abc' }, dest => { 'foo.txt' => 'cba' }, desc => 'one file reversals mode', options => { mode => 'reversals' }, ); $self->tidy( plugins => { %UpperText, %ReverseFoo }, source => { 'foo.txt' => 'abc', 'bar.txt' => 'def', 'foo.tx' => 'ghi', 'bar.tx' => 'jkl' }, dest => { 'foo.txt' => 'CBA', 'bar.txt' => 'DEF', 'foo.tx' => 'ihg', 'bar.tx' => 'jkl' }, desc => 'four files UpperText ReverseFoo', ); $self->tidy( plugins => {%UpperText}, source => { 'foo.txt' => 'abc1' }, dest => { 'foo.txt' => 'abc1' }, desc => 'one file UpperText errors', errors => qr/non-alpha content/ ); $self->tidy( plugins => {%UpperText}, options => { ignore => ['global_ignore/*'], }, source => { 'global_ignore/foo.txt' => 'abc', 'plugin_ignore/bar.txt' => 'def', }, dest => { 'global_ignore/foo.txt' => 'abc', 'plugin_ignore/bar.txt' => 'def', }, desc => 'global and plugin ignores', ); } sub test_filemode : Tests { my $self = shift; if ( $^O eq 'MSWin32' ) { $self->builder->skip('File mode on Windows is weird'); return; } my $root_dir = $self->create_dir( { 'foo.txt' => 'abc' } ); my $file = $root_dir->child('foo.txt'); $file->chmod('0755'); my $ct = Code::TidyAll->new( plugins => { test_plugin('UpperText') => { select => '**/foo*' } }, root_dir => $root_dir, ); $ct->process_paths($file); is( $file->slurp, 'ABC' ); is( $file->stat->mode, 0100755 ); } sub test_multiple_plugin_instances : Tests { my $self = shift; $self->tidy( plugins => { test_plugin('RepeatFoo for txt') => { select => '**/*.txt', times => 2 }, test_plugin('RepeatFoo for foo') => { select => '**/foo.*', times => 3 }, %UpperText }, source => { 'foo.txt' => 'abc', 'foo.dat' => 'def', 'bar.txt' => 'ghi' }, dest => { 'foo.txt' => scalar( 'ABC' x 6 ), 'foo.dat' => scalar( 'def' x 3 ), 'bar.txt' => scalar( 'GHI' x 2 ) } ); } sub test_plugin_order_and_atomicity : Tests { my $self = shift; my @plugins = map { ( %ReverseFoo, test_plugin("UpperText $_") => { select => '**/*.txt' }, test_plugin("CheckUpper $_") => { select => '**/*.txt' }, # note without the weight here this would run first, and the # letters in the photetic words themselves would be reversed test_plugin('AlwaysPhonetic') => { select => '**/*.txt', weight => 51 } ) } ( 1 .. 3 ); $self->tidy( plugins => {@plugins}, options => { verbose => 1 }, source => { 'foo.txt' => 'abc' }, dest => { 'foo.txt' => 'CHARLIE-BRAVO-ALFA' }, like_output => qr/.*ReverseFoo, .*UpperText 1, .*UpperText 2, .*UpperText 3, .*CheckUpper 1, .*CheckUpper 2, .*CheckUpper 3/ ); $self->tidy( plugins => { %AToZ, %ReverseFoo, %CheckUpper }, options => { verbose => 1 }, source => { 'foo.txt' => 'abc' }, dest => { 'foo.txt' => 'abc' }, errors => qr/lowercase found/, like_output => qr/foo.txt (.*ReverseFoo, .*CheckUpper)/ ); } sub test_quiet_and_verbose : Tests { my $self = shift; foreach my $state ( 'normal', 'quiet', 'verbose' ) { foreach my $error ( 0, 1 ) { my $root_dir = $self->create_dir( { 'foo.txt' => ( $error ? '123' : 'abc' ) } ); my $output = capture_stdout { my $ct = Code::TidyAll->new( plugins => {%UpperText}, root_dir => $root_dir, ( $state eq 'normal' ? () : ( $state => 1 ) ) ); $ct->process_paths("$root_dir/foo.txt"); }; if ($error) { like( $output, qr/non-alpha content found/, "non-alpha content found ($state)" ); } else { is( $output, "[tidied] foo.txt\n" ) if $state eq 'normal'; is( $output, q{} ) if $state eq 'quiet'; like( $output, qr/purging old backups/, "purging old backups ($state)" ) if $state eq 'verbose'; like( $output, qr/\[tidied\] foo\.txt \(\+TestHelper::Plugin::UpperText\)/s, "foo.txt ($state)" ) if $state eq 'verbose'; } } } } sub test_iterations : Tests { my $self = shift; my $root_dir = $self->create_dir( { 'foo.txt' => 'abc' } ); my $ct = Code::TidyAll->new( plugins => { test_plugin('RepeatFoo') => { select => '**/foo*', times => 3 } }, root_dir => $root_dir, iterations => 2 ); my $file = $root_dir->child('foo.txt'); $ct->process_paths($file); is( $file->slurp, scalar( 'abc' x 9 ), '3^2 = 9' ); } sub test_caching_and_backups : Tests { my $self = shift; my @chi_or_no_chi = (q{}); if ( eval 'use CHI; 1' ) { push @chi_or_no_chi, 'chi'; } foreach my $chi (@chi_or_no_chi) { foreach my $cache_model_class ( qw( Code::TidyAll::CacheModel Code::TidyAll::CacheModel::Shared ) ) { foreach my $no_cache ( 0 .. 1 ) { foreach my $no_backups ( 0 .. 1 ) { my $desc = "(no_cache=$no_cache, no_backups=$no_backups, model=$cache_model_class, cache_class=$chi)"; my $root_dir = $self->create_dir( { 'foo.txt' => 'abc' } ); my $ct = Code::TidyAll->new( plugins => {%UpperText}, root_dir => $root_dir, cache_model_class => $cache_model_class, ( $no_cache ? ( no_cache => 1 ) : () ), ( $no_backups ? ( no_backups => 1 ) : () ), ( $chi ? ( cache => _chi() ) : () ), ); my $output; my $file = path( $root_dir, 'foo.txt' ); my $go = sub { $output = capture_stdout { $ct->process_paths($file) }; }; $go->(); is( $file->slurp, "ABC", "first file change $desc" ); is( $output, "[tidied] foo.txt\n", "first output $desc" ); $go->(); if ($no_cache) { is( $output, "[checked] foo.txt\n", "second output $desc" ); } else { is( $output, q{}, "second output $desc" ); } $file->spew('ABCD'); $go->(); is( $output, "[checked] foo.txt\n", "third output $desc" ); $file->spew('def'); $go->(); is( $file->slurp, 'DEF', "fourth file change $desc" ); is( $output, "[tidied] foo.txt\n", "fourth output $desc" ); my $backup_dir = $ct->data_dir->child('backups'); $backup_dir->mkpath( { mode => 0775 } ); my @files; find( { follow => 0, wanted => sub { push @files, $_ if -f }, no_chdir => 1 }, $backup_dir ); if ($no_backups) { ok( @files == 0, "no backup files $desc" ); } else { ok( scalar(@files) == 1 || scalar(@files) == 2, "1 or 2 backup files $desc" ); foreach my $file (@files) { like( $file, qr|\.tidyall\.d/backups/foo\.txt-\d+-\d+\.bak|, "backup filename $desc" ); } } } } } } } sub _chi { my $datastore = {}; return CHI->new( driver => 'Memory', datastore => $datastore ); } sub test_selects_and_ignores : Tests { my $self = shift; my @files = ( 'a/foo.pl', 'b/foo.pl', 'a/foo.pm', 'a/bar.pm', 'b/bar.pm' ); my $root_dir = $self->create_dir( { map { $_ => 'hi' } @files } ); my $ct = Code::TidyAll->new( root_dir => $root_dir, plugins => { test_plugin('UpperText') => { select => [qw( **/*.pl **/*.pm b/bar.pm c/bar.pl )], ignore => [qw( a/foo.pl **/bar.pm c/baz.pl )], } } ); cmp_set( [ map { $_->stringify } $ct->find_matched_files() ], [ "$root_dir/a/foo.pm", "$root_dir/b/foo.pl" ] ); cmp_deeply( [ map { $_->name } $ct->plugins_for_path('a/foo.pm') ], [ test_plugin('UpperText') ] ); } sub test_shebang : Tests { my $self = shift; my %files = ( 'a/foo.pl' => '#!/usr/bin/perl', 'a/foo' => '#!/usr/bin/perl', 'a/bar' => '#!/usr/bin/ruby', 'a/baz' => 'just another perl hacker', 'b/foo' => '#!/usr/bin/perl6', 'b/bar' => '#!/usr/bin/perl5', 'b/baz' => '#!perl -w', 'b/bar.pm' => 'package b::bar;', ); my $root_dir = $self->create_dir( \%files ); my $ct = Code::TidyAll->new( root_dir => $root_dir, plugins => { test_plugin('UpperText') => { select => ['**/*'], ignore => ['**/*.*'], shebang => [ 'perl', 'perl5' ], } } ); cmp_set( [ map { $_->stringify } $ct->find_matched_files() ], [ map {"$root_dir/$_"} qw( a/foo b/bar b/baz ) ], ); } sub test_dirs : Tests { my $self = shift; my @files = ( 'a/foo.txt', 'a/bar.txt', 'a/bar.pl', 'b/foo.txt' ); my $root_dir = $self->create_dir( { map { $_ => 'hi' } @files } ); foreach my $recursive ( 0 .. 1 ) { my @results; my $output = capture_merged { my $ct = Code::TidyAll->new( plugins => { %UpperText, %ReverseFoo }, root_dir => $root_dir, ( $recursive ? ( recursive => 1 ) : () ) ); @results = $ct->process_paths("$root_dir/a"); }; if ($recursive) { is( @results, 3, '3 results' ); is( scalar( grep { $_->state eq 'tidied' } @results ), 2, '2 tidied' ); like( $output, qr/\[tidied\] a\/foo.txt/ ); like( $output, qr/\[tidied\] a\/bar.txt/ ); is( path( $root_dir, 'a', 'foo.txt' )->slurp, 'IH' ); is( path( $root_dir, 'a', 'bar.txt' )->slurp, 'HI' ); is( path( $root_dir, 'a', 'bar.pl' )->slurp, 'hi' ); is( path( $root_dir, 'b', 'foo.txt' )->slurp, 'hi' ); } else { is( @results, 1, '1 result' ); is( $results[0]->state, 'error', 'error' ); like( $output, qr/is a directory/ ); } } } sub test_paths_in_messages : Tests { my $self = shift; $self->tidy( plugins => { test_plugin('UpperText') => { select => '**/*.txt' }, }, options => { check_only => 1 }, source => { 'path/to/file1.txt' => "abc\n", 'path/to/longer/file2.txt' => "abc\n", 'top.txt' => "abc\n", }, errors => [ qr{\[checked\] +path/to/file1\.txt}, qr{\[checked\] +path/to/longer/file2\.txt}, qr{\[checked\] +top\.txt}, ], ); } sub test_errors : Tests { my $self = shift; my $root_dir = $self->create_dir( { 'foo/bar.txt' => 'abc' } ); throws_ok { Code::TidyAll->new( root_dir => $root_dir ) } qr/Missing required/; throws_ok { Code::TidyAll->new( plugins => {} ) } qr/Missing required/; throws_ok { Code::TidyAll->new( root_dir => $root_dir, plugins => {}, bad_param => 1, worse_param => 2 ); } qr/unknown constructor params 'bad_param', 'worse_param'/; throws_ok { Code::TidyAll->new( root_dir => $root_dir, plugins => { 'DoesNotExist' => { select => '**/*' } } )->_plugin_objects; } qr/could not load plugin class/; throws_ok { Code::TidyAll->new( root_dir => $root_dir, plugins => { test_plugin('UpperText') => { select => '**/*', bad_option => 1, worse_option => 2 } } )->_plugin_objects; } qr/unknown options/; my $ct = Code::TidyAll->new( plugins => {%UpperText}, root_dir => $root_dir ); my $output = capture_stdout { $ct->process_paths("$root_dir/baz/blargh.txt") }; like( $output, qr/baz\/blargh.txt: not a file or directory/, 'file not found' ); $output = capture_stdout { $ct->process_paths("$root_dir/foo/bar.txt") }; is( $output, "[tidied] foo/bar.txt\n", 'filename output' ); is( path( $root_dir, 'foo', 'bar.txt' )->slurp, 'ABC', 'tidied' ); my $other_dir = tempdir_simple(); $other_dir->child('foo.txt')->spew('ABC'); throws_ok { $ct->process_paths("$other_dir/foo.txt") } qr/not underneath root dir/; } sub test_git_files : Tests { my $self = shift; # Included examples: # * basic modified file # * renamed but not modified file (perltidy) -- the -> is in the filename # * deleted file # * renamed and modified file my $status = qq{## git-status-porcelain\0 M lib/Code/TidyAll/Git/Util.pm\0R perltidyrc -> xyz\0perltidyrc\0 M t/lib/Test/Code/TidyAll/Basic.pm\0D tidyall.ini\0RM weaver.initial\0weaver.ini\0}; require Code::TidyAll::Git::Util; my @files = Code::TidyAll::Git::Util::_parse_status($status); is_deeply( \@files, [ 'lib/Code/TidyAll/Git/Util.pm', 't/lib/Test/Code/TidyAll/Basic.pm', 'weaver.initial', ] ); } sub test_ignore : Tests { my $self = shift; my $root_dir = $self->create_dir(); my $subdir = $root_dir->child('subdir'); # global ignores # $subdir = $root_dir->child('global_ignore'); $subdir->mkpath( { mode => 0775 } ); $subdir->child('bar.txt')->spew('bye'); my $cwd = cwd(); capture_stdout { my $pushed = pushd($root_dir); system( $^X, "-I$cwd/lib", "-I$cwd/t/lib", "$cwd/bin/tidyall", 'global_ignore/bar.txt' ); }; is( $root_dir->child( 'global_ignore', 'bar.txt' )->slurp, 'bye', 'bar.txt not tidied because of global ignore', ); # plugin ignores # $subdir = $root_dir->child('plugin_ignore'); $subdir->mkpath( { mode => 0775 } ); $subdir->child('bar.txt')->spew('bye'); $cwd = cwd(); capture_stdout { my $pushed = pushd($root_dir); system( $^X, "-I$cwd/lib", "-I$cwd/t/lib", "$cwd/bin/tidyall", 'plugin_ignore/bar.txt' ); }; is( $root_dir->child( 'global_ignore', 'bar.txt' )->slurp, 'bye', 'bar.txt not tidied because of plugin ignore', ); } sub test_cli : Tests { my $self = shift; my $output; my @cmd = ( $^X, qw( -Ilib -It/lib bin/tidyall ) ); my $run = sub { system( @cmd, @_ ) }; $output = capture_stdout { $run->('--version'); }; like( $output, qr/tidyall .* on perl/, '--version output' ); $output = capture_stdout { $run->('--help'); }; like( $output, qr/Usage.*Options:/s, '--help output' ); foreach my $conf_name ( 'tidyall.ini', '.tidyallrc' ) { subtest( "conf at $conf_name", sub { my $root_dir = $self->create_dir(); my $conf_file = $root_dir->child($conf_name); $conf_file->spew($cli_conf); $root_dir->child('foo.txt')->spew('hello'); my $output = capture_stdout { $run->( $root_dir->child('foo.txt'), '-v' ); }; my ($params_msg) = ( $output =~ /constructing Code::TidyAll with these params:(.*)/ ); ok( defined($params_msg), 'params msg' ); like( $params_msg, qr/backup_ttl => '15m'/, 'backup_ttl' ); like( $params_msg, qr/verbose => '?1'?/, 'verbose' ); like( $params_msg, qr/\Qroot_dir => '$root_dir'\E/, 'root_dir' ); like( $output, qr/\[tidied\] foo.txt \(.*RepeatFoo, .*UpperText\)/, 'foo.txt' ); is( $root_dir->child('foo.txt')->slurp, 'HELLOHELLOHELLO', 'tidied' ); my $subdir = $root_dir->child('subdir'); $subdir->mkpath( { mode => 0775 } ); $subdir->child('foo.txt')->spew('bye'); $subdir->child('foo2.txt')->spew('bye'); my $cwd = cwd(); capture_stdout { my $pushed = pushd($subdir); system( $^X, "-I$cwd/lib", "-I$cwd/t/lib", "$cwd/bin/tidyall", 'foo.txt' ); }; is( $root_dir->child( 'subdir', 'foo.txt' )->slurp, 'BYEBYEBYE', 'foo.txt tidied' ); is( $root_dir->child( 'subdir', 'foo2.txt' )->slurp, 'bye', 'foo2.txt not tidied' ); subtest( 'pipe success', sub { my ( $stdout, $stderr ); run3( [ @cmd, '-p', $root_dir->child(qw( does_not_exist foo.txt )) ], \'echo', \$stdout, \$stderr, ); is( $stdout, 'ECHOECHOECHO', 'pipe: stdin tidied' ); unlike( $stderr, qr/\S/, 'pipe: no stderr' ); } ); subtest( 'pipe error', sub { my ( $stdout, $stderr ); run3( [ @cmd, '--pipe', $root_dir->child('foo.txt') ], \'abc1', \$stdout, \$stderr, ); is( $stdout, 'abc1', 'pipe: stdin mirrored to stdout' ); like( $stderr, qr/non-alpha content found/ ); } ); } ); } } sub test_inc : Tests { my $self = shift; my $root_dir = $self->create_dir( { 'foo.txt' => 'abc' } ); my $ct = Code::TidyAll->new( inc => [ 't/inc1', 't/inc2' ], plugins => { test_plugin('UpperText') => { select => '**/*.txt' }, '+Foo' => { select => '*' }, '+Bar' => { select => '*' }, }, root_dir => $root_dir, ); is_deeply( [ sort map { ref($_) } @{ $ct->_plugin_objects } ], [qw( Bar Foo TestHelper::Plugin::UpperText )], 'when inc is provided it is used when loading plugins' ); # We don't care what the plugins do, just that they run. One of the # plugins we loaded, Foo.pm, contains some code which executes some tests. my $file = $root_dir->child('foo.txt'); $ct->process_paths($file); } sub test_selected_plugins : Tests { my $self = shift; my $root_dir = $self->create_dir( { 'foo.txt' => 'abc' } ); my $ct = Code::TidyAll->new( plugins => { %UpperText, %ReverseFoo, %RepeatFoo, %CheckUpper, %AToZ, }, selected_plugins => [ test_plugin('UpperText'), test_plugin('ReverseFoo') ], root_dir => $root_dir, ); is_deeply( [ sort map { ref($_) } @{ $ct->_plugin_objects } ], [qw( TestHelper::Plugin::ReverseFoo TestHelper::Plugin::UpperText )], 'when selected_plugins is provided only those plugins are used' ); $ct = Code::TidyAll->new( plugins => { %UpperText, %ReverseFoo, %RepeatFoo, %CheckUpper, %AToZ, }, selected_plugins => [ test_plugin('UpperText'), test_plugin('ReverseFoo'), 'DoesNotExist', 'NorDoesThis' ], root_dir => $root_dir, ); like( exception { $ct->_plugin_objects }, qr/\QAsked for unknown plugins: [DoesNotExist NorDoesThis]/, 'exception is thrown when selected_plugins include unknown plugins' ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/SVN.pm0000644000175000017500000001032013157756244021351 0ustar autarchautarchpackage TestFor::Code::TidyAll::SVN; use Capture::Tiny qw(capture_stdout capture_stderr capture); use Code::TidyAll::SVN::Precommit; use Code::TidyAll::SVN::Util qw(svn_uncommitted_files); use Code::TidyAll::Util qw(tempdir_simple); use Code::TidyAll; use IPC::System::Simple qw(run); use Path::Tiny qw(path); use Test::Class::Most parent => 'TestHelper::Test::Class'; my ( $precommit_hook_template, $tidyall_ini_template ); sub test_svn : Tests { my ($self) = @_; $self->require_executable('svn'); my $temp_dir = tempdir_simple(); my $repo_dir = $temp_dir->child('repo'); my $src_dir = $temp_dir->child('src'); my $work_dir = $temp_dir->child('work'); my $hook_log = $temp_dir->child('hook.log'); my ( $stdout, $stderr ); my $log_contains = sub { my $regex = shift; like( $hook_log->slurp, $regex ); }; my $clear_log = sub { run("cat /dev/null > $hook_log"); }; my $committed = sub { $stdout = capture_stdout { system( sprintf( 'svn status %s', $work_dir ) ) }; unlike( $stdout, qr/\S/, 'committed' ); }; my $uncommitted = sub { $stdout = capture_stdout { system( sprintf( 'svn status %s', $work_dir ) ) }; like( $stdout, qr/^M/, 'uncommitted' ); }; run("svnadmin create $repo_dir"); my $hooks_dir = $repo_dir->child('hooks'); ok( $hooks_dir->is_dir, "$hooks_dir exists" ); $src_dir->mkpath(0775); $src_dir->child('foo.txt')->spew('abc'); run( sprintf( q{svn -q import %s file://%s/myapp/trunk -m "import"}, $src_dir, $repo_dir ) ); run( sprintf( 'svn -q checkout file://%s/myapp/trunk %s', $repo_dir, $work_dir ) ); my $foo_txt = $work_dir->child('foo.txt'); is( $foo_txt->slurp, 'abc', 'checkout and import ok' ); cmp_deeply( [ svn_uncommitted_files($work_dir) ], [], 'no uncommitted files' ); my $precommit_hook_file = $hooks_dir->child('pre-commit'); my $precommit_hook = sprintf( $precommit_hook_template, path('lib')->realpath, $hook_log ); $precommit_hook_file->spew($precommit_hook); $precommit_hook_file->chmod(0755); my $bar_dir = $work_dir->child('bar'); $bar_dir->mkpath( { mode => 0755 } ); $bar_dir->child('foo.txt')->spew('abc '); run( sprintf( 'svn -q add %s', $bar_dir ) ); cmp_deeply( [ svn_uncommitted_files($work_dir) ], [ re('foo.txt') ], 'one uncommitted file' ); $stderr = capture_stderr { run( sprintf( q{svn -q commit -m "changed" %s %s}, $foo_txt, $bar_dir ) ); }; unlike( $stderr, qr/\S/ ); $log_contains->(qr|could not find.*upwards from 'myapp/trunk/foo.txt'|); $clear_log->(); $committed->(); cmp_deeply( [ svn_uncommitted_files($work_dir) ], [], 'no uncommitted files' ); my $tidyall_ini = $work_dir->child('tidyall.ini'); $tidyall_ini->spew($tidyall_ini_template); run( sprintf( 'svn -q add %s', $tidyall_ini ) ); cmp_deeply( [ svn_uncommitted_files($work_dir) ], [ re('tidyall.ini') ], 'one uncommitted file' ); run( sprintf( q{svn -q commit -m "added" %s}, $tidyall_ini ) ); $foo_txt->spew('abc'); $stderr = capture_stderr { system( sprintf( q{svn -q commit -m "changed" %s}, $foo_txt ) ) }; like( $stderr, qr/1 file did not pass tidyall check/ ); like( $stderr, qr/needs tidying/ ); $uncommitted->(); $foo_txt->spew('ABC'); my $bar_dat = $work_dir->child('bar.dat'); $bar_dat->spew('123'); run( sprintf( 'svn -q add %s', $bar_dat ) ); $stderr = capture_stderr { system( sprintf( q{svn -q commit -m "changed" %s %s}, $foo_txt, $bar_dat ) ); }; unlike( $stderr, qr/\S/ ); $committed->(); $foo_txt->spew('def'); $stderr = capture_stderr { system( sprintf( q{svn -q commit -m "NO TIDYALL - emergency fix!" %s}, $foo_txt ) ); }; unlike( $stderr, qr/\S/ ); $committed->(); } $precommit_hook_template = '#!' . $^X . "\n" . <<'EOF'; use lib qw(%s); use Code::TidyAll::SVN::Precommit; use Log::Any::Adapter (File => '%s'); use strict; use warnings; Code::TidyAll::SVN::Precommit->check( extra_conf_files => ['perlcriticrc'], tidyall_options => { verbose => 1 } ); EOF $tidyall_ini_template = <<'EOF'; [+TestHelper::Plugin::UpperText] select = **/*.txt EOF Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Parallel.pm0000644000175000017500000000170513157756244022446 0ustar autarchautarchpackage TestFor::Code::TidyAll::Parallel; use Test::Class::Most parent => 'TestHelper::Test::Class'; use strict; use warnings; sub test_parallel : Tests { my $self = shift; if ( $^O eq 'MSWin32' ) { $self->builder->skip('Parallel::ForkManager does not seem to work on Windows'); return; } $self->tidy( plugins => { '+TestHelper::Plugin::UpperText' => { select => '**/*.txt', }, }, source => { 'foo.txt' => "abc\n", 'bar.txt' => "def\n", 'baz.txt' => "ghi\n", 'quux.txt' => "jkl\n", }, dest => { 'foo.txt' => "ABC\n", 'bar.txt' => "DEF\n", 'baz.txt' => "GHI\n", 'quux.txt' => "JKL\n", }, options => { jobs => 3 }, desc => 'three jobs in parallel', like_output => qr/\Q[tidied]\E +bar\.txt/s, ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/0000775000175000017500000000000013157756244021611 5ustar autarchautarchCode-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/JSBeautify.pm0000644000175000017500000000466113157756244024161 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::JSBeautify; use Encode qw(encode); use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; BEGIN { unless ( $ENV{TRAVIS} ) { require Test::Warnings; Test::Warnings->import('warnings'); } } sub SKIP_CLASS { # For some reason running js-beautify fails under Travis for no reason I # can understand # (https://travis-ci.org/houseabsolute/perl-code-tidyall/jobs/276610909). I've # updating all the NPM modules. I've tried changing how the command is # called. I've tried a lot of things! But the test still passes locally, # so I'm giving up for now. return $ENV{TRAVIS} ? 'Running js-beautify fails under travis for some reason' : 0; } sub _extra_path { 'node_modules/.bin'; } sub test_main : Tests { my $self = shift; return unless $self->require_executable('node'); return unless $self->require_executable('js-beautify'); my $source = 'sp.toggleResult=function(id){foo(id)}'; $self->tidyall( source => $source, expect_tidy => 'sp.toggleResult = function(id) {\n foo(id)\n}', ); $self->tidyall( source => $source, conf => { argv => '--indent-size 3 --brace-style expand' }, expect_tidy => 'sp.toggleResult = function(id)\n{\n foo(id)\n}', ); } sub test_utf8 : Tests { my $self = shift; return unless $self->require_executable('node'); return unless $self->require_executable('js-beautify'); my $contents = encode( 'UTF-8', qq{var unicode = "Unicode - \x{263a}";} ); my $expect = encode( 'UTF-8', qq{var unicode = "Unicode - \x{263a}";} ); local $SIG{__WARN__} = sub { Carp::cluck(@_) }; is_deeply( [ warnings { $self->tidyall( source => $contents, expect_tidy => $expect, desc => 'tidy UTF-8 from string', ); } ], [], 'no warnings tidying UTF-8 source' ); my $file = $self->{root_dir}->child('test.js'); $file->spew($contents); is_deeply( [ warnings { $self->tidyall( source_file => $file, expect_tidy => $expect, desc => 'tidy UTF-8 from file', ); } ], [], 'no warnings tidying UTF-8 source' ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/CSSUnminifier.pm0000644000175000017500000000134613157756244024627 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::CSSUnminifier; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub _extra_path { 'node_modules/.bin'; } sub test_main : Tests { my $self = shift; return unless $self->require_executable('node'); return unless $self->require_executable('cssunminifier'); my $source = "body {\nfont-family:helvetica;\nfont-size:15pt;\n}"; $self->tidyall( source => $source, expect_tidy => "body {\n font-family: helvetica;\n font-size: 15pt;\n}\n" ); $self->tidyall( source => $source, conf => { argv => '-w=2' }, expect_tidy => "body {\n font-family: helvetica;\n font-size: 15pt;\n}\n" ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/JSHint.pm0000644000175000017500000000407013157756244023305 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::JSHint; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_filename {'foo.js'} sub _extra_path { 'node_modules/.bin'; } sub test_main : Tests { my $self = shift; return unless $self->require_executable('node'); return unless $self->require_executable('jshint'); $self->tidyall( source => 'var my_object = {};', expect_ok => 1, desc => 'ok - camelcase', ); $self->tidyall( source => 'while (day)\n shuffle();', expect_ok => 1, desc => 'ok no brace', ); $self->tidyall( source => 'var my_object = new Object();', expect_error => qr/object literal notation/, desc => 'error - object literal', ); $self->tidyall( source => 'var my_object = {};', conf => { options => 'camelcase' }, expect_error => qr/not in camel case/, desc => 'error - camel case - options=camelcase', ); $self->tidyall( source => 'var my_object = {};', conf => { options => 'camelcase curly' }, expect_error => qr/not in camel case/, desc => 'error - camel case - options=camelcase,curly', ); $self->tidyall( source => 'while (day)\n shuffle();', conf => { options => 'camelcase curly' }, expect_error => qr/Expected \'\{/, desc => 'error - curly - options=camelcase,curly', ); my $rc_file = $self->{root_dir}->child('jshint.json'); $rc_file->spew(q[{"camelcase": true}]); $self->tidyall( source => 'var my_object = {};', conf => { argv => "--config $rc_file" }, expect_error => qr/not in camel case/, desc => 'error - camelcase - conf file', ); $self->tidyall( source => 'var my_object = {};', conf => { argv => '--badoption' }, expect_error => qr/Unknown option/, desc => 'error - bad option' ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/PodTidy.pm0000644000175000017500000000440413157756244023523 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::PodTidy; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_main : Tests { my $self = shift; my $source = '=head1 DESCRIPTION There are a lot of great code tidiers and validators out there. C makes them available from a single unified interface. You can run C on a single file or on an entire project hierarchy, and configure which tidiers/validators are applied to which files. C will back up files beforehand, and for efficiency will only consider files that have changed since they were last processed. '; $self->tidyall( source => $source, expect_tidy => '=head1 DESCRIPTION There are a lot of great code tidiers and validators out there. C makes them available from a single unified interface. You can run C on a single file or on an entire project hierarchy, and configure which tidiers/validators are applied to which files. C will back up files beforehand, and for efficiency will only consider files that have changed since they were last processed. ', desc => 'tidy - defaults', ); $self->tidyall( source => '=head1 DESCRIPTION There are a lot of great code tidiers and validators out there. C makes them available from a single unified interface. You can run C on a single file or on an entire project hierarchy, and configure which tidiers/validators are applied to which files. C will back up files beforehand, and for efficiency will only consider files that have changed since they were last processed. ', expect_ok => 1, desc => 'ok - defaults', ); $self->tidyall( source => $source, conf => { columns => 30 }, expect_tidy => '=head1 DESCRIPTION There are a lot of great code tidiers and validators out there. C makes them available from a single unified interface. You can run C on a single file or on an entire project hierarchy, and configure which tidiers/validators are applied to which files. C will back up files beforehand, and for efficiency will only consider files that have changed since they were last processed. ', desc => 'tidy - columns = 30', ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/PerlTidySweet.pm0000644000175000017500000000225713157756244024717 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::PerlTidySweet; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_main : Tests { my $self = shift; my $source = 'if ( $foo) {\nmy $bar = $baz;\n}\n'; $self->tidyall( conf => { argv => '-npro' }, source => $source, expect_tidy => 'if ($foo) {\n my $bar = $baz;\n}\n' ); $self->tidyall( conf => { argv => '-npro -bl' }, source => $source, expect_tidy => 'if ($foo)\n{\n my $bar = $baz;\n}\n' ); $self->tidyall( conf => { argv => '-npro' }, source => 'if ($foo) {\n my $bar = $baz;\n}\n', expect_ok => 1 ); $self->tidyall( source => 'method foo ($x,$y){\nmy $x=$self->x;}\n', expect_tidy => 'method foo ($x,$y) {\n my $x = $self->x;\n}\n', ); $self->tidyall( source => 'if ($foo) {\n my $bar = $baz;\n', expect_error => qr/Final nesting depth/ ); $self->tidyall( conf => { argv => '--badoption' }, source => $source, expect_error => qr/Unknown option: badoption/ ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/PHPCodeSniffer.pm0000644000175000017500000000152113157756244024703 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::PHPCodeSniffer; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_filename {'foo.php'} sub _extra_path { 'php5/usr/bin'; } sub test_main : Tests { my $self = shift; return unless $self->require_executable('php'); return unless $self->require_executable('phpcs'); my $source = ''; $self->tidyall( source => $source, conf => { argv => '--severity=6' }, expect_ok => 1, ); $self->tidyall( source => $source, conf => { argv => '--severity=3' }, expect_error => qr/Missing .* doc/, ); $self->tidyall( source => $source, conf => { argv => '--blahblah' }, expect_error => qr/not known/, ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/SortLines.pm0000644000175000017500000000047413157756244024074 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::SortLines; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_main : Tests { my $self = shift; $self->tidyall( source => "c\nb\na\n", expect_tidy => "a\nb\nc\n" ); $self->tidyall( source => "\n\na\n\n\n", expect_tidy => "a\n" ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/PerlTidy.pm0000644000175000017500000000307613157756244023707 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::PerlTidy; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; use Getopt::Long; sub test_main : Tests { my $self = shift; my $source = 'if ( $foo) {\nmy $bar = $baz;\n}\n'; $self->tidyall( conf => { argv => '-npro' }, source => $source, expect_tidy => 'if ($foo) {\n my $bar = $baz;\n}\n' ); $self->tidyall( conf => { argv => '-npro -bl' }, source => $source, expect_tidy => 'if ($foo)\n{\n my $bar = $baz;\n}\n' ); $self->tidyall( conf => { argv => '-npro' }, source => 'if ($foo) {\n my $bar = $baz;\n}\n', expect_ok => 1 ); $self->tidyall( conf => { argv => '-npro' }, source => 'if ($foo) {\n my $bar = $baz;\n', expect_error => qr/Final nesting depth/ ); $self->tidyall( conf => { argv => '-npro --badoption' }, source => $source, expect_error => qr/Unknown option: badoption/ ); } sub test_getopt_bug : Tests { my $self = shift; # This emulates what Getopt::Long::Descriptive does, which in turn breaks # Perl::Tidy. See https://rt.cpan.org/Ticket/Display.html?id=118558 Getopt::Long::Configure(qw( bundling no_auto_help no_ignore_case )); my $source = 'if ( $foo) {\nmy $bar = $baz;\n}\n'; $self->tidyall( conf => { argv => '-npro' }, source => $source, expect_tidy => 'if ($foo) {\n my $bar = $baz;\n}\n' ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/PodSpell.pm0000644000175000017500000000260713157756244023674 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::PodSpell; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_filename {'Foo.pod'} sub test_main : Tests { my $self = shift; if ( $^O eq 'MSWin32' ) { $self->builder->skip('There is no ispell on Windows'); return; } my $dict_file = $self->{root_dir}->child('.ispell_english'); $self->tidyall( source => '=head SUMMARY\n\nthe quick brown fox jumped over the lazy dogs', expect_ok => 1, desc => 'ok', ); $self->tidyall( source => '=head SUMMARY\n\nthe quick browwn fox jumped over the lazeey dogs', expect_error => qr/unrecognized words:\nbrowwn\nlazeey/, desc => 'spelling mistakes', ); $dict_file->spew("browwn\n"); $self->tidyall( source => '=head SUMMARY\n\nthe quick browwn fox jumped over the lazeey dogs', conf => { ispell_argv => "-p $dict_file" }, expect_error => qr/unrecognized words:\nlazeey/, desc => 'spelling mistakes, one in dictionary', ); $dict_file->spew("browwn\nlazeey\n"); $self->tidyall( source => '=head SUMMARY\n\nthe quick browwn fox jumped over the lazeey dogs', conf => { ispell_argv => "-p $dict_file" }, expect_ok => 1, desc => 'spelling mistakes, all in dictionary', ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/PerlCritic.pm0000644000175000017500000000250113157756244024203 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::PerlCritic; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_main : Tests { my $self = shift; my $rc_file = $self->{root_dir}->child('perlcriticrc'); $rc_file->spew("only = 1\nseverity = 1\n[TestingAndDebugging::RequireUseStrict]\n"); $self->tidyall( source => "my \$foo = 5\n", conf => { argv => qq{--profile "$rc_file"} }, expect_error => qr/Code before strictures/, ); $self->tidyall( source => "use strict;\nuse warnings;\nmy \$foo = 5\n", conf => { argv => qq{--profile "$rc_file"} }, expect_ok => 1, ); $rc_file->spew("only = 1\nseverity = 1\n[CodeLayout::ProhibitHardTabs]\n"); $self->tidyall( source => "my \$foo = 5\n", conf => { argv => qq{--profile "$rc_file"} }, expect_ok => 1, ); $self->tidyall( source => "my \$foo = 5\n", conf => { argv => qq{--profile "$rc_file" --badoption} }, expect_error => qr/Unknown option: badoption/ ); $rc_file->spew("badconfig = 1\n"); $self->tidyall( source => "my \$foo = 5\n", conf => { argv => qq{--profile "$rc_file"} }, expect_error => qr/"badconfig" is not a supported option/ ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/MasonTidy.pm0000644000175000017500000000164113157756244024056 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::MasonTidy; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_main : Tests { my $self = shift; my $source = "%if(\$foo) {\n%bar(1,2);\n%}"; $self->tidyall( source => $source, conf => { argv => '-m 1' }, expect_tidy => "% if (\$foo) {\n% bar( 1, 2 );\n% }", ); $self->tidyall( source => $source, conf => { argv => q{-m 1 --perltidy-argv="-pt=2 -i=3"} }, expect_tidy => "% if (\$foo) {\n% bar(1, 2);\n% }", ); $self->tidyall( source => $source, conf => { argv => q{-m 2 --perltidy-line-argv=" "} }, expect_tidy => "% if (\$foo) {\n% bar( 1, 2 );\n% }", ); $self->tidyall( source => $source, conf => { argv => '-m 1 --badoption' }, expect_error => qr/Usage/, ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/JSLint.pm0000644000175000017500000000154713157756244023317 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::JSLint; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_filename {'foo.js'} sub _extra_path { 'node_modules/.bin'; } sub test_main : Tests { my $self = shift; return unless $self->require_executable('node'); return unless $self->require_executable('jslint'); $self->tidyall( source => 'var my_object = {};', expect_ok => 1, desc => 'ok', ); $self->tidyall( source => 'while (true) {\nvar i = 5;\n}', expect_error => qr/Expected 'var' at column 5/, desc => 'error - bad indentation' ); $self->tidyall( source => 'var i; while (true) {\ni = 5;\n}', conf => { argv => '--white' }, expect_ok => 1, desc => 'ok - bad indentation, --white' ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Plugin/PodChecker.pm0000644000175000017500000000263713157756244024164 0ustar autarchautarchpackage TestFor::Code::TidyAll::Plugin::PodChecker; use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin'; sub test_main : Tests { my $self = shift; $self->tidyall( source => '=head1 DESCRIPTION\n\nHello', expect_ok => 1, desc => 'ok', ); $self->tidyall( source => '=head1 METHODS\n\n=over\n\n=item * foo\n\n', expect_error => qr/without closing =back/, desc => 'error', ); $self->tidyall( source => '=head1 DESCRIPTION\n\n=head1 METHODS\n\n', expect_ok => 1, desc => 'ok - empty section, no warnings', ); $self->tidyall( source => '=head1 DESCRIPTION\n\n=head1 METHODS\n\n', conf => { warnings => 1 }, expect_error => qr/empty section in previous paragraph/, desc => 'error - empty section, warnings=1', ); $self->tidyall( source => '=head1 DESCRIPTION\n\nblah blah\n\n=head1 DESCRIPTION\n\nblah blah', conf => { warnings => 1 }, expect_ok => 1, desc => 'ok - duplicate section, warnings=1', ); $self->tidyall( source => '=head1 DESCRIPTION\n\nblah blah\n\n=head1 DESCRIPTION\n\nblah blah', conf => { warnings => 2 }, expect_error => qr/multiple occurrence/, desc => 'error - duplicate section, warnings=2', ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Zglob.pm0000644000175000017500000000202013157756244021756 0ustar autarchautarchpackage TestFor::Code::TidyAll::Zglob; use File::Zglob; use Test::Class::Most parent => 'TestHelper::Test::Class'; use Code::TidyAll::Util::Zglob qw(zglob_to_regex); sub test_match : Tests { my ( $zglob, $regex ); $zglob = '**/*.txt'; $regex = zglob_to_regex($zglob); foreach my $path (qw(foo.txt foo/baz.txt foo/bar/baz.txt)) { like( $path, $regex, "$path matches $zglob" ); } foreach my $path (qw(foo/bar/baz.tx)) { unlike( $path, $regex, "$path does not match $zglob" ); } $zglob = '**/*'; $regex = zglob_to_regex($zglob); foreach my $path (qw(foo foo.txt foo/bar foo/baz.txt)) { like( $path, $regex, "$path matches $zglob" ); } $zglob = 'foo/**/*.txt'; $regex = zglob_to_regex($zglob); foreach my $path (qw(foo/baz.txt foo/bar/baz.txt foo/bar/baz/blargh.txt)) { like( $path, $regex, "$path matches $zglob" ); } foreach my $path (qw(foo.txt foo/bar/baz.tx)) { unlike( $path, $regex, "$path does not match $zglob" ); } } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/DiffOnTidyError.pm0000644000175000017500000000124413157756244023721 0ustar autarchautarchpackage TestFor::Code::TidyAll::DiffOnTidyError; use Test::Class::Most parent => 'TestHelper::Test::Class'; use strict; use warnings; sub test_diff_on_tidy_error : Tests { my $self = shift; $self->tidy( plugins => { '+TestHelper::Plugin::UpperText' => { diff_on_tidy_error => 1, select => '**/*.txt', }, }, source => { 'foo.txt' => "abc\n" }, options => { check_only => 1 }, desc => 'diff on tidy error', errors => qr/needs tidying/, like_output => qr/UpperText made the following change:\n.+abc\n.+ABC/s, ); } 1; Code-TidyAll-0.67/t/lib/TestFor/Code/TidyAll/Conf.pm0000644000175000017500000000536613157756244021606 0ustar autarchautarchpackage TestFor::Code::TidyAll::Conf; use Code::TidyAll; use Code::TidyAll::Util qw(tempdir_simple); use Test::Class::Most parent => 'TestHelper::Test::Class'; my @tests = ( { name => 'valid config', config => <<'EOF', backup_ttl = 5m no_cache = 1 inc = /foo inc = /bar [+TestHelper::Plugin::UpperText] select = **/*.txt [+TestHelper::Plugin::RepeatFoo] select = **/foo* select = **/bar* times = 3 EOF methods => { backup_ttl => '5m', _backup_ttl_secs => '300', inc => [ '/foo', '/bar' ], no_backups => undef, no_cache => 1, plugins => { '+TestHelper::Plugin::UpperText' => { select => ['**/*.txt'], }, '+TestHelper::Plugin::RepeatFoo' => { select => [ '**/foo*', '**/bar*' ], times => 3, }, }, }, }, { name => 'space-separate select & ignore', config => <<'EOF', [+TestHelper::Plugin::RepeatFoo] select = **/foo* **/bar* ignore = buz baz EOF methods => { plugins => { '+TestHelper::Plugin::RepeatFoo' => { select => [ '**/foo*', '**/bar*' ], ignore => [ 'buz', 'baz' ], }, }, }, }, ); sub test_config_file_handling : Tests { my $self = shift; my $root_dir = tempdir_simple(); for my $test (@tests) { subtest( $test->{name}, sub { my $conf_file = $root_dir->child('tidyall.ini'); $conf_file->spew( $test->{config} ); my $ct = Code::TidyAll->new_from_conf_file($conf_file); for my $method ( sort keys %{ $test->{methods} } ) { cmp_deeply( $ct->$method, $test->{methods}{$method}, $method ); } is( $ct->root_dir, $root_dir, 'root_dir comes from config file path' ); is( $ct->data_dir, "$root_dir/.tidyall.d", 'data dir is below root dir' ); } ); } } sub test_bad_config : Tests { my $self = shift; my $root_dir = tempdir_simple(); my $conf_file = $root_dir->child('tidyall.ini'); ( my $config = $tests[0]{config} ) =~ s/times/timez/; $conf_file->spew($config); throws_ok { my $ct = Code::TidyAll->new_from_conf_file($conf_file)->_plugin_objects } qr/unknown option 'timez'/; } 1; Code-TidyAll-0.67/t/Plugin-SortLines.t0000644000175000017500000000020513157756244017341 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::SortLines; TestFor::Code::TidyAll::Plugin::SortLines->runtests; Code-TidyAll-0.67/t/inc2/0000775000175000017500000000000013157756244014636 5ustar autarchautarchCode-TidyAll-0.67/t/inc2/Bar.pm0000644000175000017500000000012713157756244015676 0ustar autarchautarchpackage Bar; use strict; use warnings; use Moo; extends 'Code::TidyAll::Plugin'; 1; Code-TidyAll-0.67/xt/0000775000175000017500000000000013157756244014173 5ustar autarchautarchCode-TidyAll-0.67/xt/release/0000775000175000017500000000000013157756244015613 5ustar autarchautarchCode-TidyAll-0.67/xt/release/cpan-changes.t0000644000175000017500000000034413157756244020326 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; Code-TidyAll-0.67/xt/release/meta-json.t0000644000175000017500000000006413157756244017673 0ustar autarchautarch#!perl use Test::CPAN::Meta::JSON; meta_json_ok(); Code-TidyAll-0.67/xt/author/0000775000175000017500000000000013157756244015475 5ustar autarchautarchCode-TidyAll-0.67/xt/author/Plugin-PodTidy.t0000644000175000017500000000020113157756244020461 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::PodTidy; TestFor::Code::TidyAll::Plugin::PodTidy->runtests; Code-TidyAll-0.67/xt/author/parallel.t0000644000175000017500000000016313157756244017454 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Parallel; TestFor::Code::TidyAll::Parallel->runtests; Code-TidyAll-0.67/xt/author/Plugin-PerlTidySweet.t0000644000175000017500000000035313157756244021661 0ustar autarchautarch#!/usr/bin/perl use Test::More; plan skip_all => 'This plugin requires Perl 5.10+' unless $] >= 5.010; use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::PerlTidySweet; TestFor::Code::TidyAll::Plugin::PerlTidySweet->runtests; Code-TidyAll-0.67/xt/author/Util.t0000644000175000017500000000015313157756244016574 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Util; TestFor::Code::TidyAll::Util->runtests; Code-TidyAll-0.67/xt/author/Plugin-JSLint.t0000644000175000017500000000017713157756244020264 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::JSLint; TestFor::Code::TidyAll::Plugin::JSLint->runtests; Code-TidyAll-0.67/xt/author/Git.t0000644000175000017500000000015113157756244016400 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Git; TestFor::Code::TidyAll::Git->runtests; Code-TidyAll-0.67/xt/author/Plugin-JSHint.t0000644000175000017500000000017713157756244020260 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::JSHint; TestFor::Code::TidyAll::Plugin::JSHint->runtests; Code-TidyAll-0.67/xt/author/self-tidyall.t0000644000175000017500000000027613157756244020256 0ustar autarchautarchuse strict; use warnings; use Test::Code::TidyAll; use Test::More; plan skip_all => 'This plugin requires Perl 5.10+' unless $] >= 5.010; tidyall_ok( verbose => 1 ); done_testing(); Code-TidyAll-0.67/xt/author/test-version.t0000644000175000017500000000063713157756244020330 0ustar autarchautarchuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 1, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Code-TidyAll-0.67/xt/author/Plugin-PerlTidy.t0000644000175000017500000000020313157756244020643 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::PerlTidy; TestFor::Code::TidyAll::Plugin::PerlTidy->runtests; Code-TidyAll-0.67/xt/author/Plugin-PerlCritic.t0000644000175000017500000000020713157756244021153 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::PerlCritic; TestFor::Code::TidyAll::Plugin::PerlCritic->runtests; Code-TidyAll-0.67/xt/author/Plugin-PodChecker.t0000644000175000017500000000020713157756244021122 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::PodChecker; TestFor::Code::TidyAll::Plugin::PodChecker->runtests; Code-TidyAll-0.67/xt/author/tidy-and-critic.t0000644000175000017500000000344313157756244020650 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use Code::TidyAll::Util qw(tempdir_simple); use Code::TidyAll; use Path::Tiny qw(path); use Test::More; use Capture::Tiny qw(capture_merged); my $root_dir = tempdir_simple(); sub make { my ( $file, $content ) = @_; $file = $root_dir->child($file); $file->parent->mkpath( { mode => 0755 } ); $file->spew($content); } make( "lib/Foo.pm", 'package Foo; use strict; 1; ' ); make( "bin/bar.pl", "#!/usr/bin/perl\n \$d = 5;" ); make( "lib/Foo.pod", "=over\n\n=item a\n\n" . scalar( "Blah " x 25 ) . "\n\n=back\n" ); make( "data/baz.txt", " 34" ); make( ".perlcriticrc", "include = RequireUseStrict" ); my $rc_file = $root_dir->child('.perlcriticrc'); my $ct = Code::TidyAll->new( root_dir => $root_dir, plugins => { PerlTidy => { select => '**/*.{pl,pm}' }, PerlCritic => { select => '**/*.{pl,pm}', argv => qq{--profile "$rc_file"} }, PodTidy => { select => '**/*.pod' }, } ); my $output; $output = capture_merged { $ct->process_all() }; like( $output, qr/Code before strictures are enabled./ ); is( $root_dir->child(qw(lib Foo.pm))->slurp, "package Foo;\nuse strict;\n1;\n" ); is( $root_dir->child(qw(lib Foo.pod))->slurp, "=over\n\n=item a\n\n" . join( " ", ("Blah") x 16 ) . "\n" . join( " ", ("Blah") x 9 ) . "\n\n=back\n" ); is( $root_dir->child(qw(data baz.txt))->slurp, " 34" ); $output = capture_merged { $ct->process_all() }; like( $output, qr/Code before strictures are enabled./ ); unlike( $output, qr/Foo\.pm/ ); make( "bin/bar.pl", "#!/usr/bin/perl\nuse strict;\n \$d = 5;" ); $output = capture_merged { $ct->process_all() }; like( $output, qr/.*bar\.pl/ ); is( $root_dir->child(qw(bin bar.pl))->slurp, "#!/usr/bin/perl\nuse strict;\n\$d = 5;\n" ); done_testing(); Code-TidyAll-0.67/xt/author/no-tabs.t0000644000175000017500000000612013157756244017222 0ustar autarchautarchuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'bin/tidyall', 'lib/Code/TidyAll.pm', 'lib/Code/TidyAll/Cache.pm', 'lib/Code/TidyAll/CacheModel.pm', 'lib/Code/TidyAll/CacheModel/Shared.pm', 'lib/Code/TidyAll/Config/INI/Reader.pm', 'lib/Code/TidyAll/Git/Precommit.pm', 'lib/Code/TidyAll/Git/Prereceive.pm', 'lib/Code/TidyAll/Git/Util.pm', 'lib/Code/TidyAll/Plugin.pm', 'lib/Code/TidyAll/Plugin/CSSUnminifier.pm', 'lib/Code/TidyAll/Plugin/JSBeautify.pm', 'lib/Code/TidyAll/Plugin/JSHint.pm', 'lib/Code/TidyAll/Plugin/JSLint.pm', 'lib/Code/TidyAll/Plugin/JSON.pm', 'lib/Code/TidyAll/Plugin/MasonTidy.pm', 'lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm', 'lib/Code/TidyAll/Plugin/PerlCritic.pm', 'lib/Code/TidyAll/Plugin/PerlTidy.pm', 'lib/Code/TidyAll/Plugin/PerlTidySweet.pm', 'lib/Code/TidyAll/Plugin/PodChecker.pm', 'lib/Code/TidyAll/Plugin/PodSpell.pm', 'lib/Code/TidyAll/Plugin/PodTidy.pm', 'lib/Code/TidyAll/Plugin/SortLines.pm', 'lib/Code/TidyAll/Result.pm', 'lib/Code/TidyAll/Role/HasIgnore.pm', 'lib/Code/TidyAll/Role/RunsCommand.pm', 'lib/Code/TidyAll/Role/Tempdir.pm', 'lib/Code/TidyAll/SVN/Precommit.pm', 'lib/Code/TidyAll/SVN/Util.pm', 'lib/Code/TidyAll/Util.pm', 'lib/Code/TidyAll/Util/Zglob.pm', 'lib/Test/Code/TidyAll.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/Basic.t', 't/Conf.t', 't/Plugin-SortLines.t', 't/Zglob.t', 't/inc1/Foo.pm', 't/inc2/Bar.pm', 't/lib/TestFor/Code/TidyAll/Basic.pm', 't/lib/TestFor/Code/TidyAll/Conf.pm', 't/lib/TestFor/Code/TidyAll/DiffOnTidyError.pm', 't/lib/TestFor/Code/TidyAll/Git.pm', 't/lib/TestFor/Code/TidyAll/Parallel.pm', 't/lib/TestFor/Code/TidyAll/Plugin.pm', 't/lib/TestFor/Code/TidyAll/Plugin/CSSUnminifier.pm', 't/lib/TestFor/Code/TidyAll/Plugin/JSBeautify.pm', 't/lib/TestFor/Code/TidyAll/Plugin/JSHint.pm', 't/lib/TestFor/Code/TidyAll/Plugin/JSLint.pm', 't/lib/TestFor/Code/TidyAll/Plugin/MasonTidy.pm', 't/lib/TestFor/Code/TidyAll/Plugin/PHPCodeSniffer.pm', 't/lib/TestFor/Code/TidyAll/Plugin/PerlCritic.pm', 't/lib/TestFor/Code/TidyAll/Plugin/PerlTidy.pm', 't/lib/TestFor/Code/TidyAll/Plugin/PerlTidySweet.pm', 't/lib/TestFor/Code/TidyAll/Plugin/PodChecker.pm', 't/lib/TestFor/Code/TidyAll/Plugin/PodSpell.pm', 't/lib/TestFor/Code/TidyAll/Plugin/PodTidy.pm', 't/lib/TestFor/Code/TidyAll/Plugin/SortLines.pm', 't/lib/TestFor/Code/TidyAll/SVN.pm', 't/lib/TestFor/Code/TidyAll/SpacesInPaths.pm', 't/lib/TestFor/Code/TidyAll/Util.pm', 't/lib/TestFor/Code/TidyAll/Zglob.pm', 't/lib/TestHelper/Plugin/AToZ.pm', 't/lib/TestHelper/Plugin/AlwaysPhonetic.pm', 't/lib/TestHelper/Plugin/CheckUpper.pm', 't/lib/TestHelper/Plugin/RepeatFoo.pm', 't/lib/TestHelper/Plugin/ReverseFoo.pm', 't/lib/TestHelper/Plugin/UpperText.pm', 't/lib/TestHelper/Test/Class.pm' ); notabs_ok($_) foreach @files; done_testing; Code-TidyAll-0.67/xt/author/Plugin-JSBeautify.t0000644000175000017500000000023013157756244021114 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::JSBeautify; TestFor::Code::TidyAll::Plugin::JSBeautify->runtests; Code-TidyAll-0.67/xt/author/diff-on-tidy-error.t0000644000175000017500000000020113157756244021271 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::DiffOnTidyError; TestFor::Code::TidyAll::DiffOnTidyError->runtests; Code-TidyAll-0.67/xt/author/Plugin-MasonTidy.t0000644000175000017500000000020513157756244021020 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::MasonTidy; TestFor::Code::TidyAll::Plugin::MasonTidy->runtests; Code-TidyAll-0.67/xt/author/mojibake.t0000644000175000017500000000015113157756244017436 0ustar autarchautarch#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); Code-TidyAll-0.67/xt/author/pod-syntax.t0000644000175000017500000000025213157756244017765 0ustar autarchautarch#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Code-TidyAll-0.67/xt/author/spaces-in-paths.t0000644000175000017500000000017513157756244020662 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::SpacesInPaths; TestFor::Code::TidyAll::SpacesInPaths->runtests; Code-TidyAll-0.67/xt/author/pod-spell.t0000644000175000017500000000255413157756244017565 0ustar autarchautarchuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007004 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ API Adam Alders Andy Anwar CPAN CSSUnminifier Cache CacheModel Code Config Crotty DROLSKY DROLSKY's Dave Finn Fish Fowler George Git Graham Gregory Grimes Gruner Hartzell HasIgnore Herzog INI JSBeautify JSHint JSLint JSON Jack JavaScript Joe Jonathan Knop Mark Martin MasonTidy Melo Misc Mohammad Olaf Oschwald PHP PHPCodeSniffer PREREQS PayPal Pedro PerlCritic PerlTidy PerlTidySweet Plugin PodChecker PodSpell PodTidy Precommit Prereceive Raggett Reader Result Ricardo Role Rolsky Rolsky's Romanov RunsCommand STDERR STDIN STDOUT SVN Sergey Shared Shlomi Signes Simakov Smith SortLines Swartz TIDYALL Tempdir Test Thalhammer TidyAll Util Vim Zglob adam andyjack argv ascii atomicity autarch bin cmd conf config cssunminifier ctrl dir drolsky filename finn georgewh goschwald haarg iff ispell joe js jsbeautify jshint jslint lib listref mark martin masontidy melo mgrimes mohammad noll npm ok olaf ops params pathname perlcritic perlcriticrc perltidy phpcs plugins podspell podtidy pre prereqs repo repos rjbs ro runtime rw shebang shlomif sourceforge sromanov svn swartz tidiers tidyall tidyall'd tim timestamped timgimyee ttl txn validator validators zglob Code-TidyAll-0.67/xt/author/Plugin-CSSUnminifier.t0000644000175000017500000000021513157756244021570 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::CSSUnminifier; TestFor::Code::TidyAll::Plugin::CSSUnminifier->runtests; Code-TidyAll-0.67/xt/author/Plugin-PHPCodeSniffer.t0000644000175000017500000000021713157756244021653 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::PHPCodeSniffer; TestFor::Code::TidyAll::Plugin::PHPCodeSniffer->runtests; Code-TidyAll-0.67/xt/author/Plugin-PodSpell.t0000644000175000017500000000020313157756244020631 0ustar autarchautarch#!/usr/bin/perl use lib 't/lib'; use TestFor::Code::TidyAll::Plugin::PodSpell; TestFor::Code::TidyAll::Plugin::PodSpell->runtests; Code-TidyAll-0.67/tidyall.ini0000644000175000017500000000155513157756244015707 0ustar autarchautarch[PerlTidy] argv = --pro=$ROOT/perltidyrc except_modes = dzil select = {bin,lib,t}/**/{tidyall,*.{pl,pm,t}} ignore = t/00-report-prereqs.t ignore = t/author-* ignore = t/release-* [PerlTidySweet] argv = --pro=$ROOT/perltidyrc except_modes = dzil select = {bin,lib,t}/**/{tidyall,*.{pl,pm,t}} ignore = t/00-report-prereqs.t ignore = t/author-* ignore = t/release-* [PodTidy] select = {bin,lib}/**/{tidyall,*.{pl,pm,pod}} ignore = t/00-report-prereqs.t ignore = t/author-* ignore = t/release-* [PerlCritic] select = lib/**/*.pm argv = --profile $ROOT/perlcriticrc except_modes = editor dzil ignore = t/00-report-prereqs.t ignore = t/author-* ignore = t/release-* [SortLines] select = .gitignore .ispell* **/.gitignore [Perl::AlignMooseAttributes] select = {bin,lib,t}/**/*.{pl,pm,t} except_modes = dzil ignore = t/00-report-prereqs.t ignore = t/author-* ignore = t/release-* Code-TidyAll-0.67/INSTALL0000644000175000017500000000220013157756244014561 0ustar autarchautarchThis is the Perl distribution Code-TidyAll. Installing Code-TidyAll is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm Code::TidyAll If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Code::TidyAll ## Manual installation As a last resort, you can manually install it. Download the tarball, untar it, then build it: % perl Makefile.PL % make && make test Then install it: % make install If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib ## Documentation Code-TidyAll documentation is available as POD. You can run perldoc from a shell to read the documentation: % perldoc Code::TidyAll Code-TidyAll-0.67/Changes0000644000175000017500000004424713157756244015044 0ustar autarchautarch0.67 2017-09-18 - Move "cmd" attribute back to Code::TidyAll::Plugin. Moving this to a role in 0.66 broke plugins which run external commands but which don't ship with this distro. Reported by Greg Oschwald. GH #82. 0.66 2017-09-17 - The tidyall command line app now takes a --plugins option. This allows you to limit tidyall to running just the selected plugin(s). 0.65 2017-08-01 - A file under Git which had a status of "copied" would cause uninitialized value warnings from a pre-commit hook. Reported by Nigel Metheringham with help from Adam Herzog. GH #81. 0.64 2017-07-31 - Bug fixes on Windows. Now all plugins except PodSpell (which requires ispell) should work on Windows. This should all fix test failures seen in CPANTesters on Windows. 0.63 2017-07-23 - All plugins should now work when run against paths that include spaces. Previously, many plugins would fail because they were calling system commands by passing a single string rather than a list of arguments. Note that we now parse the "argv" given in the config file use Text::ParseWords::shellwords. It's possible that this could break your setup if you have some very pathological configuration options. Bug reports are welcome. Fixes #79. 0.62 2017-07-20 - Added support for a global config option "inc". This allows you to prepend directories to @INC when running tidyall. This affects both loading classes and running plugins. This is equivalent to the command line's -I option. 0.61 2017-07-07 - Fixed a Git pre-commit hook stash bug. The hook would always call "git stash pop" even if the call it had just made to "git stash" hadn't added anything to the stash. If the stash had anything on it, this could make a mess of your working directory. This showed up most often with calls to "git commit --amend" where you were trying to just edit the prior commit message, since you would be unlikely to have any changes to stash when doing so. 0.60 2017-07-03 - Attempted to fix a bug related to how git stash is used in the git pre-commit hook. The "git stash pop" command was happening too early, which would block commits when all the files in the index were tidy but the working directory contained untidy files. Based on PR #58 from Finn Smith. 0.59 2017-05-14 - Work around issue with Perl::Tidy when Getopt::Long::Configure is called before we call Perl::Tidy::perltidy. See https://rt.cpan.org/Ticket/Display.html?id=118558 for details. 0.58 2017-03-11 - Don't assume that '.' is in @INC in the Makefile.PL. - Don't ship the node or PHP code used for tests in the tarball. This makes it much smaller. 0.57 2017-02-19 - Fix code that called a Specio private method directly. 0.56 2017-02-01 - Fixed Win32 test failures. Reported by Christian Walde. GH #72. - Added a global ignore feature. You can now provide ignore configuration at the top level of your tidyall config file and/or pass an --ignore flag on the command line. Any ignores specified this way will be ignore for all plugins. Based on GH #73 from Martin Guner. 0.55 2016-10-31 - Require Moo 2.000000 or greater. 0.54 2016-10-15 - Fixed error when passing in paths as a string to the Code::TidyAll constructor. These are now coerced to Path::Tiny objects. Reported by Martin Gruner. GH #66. 0.53 2016-10-10 [BUG FIXES] - Fixed failing tests on OSX. Reported by Martin Gruner. GH #65. - Files that were tidied could have their permissions mode when they were rewritten. Reported by Martin Gruner (GH #68) and fixed by Adam Herzog (GH #69). 0.52 2016-09-19 [BUG FIXES] - The 0.50 release added an implicit configure phase prereq on Path::Tiny without declaring it. That bit of code has been reverted to use just core modules. - Change tidyall shbang line to "#!perl". I had changed it to "#!/usr/bin/env perl" but MakeMaker does not rewrite this on install. 0.51 2016-09-18 [BUG FIXES] - Restored some exports to Code::TidyAll::Util for backwards compatibility. Some other plugins are using these exports. 0.50 2016-09-18 [BACKWARDS INCOMPATIBILITIES] - Converted (almost) all file handling to use Path::Tiny. This should help make the code and tests more cross-platform, and simplifies various bits of internal code. Note that plugins now receive paths as Path::Tiny objects, which could break code that checks if what it receives is a plain scalar. [ENHANCEMENTS] - Added support for tidying in multiple parallel jobs at once. You can pass a "--jobs" argument to tidyall or pass a "jobs" param to Code::TidyAll->new. This requires that you install Parallel::ForkManager. - Paths in error messages now include the full relative path to the file being tidied. Previously this would just be something like "Foo.pm", now it will be "lib/My/Package/Foo.pm". 0.49 2016-07-22 - The verbose output now just shows the plugin name in the "applying the following plugins: ..." message, rather than stringifying the plugin objects. 0.48 2016-06-16 - The Git pre-commit hook now only looks at the files that are staged for committing, rather than everything in the git repo that has been modified. Note that this does not change the tidyall script's "-g" flag, which still operates on all modified files in the repo. - Check the exit code when running js-beautify and throw an error if this is non-zero. Patch by Graham Knop. GitHub #61. 0.46 2016-04-17 - Fix a use line which specified the required version of Text::Diff as "v1.44". This caused weirdness to cascade in the Makefile.PL. Reported by Olaf Alders. GitHub #60. 0.45 2016-04-11 - Some changes intended to be internal-only in the last release broke the handling of ignore and select config lines with multiple space-separated values. This should now work again (and is tested). Reported by Martin Gruner. GitHub #44. 0.44 2016-04-10 - Changed the shebang config item to actually accept multi items on different lines. The old method of specifying more than one item on a single line, separated by spaces, will continue to work, but is no longer documented. 0.43 2016-03-27 - Use the same improved "git status" code for Code::TidyAll::Git::Precommit as we do in bin/tidyall for the -g option. Patch by Finn Smith. GitHub #57. 0.42 2016-03-10 - Specify Text::Diff version as 'v1.44' instead of '1.44'. This fixes an inexplicable error that the OTRS project was having with the previous release (GitHub #53). Fixed by Martin Gruner. GitHub #54. 0.41 2016-03-04 - Replaced List::MoreUtils with List::SomeUtils. 0.40 2016-02-21 - Don't include files not tracked by git when looking for uncommitted files. Fixed by Olaf Alders. GitHub #51. - Use Text::Diff for all diffs instead of calling an external command. Hopefully this makes this distro a little more portable. 0.39 2016-02-13 - Use "git status --porcelain -z" when trying to figure out what files are being uncommitted for git hooks. Implemented by Ricardo Signes. GitHub #40. 0.38 2016-01-11 - Tweaked the test names used by Test::Code::TidyAll so that they say something like "lib/Foo.pm is tidy" rather than just "lib/Foo.pm". 0.37 2015-12-03 - Really fix an empty files parameter to tidyall_ok (Test::Code::TidyAll desperately needs some tests). 0.36 2015-12-02 - Updated the distro metadata to point to github for bug reports rather than rt.cpan.org. 0.35 2015-12-02 - If the "files" parameter to tidyall_ok didn't include any files that matches the tidyall config (or no files at all) this would cause an error from Test::Builder. This has been fixed so we now just spit out a single passing test. 0.34 2015-12-02 - Added a new "files" parameter that can be passed to the tidyall_ok sub exported by Test::Code::TidyAll. This makes it possible to use this sub to check just a subset of your files. 0.33 2015-11-30 (TRIAL RELEASE) - Adding diff functionality as its own plugin (DiffOnTidyError), which was done in 0.31, turned out to be quite problematic. As a plugin you had to define which files it applied to via select & exclude, and in a large code base it was easy to select files that no other plugin applied to. This meant tidyall (and Test::Code::TidyAll, etc.) would include those files even though they were never touched. This could make tidying and tidy tests _much_ slower. This plugin has been replaced with a new config attribute that can be applied to all plugins, diff_on_tidy_error. When this is set, any plugin that tidies source in --check-only mode (also used by Test::Code::TidyAll) will include a diff in the error message, one diff per plugin. This has the added benefit of showing if you if multiple plugins are each making changes to the same file. 0.32 2015-11-19 - When in verbose mode we now show what plugins are being applied to each file. This is helpful if you want to know why a file isn't being ignored, for example. - Added a new plugin configuration option for the rc file, "weight". You can use this to exercise greater control over the order that plugins run in. 0.31 2015-11-17 - Added a new plugin, DiffOnTidyError. This plugin will call "diff -u" to compare the original file content to the tidy version. 0.30 2015-09-14 - Added a --no-cleanup option for the tidyall script that causes it to leave any tempdirs it creates behind. Implemented by Mark Fowler. GitHub #41. 0.29 2015-08-15 - Replaced use of Digest::SHA1 with Digest::SHA. The latter module has been part of the Perl core since 5.10. Implemented by Sergey Romanov. GitHub #39. 0.28 2015-08-06 - The JSON plugin now uses JSON::MaybeXS instead of JSON.pm. Patch by Greg Oschwald. GitHub #37. - Added a new plugin, PerlTidySweet, which uses perltidy-sweet instead of perltidy. Implemented by Mark Grimes. GitHub #26. 0.27 2015-07-04 [BUG FIXES] - Fixed broken POD. Most modules were missing their NAME sections because of a mistake in the distro's weaver.ini file. Reported by Красимир Беров. 0.26 2015-06-29 [BUG FIXES] - The tidyall script did not handle the -I option correctly. It was treated as a boolean rather than a string, meaning it basically ignored whatever you passed. Fixed by Andy Jack. GH #35. - The PodChecker plugin no longer generates warnings about an undef variable if the file did not have any Pod. - Added an option for the tidyall config file, shebang. This is an additional filter that selects files based on the shebang line (#!/bin/foo). Implemented by timgimyee. GH #25. 0.25 2015-03-31 [ENHANCEMENTS] - You can now pass "verbose => 1" to tidyall_ok(). Previously this would have been overridden because we unconditionally set "quiet => 1", but now we only do this when verbose is not specified. - Added a new "msg_outputter" attribute to Code::TidyAll. By default, this is a sub that simply calls "printf", but you can pass something else to change how messages are printed. Test::Code::TidyAll uses this to send messages through diag(). - If you set "verbose => 1" when calling Test::Code::TidyAll, it will now use Text::Diff::Table to show details of how a file needs to be tidied in order to pass the tidyall checks. - Made the PerlCritic plugin pass even if a critic module issues some warnings. As long as perlcritic says "source OK", we want to treat that as a pass, despite any warnings it may issue. Fixed by Mark Fowler. - Made the caching model pluggable, and added a new Code::TidyAll::CacheModel::Shared class as an alternative to the default model. This lets you share the cache directory between multiple branches in a single checkout while still detecting file changes properly. Implemented by Mark Fowler. 0.24 2014-11-06 [WARNING FOR A FUTURE RELEASE] - At some point in the future, it will probably be necessary for Code::TidyAll to become aware of encodings on a per-file basis. As it stands right now, any tidying plugin which reformats text could, in theory, end up splitting up a UTF-8 character's bytes across at a line break. [BUG FIXES] - Replaced the use of Capture::Tiny with IPC::Run3 for some plugins. The former seems to sometimes return character data where we want bytes, even if the STDOUT and STDERR handles are binmode()'d to the ":bytes" encoding. This prevents warnings about writing wide characters from the JSBeautify plugin. 0.23 2014-11-06 - Fix test failures seen on CPANTesters. 0.22 2014-11-05 [BUG FIXES] * Removed the compile test added in the last release. Many plugin modules won't compile unless optional prereqs are manually installed first (such as Perl::Critic, Perl::Tidy, etc.). 0.21 2014-11-05 [ENHANCEMENTS] * Test::Code::TidyAll now sets "quiet => 1" when creating the Code::TidyAll object to suppress noise from any plugins. * Test::Code::TidyAll now calls Test::More::diag() after test failures instead of before. [BUG FIXES] * Lots of little doc tweaks and fixes. 0.20 2014-05-18 [BUG FIXES] * Fix option handling implentation and documentation for Test::Code::TidyAll::tidyall_ok - https://github.com/jonswar/perl-code-tidyall/issues/18 (Olad Alders) 0.19 2014-03-06 [ENHANCEMENTS] * Added a JSON plugin (Gregory Oschwald) 0.18 2013-09-21 [BUG FIXES] * Fix Test::Code::TidyAll::tidyall_ok - https://github.com/jonswar/perl-code-tidyall/issues/12 (Adam Taylor) * Fix JSBeautify plugin as js-beautify no longer respects --replace 0.17 2013-03-11 [BACKWARDS INCOMPATIBILITIES] * Rename API method process_files to more accurate process_paths [BUG FIXES] * Fix recursive processing of directories (Mark Risman) * Improve git precommit setup script - https://github.com/jonswar/perl-code-tidyall/pull/10 (Olaf Anders) 0.16 2012-10-22 [ENHANCEMENTS] * Added phpcs plugin (Joseph Crotty) * Added cssunminifier plugin * Added SortLines plugin, for one-entry-per-line files like .gitignore 0.15 2012-10-11 [BUG FIXES] * Fix test_dirs test to not rely on file ordering 0.14 2012-10-10 [ENHANCEMENTS] * Allow a plugin to be listed multiple times in config with different configuration * Specify order that plugins run (tidiers before validators, then alpha) and document that they are applied atomically * Added etc/editors/tidyall.vim for Vim (Justin Devuyst) * Added -r/--recursive flag to process directories recursively * In -p/--pipe mode, mirror input to output in case of error (Justin Devuyst) * Fix -l/--list handling of local files * Added --version option * Make git prereceive hook more modular, so it can be combined with other checks 0.13 2012-09-30 [BUG FIXES] * Adjust MasonTidy plugin for new API * Remove Util.t containing only author-only tests 0.12 2012-09-27 [ENHANCEMENTS] * Added podspell plugin (POD spell checker) * Added --iterations flag to run tidier transforms multiple times * Allow .tidyallrc as alternative to tidyall.ini * Allow git prereceive hook to be bypassed by pushing an identical set of commits several consecutive times (allow_repeated_push) * Added handcrafted usage w/summary of options, instead of Pod::Usage 0.11 2012-09-21 [ENHANCEMENTS] * Allow multiple select and ignore patterns, separated by whitespace or on separate lines * Added -l/--list flag to show which plugins match which files * Added conf_name parameter to specify name other than tidyall.ini * Redirect stdout to stderr with -p/--pipe, so that stdout is dedicated to the tidied content * In tidyall.el, hide error buffer on successful tidy [BUG FIXES] * Handle argv/config errors correctly in various plugins * Eliminate double-printed error with -p/--pipe * Allow relative paths to -p/--pipe 0.10 2012-09-12 [ENHANCEMENTS] * Added masontidy plugin (Mason component tidier) * Added jslint plugin (javascript validator) 0.09 2012-09-11 [BUG FIXES] * Remove use of ex-dependency Hash::MoreUtils from bin/tidyall (Jason Wieland) * Added IPC::System::Simple and Pod::Usage to deps (Jason Wieland) 0.08 2012-09-10 [ENHANCEMENTS] * Added js-beautify plugin (javascript tidier) * Added jshint plugin (javascript validator) * Added podchecker plugin * Added -p/--pipe flag to read from STDIN and write to STDOUT * Allow tidyall.el to work in narrowed regions * Make plugins into Moo classes, pass configuration as attributes [BUG FIXES] * Remove unused SVN::Look - perl-code-tidyall/pull/1 (Pedro Melo) * Filter just files from git status in Code::TidyAll::Git::Precommit (Pedro Melo) 0.07 2012-09-05 [ENHANCEMENTS] * Added git pre-receive hook (Code::TidyAll::Git::Prereceive) [BUG FIXES] * Show file paths with errors in quiet mode 0.06 2012-09-03 [ENHANCEMENTS] * Added -g/--git flag and git pre-commit hook (Code::TidyAll::Git::Precommit) [BUG FIXES] * Omit directories from svn_uncommitted_files (--svn) 0.05 2012-08-21 [ENHANCEMENTS] * Added etc/editors/tidyall.el for Emacs * Only print 'no plugins apply' warning in verbose mode 0.04 2012-08-14 [ENHANCEMENTS] * Added -s/--svn flag * Added emergency_comment_prefix ("NO TIDYALL") to svn precommit hook [BUG FIXES] * Added back missing plugins * Fix --check-only flag 0.03 2012-07-24 [eNHANCEMENTS] * Added svn precommit hook (Code::TidyAll::SVN::Precommit) * Added preprocess_source and postprocess_source to plugins * Added only_modes and except_modes configuration for plugins * Added Code::TidyAll::process_source(), for processing a string instead of a file * When only specified files are being processed, don't scan the whole hierarchy * Added -I flag to tidyall [INTERNALS] * Switch to Moo * Added separate new_from_conf_file constructor, for cleaner separation of cases 0.02 2012-07-03 [ENHANCEMENTS] * Added Test::Code::TidyAll, to test that a project is tidied * Added prefilter and postfilter params, to be applied to code before and after processing * Added --check-only option to check but not tidy * Added --mode option and modes config entry, to activate only a subset of plugins in config * Added --output-suffix to write file to a different destination * Added --quiet option to suppress most output * Added --tidyall-class option to specify a different Code::TidyAll subclass * Document how to create new plugins in Code::Tidy::Plugin 0.01 2012-06-17 * Initial release Code-TidyAll-0.67/bin/0000775000175000017500000000000013157756244014310 5ustar autarchautarchCode-TidyAll-0.67/bin/tidyall0000755000175000017500000006014413157756244015703 0ustar autarchautarch#!perl use Capture::Tiny qw(capture_merged); use Code::TidyAll; use Config; use Path::Tiny qw(cwd path); use Getopt::Long; use strict; use warnings; our $VERSION = '0.67'; my $usage = ' Usage: tidyall [options] [file] ... See https://metacpan.org/module/tidyall for full documentation. Options: -a, --all Process all files in project -i, --ignore Ignore matching files (zglob syntax) -g, --git Process all added/modified files according to git -h, --help Print help message -l, --list List each file along with the plugins it matches -m, --mode Mode (e.g. "editor", "commit") - affects which plugins run -p , --pipe Read from STDIN, output to STDOUT/STDERR -r, --recursive Descend recursively into directories listed on command line -s, --svn Process all added/modified files according to svn -q, --quiet Suppress output except for errors -v, --verbose Show extra output -I I Add one or more paths to @INC --backup-ttl Amount of time before backup files can be purged --check-only Just check each file, don\'t modify --plugins Explicitly run only the given plugins --conf-file Relative or absolute path to conf file --conf-name Conf file name to search for --data-dir Contains metadata, defaults to root/.tidyall.d --iterations Number of times to repeat each transform - default is 1 --no-backups Don\'t back up files before processing --no-cache Don\'t cache last processed times --no-cleanup Don\'t clean up the temporary files --output-suffix Suffix to add to tidied file --refresh-cache Erase any existing cache info before processing each file --root-dir Specify root directory explicitly --tidyall-class Subclass to use instead of Code::TidyAll --version Show version '; sub version { my $version = $Code::TidyAll::VERSION || 'unknown'; print "tidyall $version on perl $] built for $Config{archname}\n"; exit; } sub usage { print $usage; exit; } my ( %params, $all_files, $conf_file, $conf_name, $git_files, $help, $inc_dirs, $pipe, $svn_files, $version ); my @conf_names = Code::TidyAll->default_conf_names; GetOptions( 'backup-ttl=i' => \$params{backup_ttl}, 'check-only' => \$params{check_only}, 'conf-file=s' => \$conf_file, 'conf-name=s' => \$conf_name, 'data-dir=s' => \$params{data_dir}, 'no-backups' => \$params{no_backups}, 'no-cache' => \$params{no_cache}, 'no-cleanup' => \$params{no_cleanup}, 'output-suffix=s' => \$params{output_suffix}, 'plugins=s@' => \$params{selected_plugins}, 'refresh-cache' => \$params{refresh_cache}, 'root-dir=s' => \$params{root_dir}, 'tidyall-class=s' => \$params{tidyall_class}, 'version' => \$version, 'a|all' => \$all_files, 'i|ignore=s@' => \$params{ignore}, 'g|git' => \$git_files, 'h|help' => \$help, 'l|list' => \$params{list_only}, 'm|mode=s' => \$params{mode}, 'p|pipe=s' => \$pipe, 'r|recursive' => \$params{recursive}, 'j|jobs=i' => \$params{jobs}, 's|svn' => \$svn_files, 'q|quiet' => \$params{quiet}, 'v|verbose' => \$params{verbose}, 'I=s' => \$inc_dirs, ) or usage(); version() if $version; usage() if $help; @conf_names = ($conf_name) if defined($conf_name); unshift( @INC, split( /\s*,\s*/, $inc_dirs ) ) if defined($inc_dirs); %params = map { $_ => $params{$_} } grep { defined( $params{$_} ) } keys %params; for my $key (qw( data_dir root_dir )) { $params{$key} = path( $params{$key} ) if exists $params{$key}; } ($conf_file) = ( grep { $_->is_file } map { $params{root_dir}->child($_) } @conf_names ) if $params{root_dir} && !$conf_file; my $tidyall_class = $params{tidyall_class} || 'Code::TidyAll'; my ( $ct, @paths ); if ($pipe) { my $status = handle_pipe( path($pipe) ); exit($status); } elsif ( ( $all_files || $svn_files || $git_files ) ) { die 'cannot use filename(s) with -a/--all, -s/--svn, or -g/--git' if @ARGV; $conf_file ||= $tidyall_class->find_conf_file( \@conf_names, cwd() ); $ct = $tidyall_class->new_from_conf_file( $conf_file, %params ); if ($all_files) { @paths = $ct->find_matched_files; } elsif ($svn_files) { require Code::TidyAll::SVN::Util; @paths = Code::TidyAll::SVN::Util::svn_uncommitted_files( $ct->root_dir ); } elsif ($git_files) { require Code::TidyAll::Git::Util; @paths = Code::TidyAll::Git::Util::git_modified_files( $ct->root_dir ); } } elsif ( @paths = map { path($_) } @ARGV ) { $conf_file ||= $tidyall_class->find_conf_file( \@conf_names, $paths[0]->parent ); $ct = $tidyall_class->new_from_conf_file( $conf_file, %params ); } else { print "must pass -a/--all, -s/--svn, -g/--git, -p/--pipe, or filename(s)\n"; usage(); } my @results = $ct->process_paths(@paths); my $status = ( grep { $_->error } @results ) ? 1 : 0; exit($status); sub handle_pipe { my ($pipe_filename) = @_; $params{$_} = 1 for ( 'no_backups', 'no_cache', 'quiet' ); $params{$_} = 0 for ('verbose'); $conf_file ||= $tidyall_class->find_conf_file( \@conf_names, $pipe_filename->parent ); my $ct = $tidyall_class->new_from_conf_file( $conf_file, %params ); my $root_dir = $ct->root_dir; my $source = do { local $/; }; # Merge stdout and stderr and output all to stderr, so that stdout is # dedicated to the tidied content # my $result; my $output = capture_merged { $result = $ct->process_source( $source, $ct->_small_path( $pipe_filename->absolute ) ); }; print STDERR $output; if ( my $error = $result->error ) { print $source; # Error already printed above return 1; } elsif ( $result->state eq 'no_match' ) { print $source; print STDERR "No plugins apply for '$pipe' in config"; return 1; } elsif ( $result->state eq 'checked' ) { print $source; return 0; } else { print $result->new_contents; return 0; } } 1; __END__ =head1 NAME tidyall - Your all-in-one code tidier and validator =head1 SYNOPSIS # Create a tidyall.ini or .tidyallrc at the top of your project # [PerlTidy] select = **/*.{pl,pm,t} argv = -noll -it=2 [PerlCritic] select = lib/**/*.pm ignore = lib/UtterHack.pm argv = -severity 3 # Process all files in the current project, # look upwards from cwd for conf file # % tidyall -a # Process one or more specific files, # look upwards from the first file for conf file # % tidyall file [file...] # Process a directory recursively # % tidyall -r dir =head1 DESCRIPTION There are a lot of great code tidiers and validators out there. C makes them available from a single unified interface. You can run C on a single file or on an entire project hierarchy, and configure which tidiers/validators are applied to which files. C will back up files beforehand, and for efficiency will only consider files that have changed since they were last processed. =head2 What's a tidier? What's a validator? A I transforms a file so as to improve its appearance without changing its semantics. Examples include L, L and L. A I analyzes a file for some definition of correctness. Examples include L, L and L. Many tidiers are also validators, e.g. C will throw an error on badly formed Perl. To use a tidier or validator with C it must have a corresponding plugin class, usually under the prefix C. This distribution comes with plugins for: =over =item * Perl: L, L, L =item * Pod: L, L, L =item * Mason: L =item * JavaScript: L, L, L =item * JSON: L =item * CSS: L =item * PHP: L =item * Misc: L =back See L for information about creating your own plugin. =head1 USING TIDYALL C works on a project basis, where a project is just a directory hierarchy of files. svn or git working directories are typical examples of projects. The top of the project is called the I. In the root directory you'll need a config file named C or C<.tidyallrc>; it defines how various tidiers and validators will be applied to the files in your project. C will find your root directory and config file automatically depending on how you call it: =over =item C<< tidyall file [file...] >> C will search upwards from the first file for the conf file. =item C<< tidyall -p/--pipe file >> C will search upwards from the specified file for the conf file. =item C<< tidyall -a/--all >> or C<< tidyall -s/--svn >> or C<< tidyall -g/--git >> C will search upwards from the current working directory for the conf file. =item C<< tidyall -a --root-dir dir >> C will expect to find the conf file in the specified root directory. =back You can also pass --conf-name to change the name that is searched for, or --conf-file to specify an explicit path. =head1 CONFIGURATION The config file (C or C<.tidyallrc>) is in L format. Here's a sample: ignore = **/*.bak [PerlTidy] select = **/*.{pl,pm,t} argv = -noll -it=2 [PerlCritic] select = lib/**/*.pm ignore = lib/UtterHack.pm lib/OneTime/*.pm argv = -severity 3 [PodTidy] select = lib/**/*.{pm,pod} In order, the four sections declare: =over =item * Always ignore C<*.bak> files. =item * Apply C with settings "-noll -it=2" to all *.pl, *.pm, and *.t files. =item * Apply C with severity 3 to all Perl modules somewhere underneath "lib/", except for "lib/UtterHack.pm". =item * Apply C with default settings to all *.pm and *.pod files underneath "lib/". =back =head2 Standard configuration elements =over =item [class] or [class description] The header of each section refers to a tidyall I. The name is automatically prefixed with C unless it begins with a '+', e.g. ; Uses plugin Code::TidyAll::Plugin::PerlTidy ; [PerlTidy] ; Uses plugin My::TidyAll::Plugin ; [+My::TidyAll::Plugin] You can also include an optional description after the class. The description will be ignored and only the first word will be used for the plugin. This allows you to a list a plugin more than once, with different configuration each time. For example, two different C configurations: ; Be brutal on libraries ; [PerlCritic strict] select = lib/**/*.pm argv = --brutal ; but gentle on scripts ; [PerlCritic lenient] select = bin/**/*.pl argv = --gentle Warning: If you simply list the same plugin twice with no description (or the same description), one of them will be silently ignored. =item select One or more L patterns, separated by whitespace or on multiple lines, indicating which files to select. At least one is required. e.g. ; All .t and .pl somewhere under bin and t; ; plus all .pm files directly under lib/Foo and lib/Bar ; select = {bin,t}/**/*.p[lm] select = lib/{Foo,Bar}/*.pm ; All .txt files anywhere in the project ; select = **/*.txt The pattern is relative to the root directory and should have no leading slash. All standard glob characters (C<*>, C, C<[]>, C<{}>) will work; in addition, C<**> can be used to represent zero or more directories. See L documentation for more details. =item ignore One or more L patterns, separated by whitespace or on multiple lines, indicating which files to ignore. This is optional and overrides C. e.g. ; All files with no extension anywhere under bin that include a "perl" or ; "perl5" shebang line. select = bin/**/* ignore = bin/**/*.* shebang = perl shebang = perl5 =item only_modes A list of modes, separated by whitespace. e.g. only_modes = test cli The plugin will I run if one of these modes is passed to C via C<-m> or C<--mode>. =item except_modes A list of modes, separated by whitespace. e.g. except_modes = commit editor The plugin will I run if one of these modes is passed to C via C<-m> or C<--mode>. =item argv Many plugins (such as L, L and L) take this option, which specifies arguments to pass to the underlying command-line utility. =item weight This is an integer that is used to sort plugins. By default, tidier plugins run first, then validator plugins, with each group sorted alphabetically. =back =head1 PLUGIN ORDER AND ATOMICITY If multiple plugins match a file, tidiers are applied before validators so that validators are checking the final result. Within those two groups, the plugins are applied in alphabetical order by plugin name/description. You can also explicitly set the weight of each plugin. By default, tidiers have a weight of 50 and validators have a weight of 60. You can set the weight to any integer to influence when the plugin runs. The application of multiple plugins is all-or-nothing. If an error occurs during the application of any plugin, the file is not modified at all. =head1 COMMAND-LINE OPTIONS =over =item -a, --all Process all files. Does a recursive search for all files in the project hierarchy, starting at the root, and processes any file that matches at least one plugin in the configuration. =item -i, --ignore Ignore matching files. This uses zglob syntax. You can pass this option more than once. =item -g, --git Process all added or modified files in the current git working directory. =item -h, --help Print help message =item -l, --list List each file along with the list of plugins it matches (files without any matches are skipped). Does not actually process any files and does not care whether files are cached. Generally used with -a, -g, or -s. e.g. % tidyall -a -l lib/CHI.pm (PerlCritic, PerlTidy, PodTidy) lib/CHI/Benchmarks.pod (PodTidy) lib/CHI/CacheObject.pm (PerlCritic, PerlTidy, PodTidy) =item -m, --mode Optional mode that can affect which plugins run. Defaults to C. See L. =item -p path, --pipe path Read content from STDIN and write the resulting content to STDOUT. If successful, tidyall exits with status 0. If an error occurs, tidyall outputs the error message to STDERR, I to STDOUT with no changes, and exits with status 1. The mirroring means that you can safely pipe to your destination regardless of whether an error occurs. When specifying this option you must specify exactly one filename, relative or absolute, which will be used to determine which plugins to apply and also where the root directory and configuration file are. The file will not actually be read and does need even need to exist. This option implies --no-backups and --no-cache (since there's no actual file) and --quiet (since we don't want to mix extraneous output with the tidied result). # Read from STDIN and write to STDOUT, with appropriate plugins # for some/path.pl (which need not exist) # % tidyall --pipe some/path.pl =item -r, --recursive Recursively enter any directories listed on the command-line and process all the files within. By default, directories encountered on the command-line will generate a warning. =item -s, --svn Process all added or modified files in the current svn working directory. =item -q, --quiet Suppress output except for errors. =item -v, --verbose Show extra output. =item -I I Add one or more library paths to @INC, like Perl's -I. Useful if --tidyall-class or plugins are in an alternate lib directory. =item --backup-ttl I Amount of time before backup files can be purged. Can be a number of seconds or any string recognized by L, e.g. "4h" or "1day". Defaults to "1h". =item --check-only Instead of actually tidying files, check if each file is tidied (i.e. if its tidied version is equal to its current version) and consider it an error if not. This is used by L and the L and L pre-commit hooks, for example, to enforce that you've tidied your files. =item --conf-file I Specify relative or absolute path to conf file, instead of searching for it in the usual way. =item --conf-name I Specify a conf file name to search for instead of the defaults (C / C<.tidyallrc>). =item --data-dir I Contains data like backups and cache. Defaults to root_dir/.tidyall.d =item --iterations I Run each tidier transform I times. Default is 1. In some cases (hopefully rare) the output from a tidier can be different if it is applied multiple times. You may want to perform multiple iterations to make sure the content "settles" into its final tidied form -- especially if the tidiness is being enforced with a version-control hook or a test. Of course, performance will suffer a little. You should rarely need to set this higher than 2. This only affects tidiers, not validators; e.g. L and L would still only be run once. =item --no-backups Don't backup files before processing. =item --no-cache Don't cache last processed times; process all files every time. See also C<--refresh-cache>. =item --plugins I Only run the specified plugins. The name should match the name given in the config file exactly, including a leading "+" if one exists. This overrides the C<--mode> option. Note that plugins will still only run on files which match their C and C configuration. =item * cache_model_class The cache model class. Defaults to C =item * cache The cache instance (e.g. an instance of C or a C instance.) An instance of C is automatically instantiated by default. =item * backup_ttl =item * check_only 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. =item * no_cleanup A boolean indicating if we should skip cleaning temporary files or not. Defaults to false. =item * inc An arrayref of directories to prepend to C<@INC>. This can be set via the command-line as C<-I>, but you can also set it in a config file. This affects both loading and running plugins. =item * data_dir =item * iterations =item * mode =item * no_backups =item * no_cache =item * output_suffix =item * quiet =item * root_dir =item * ignore =item * verbose These options are the same as the equivalent C command-line options, replacing dashes with underscore (e.g. the C option becomes C here). =item * msg_outputter This is a subroutine reference that is called whenever a message needs to be printed in some way. The sub receives a C format string followed by one or more parameters. The default sub used simply calls C but L overrides this to use the C<< Test::Builder->diag >> method. =back =head2 $tidyall->process_paths( $path, ... ) This method iterates through a list of paths, processing all the files it finds. It will descend into subdirectories if C flag is true. Returns a list of L objects, one for each file. =head2 $tidyall->process_file( $file ) Process the one I, meaning: =over 4 =item * Check the cache and return immediately if file has not changed. =item * Apply appropriate matching plugins. =item * Print success or failure result to STDOUT, depending on quiet/verbose settings. =item * Write to the cache if caching is enabled. =item * Return a L object. =back =head2 $tidyall->process_source( $source, $path ) Like C, but process the I string instead of a file, and does not read from or write to the cache. You must still pass the relative I from the root as the second argument, so that we know which plugins to apply. Returns a L object. =head2 $tidyall->plugins_for_path($path) Given a relative I from the root, returns a list of L objects that apply to it, or an empty list if no plugins apply. =head2 $tidyall->find_matched_files Returns a list of sorted files that match at least one plugin in configuration. =head2 Code::TidyAll->find_conf_file( $conf_names, $start_dir ) Start in the I and work upwards, looking for a file matching one of the I. Returns the pathname if found or throw an error if not found. =head1 SUPPORT Bugs may be submitted at L. I am also usually active on IRC as 'autarch' on C. =head1 SOURCE The source code repository for Code-TidyAll can be found at L. =head1 AUTHORS =over 4 =item * Jonathan Swartz =item * Dave Rolsky =back =head1 CONTRIBUTORS =for stopwords Adam Herzog Andy Jack Finn Smith George Hartzell Graham Knop Gregory Oschwald Joe Crotty Mark Fowler Grimes Martin Gruner Mohammad S Anwar Olaf Alders Pedro Melo Ricardo Signes Sergey Romanov Shlomi Fish timgimyee =over 4 =item * Adam Herzog =item * Andy Jack =item * Finn Smith =item * George Hartzell =item * Graham Knop =item * Gregory Oschwald =item * Joe Crotty =item * Mark Fowler =item * Mark Grimes =item * Martin Gruner =item * Mohammad S Anwar =item * Olaf Alders =item * Pedro Melo =item * Ricardo Signes =item * Sergey Romanov =item * Shlomi Fish =item * timgimyee =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 - 2017 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 F file included with this distribution. =cut Code-TidyAll-0.67/lib/Test/0000775000175000017500000000000013157756244015225 5ustar autarchautarchCode-TidyAll-0.67/lib/Test/Code/0000775000175000017500000000000013157756244016077 5ustar autarchautarchCode-TidyAll-0.67/lib/Test/Code/TidyAll.pm0000644000175000017500000001057113157756244020001 0ustar autarchautarchpackage Test::Code::TidyAll; use strict; use warnings; use Code::TidyAll; use List::Compare; use Test::Builder; # Text::Diff has to be loaded before ::Table use Text::Diff; use Text::Diff::Table; use Exporter qw(import); our $VERSION = '0.67'; my $test = Test::Builder->new; our @EXPORT_OK = qw(tidyall_ok); our @EXPORT = @EXPORT_OK; sub tidyall_ok { my %options = @_; my $conf_file = delete( $options{conf_file} ); if ( !$conf_file ) { my @conf_names = Code::TidyAll->default_conf_names; $conf_file = Code::TidyAll->find_conf_file( \@conf_names, "." ); } $options{quiet} = 1 unless $options{verbose}; $test->diag("Using $conf_file for config") if $options{verbose}; my $files = delete $options{files}; my $ct = Code::TidyAll->new_from_conf_file( $conf_file, check_only => 1, mode => 'test', msg_outputter => \&_msg_outputter, %options, ); my @files; if ($files) { @files = List::Compare->new( $files, [ $ct->find_matched_files ] )->get_intersection; } else { @files = $ct->find_matched_files; } unless (@files) { $test->plan( tests => 1 ); $test->ok( 1, 'found no matching files for tidyall_ok' ); return; } $test->plan( tests => scalar(@files) ); foreach my $file (@files) { my $desc = $ct->_small_path($file); my $result = $ct->process_file($file); $test->ok( $result->ok, "$desc is tidy" ); unless ( $result->ok ) { $test->diag( $result->error ); if ( $options{verbose} ) { my $orig = $result->orig_contents; my $new = $result->new_contents; if ( defined $orig && defined $new ) { $test->diag( diff( \$orig, \$new, { STYLE => 'Table' } ) ); } } } } } sub _msg_outputter { my $format = shift; $test->diag( sprintf $format, @_ ); } 1; # ABSTRACT: Check that all your files are tidy and valid according to tidyall __END__ =pod =encoding UTF-8 =head1 NAME Test::Code::TidyAll - Check that all your files are tidy and valid according to tidyall =head1 VERSION version 0.67 =head1 SYNOPSIS In a file like 't/tidyall.t': #!/usr/bin/perl use Test::Code::TidyAll; tidyall_ok(); =head1 DESCRIPTION Uses L's C mode to check that all the files in your project are in a tidied and valid state, i.e. that no plugins throw errors or would change the contents of the file. Does not actually modify any files. By default, we look for the config file C or C<.tidyallrc> in the current directory and parent directories, which is generally the right place if you are running L. When invoking L, we pass C<< mode => 'test' >> by default; see L. =head1 EXPORTS This module exports one subroutine, which is exported by default: =head2 tidyall_ok(...) Most options given to this subroutine will be passed along to the L constructor. For example, if you don't want to use the tidyall cache and instead check all files every time: tidyall_ok( no_cache => 1 ); or if you need to specify the config file: tidyall_ok( conf_file => '/path/to/conf/file' ); By default, this subroutine will test every file that matches the config you specify. However, you can pass a C parameter as an array reference to override this, in which case only the files you specify will be tested. These files are still filtered based on the C