App-perlimports-0.000060 000755 001750 001751 0 15176664014 14075 5 ustar 00olaf olaf 000000 000000 LICENSE 100644 001750 001751 46276 15176664014 15222 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 This software is copyright (c) 2020 by Olaf Alders.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2020 by Olaf Alders.
This is free software, licensed under:
The GNU General Public License, Version 1, February 1989
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see .
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
, 1 April 1989
Moe Ghoul, President of Vice
That's all there is to it!
--- The Perl Artistic License 1.0 ---
This software is Copyright (c) 2020 by Olaf Alders.
This is free software, licensed under:
The Perl Artistic License 1.0
The "Artistic License"
Preamble
The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.
Definitions:
"Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.
"Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder as specified below.
"Copyright Holder" is whoever is named in the copyright or
copyrights for the package.
"You" is you, if you're thinking about copying or distributing
this Package.
"Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)
"Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as uunet.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict
with standard executables, which must also be provided, and provide
a separate manual page for each non-standard executable that clearly
documents how it differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where
to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) give non-standard executables non-standard names, and clearly
document the differences in manual pages (or equivalent), together
with instructions on where to get the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this
Package. You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own. You may embed this Package's interpreter within
an executable of yours (by linking); this shall be construed as a mere
form of aggregation, provided that the complete Standard Version of the
interpreter is so embedded.
6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whoever generated
them, and may be sold commercially, and may be aggregated with this
Package. If such scripts or library files are aggregated with this
Package via the so-called "undump" or "unexec" methods of producing a
binary executable image, then distribution of such an image shall
neither be construed as a distribution of this Package nor shall it
fall under the restrictions of Paragraphs 3 and 4, provided that you do
not represent such an executable image as a Standard Version of this
Package.
7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines do
not change the language in any way that would cause it to fail the
regression tests for the language.
8. Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution. Such use shall not be
construed as a distribution of this Package.
9. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
INSTALL 100644 001750 001751 4600 15176664014 15207 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 This is the Perl distribution App-perlimports.
Installing App-perlimports is straightforward.
## Installation with cpanm
If you have cpanm, you only need one line:
% cpanm App::perlimports
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 App::perlimports
## Manual installation
As a last resort, you can manually install it. If you have not already
downloaded the release tarball, you can find the download link on the module's
MetaCPAN page: https://metacpan.org/pod/App::perlimports
Untar the tarball, install configure prerequisites (see below), then build it:
% perl Makefile.PL
% make && make test
Then install it:
% make install
On Windows platforms, you should use `dmake` or `nmake`, instead of `make`.
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
The prerequisites of this distribution will also have to be installed manually. The
prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated
by running the manual build process described above.
## Configure Prerequisites
This distribution requires other modules to be installed before this
distribution's installer can be run. They can be found under the
"configure_requires" key of META.yml or the
"{prereqs}{configure}{requires}" key of META.json.
## Other Prerequisites
This distribution may require additional modules to be installed after running
Makefile.PL.
Look for prerequisites in the following phases:
* to run make, PHASE = build
* to use the module code itself, PHASE = runtime
* to run tests, PHASE = test
They can all be found in the "PHASE_requires" key of MYMETA.yml or the
"{prereqs}{PHASE}{requires}" key of MYMETA.json.
## Documentation
App-perlimports documentation is available as POD.
You can run `perldoc` from a shell to read the documentation:
% perldoc App::perlimports
For more information on installing Perl modules via CPAN, please see:
https://www.cpan.org/modules/INSTALL.html
Changes 100644 001750 001751 24153 15176664014 15476 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 Revision history for App-perlimports
0.000060 2026-05-06 16:10:42Z
- Drop Perl 5.18, 5.20, 5.22 from CI matrix
- Add Perl 5.42 to CI matrix
- Remove Test::Most integration test (Test::Most 0.39 broke import => [...]
support) (GH#159)
0.000059 2026-04-24 12:47:09Z
- Add `pad_brackets` and `indent` formatting options (GH#151) (Paul
Johnson)
- Recognize constants defined with `use constant` as importable symbols
(GH#141) (pyrrhlin)
- Fix crash when parsing double-quoted strings containing "q" or "qq"
(GH#133) (Copilot)
- Rename `original_imports` attribute to `found_imports` (GH#140)
(pyrrhlin)
- Ensure `original_imports` does not contain duplicated symbols (GH#139)
(pyrrhlin)
- Avoid wasted effort when linting includes that would not change
(GH#138) (pyrrhlin)
- Clean up `maybe_new_include` and related lint-or-tidy code paths
(GH#143) (pyrrhlin)
- Use bare values for simple Bool defaults in Moo attributes (GH#157)
(Olaf Alders)
- Remove duplicate STDERR assertion in t/cli.t (GH#156) (Olaf Alders)
- Add CLAUDE.md and update CONTRIBUTING.md (GH#153) (Olaf Alders)
0.000058 2025-10-28 17:06:33Z
- Fix: Recognize function references (\&Module::func) as valid module usage
(GH#131) (Copilot)
0.000057 2025-04-30 12:12:23Z
- Update test expectations for MooseX::Types::Moose 0.51 (GH#122) (Olaf
Alders)
0.000056 2025-03-02 23:34:13Z
- Update example path for` XDG_CONFIG_HOME` in CLI.pm (GH#120) (Nelo Onyiah
0.000055 2024-07-04 16:16:22Z
- Document that Emacs users can get "perlimports --lint" via Flycheck
(GH#112) (Peter Oliver)
0.000054 2024-06-29 19:32:58Z
- Don't treat locally defined subs as importable symbols (GH#110) (Olaf
Alders). Reported by Glenn Rice.
0.000053 2024-01-13 20:12:59Z
- Don't log a non-JSON message to STDERR on linting success when --json is
enabled (GH#107) (Olaf Alders)
0.000052 2023-08-19 19:03:55Z
- Allow PPI::Statement::Expression in hash key (GH#102) (José Manuel
Rodríguez D.)
- Fix the never-exports test for machines with older LWP::UserAgent
(GH#101) (E. Choroba)
0.000051 2023-06-01 15:52:09Z
- Bump TOML::Tiny version from 0 to 0.16 (GH#98) (Olaf Alders)
0.000050 2023-02-14 19:50:33Z
- Add experimental --range-begin and --range-end flags, to be used for
editor integration (GH#93) (Olaf Alders)
- Remove unused variables (GH#95) (Olaf Alders)
- Ignore more modules which don't eval (GH#94) (Olaf Alders)
0.000049 2022-10-24 21:19:17Z
- Add an experimental --json flag to be used when --lint is enabled (GH#90)
(Olaf Alders)
- Ignore Filter::Simple (GH#91) (Olaf Alders)
0.000048 2022-09-13 21:49:19Z
- Make diagnostic message from linter less confusing (GH#88) (Olaf Alders)
0.000047 2022-09-12 15:31:01Z
- Bump PPI from 1.274 to 1.276 (GH#87) (Olaf Alders)
0.000046 2022-09-09 22:26:52Z
- Add a --lint flag to force perlimports to behave as a linter (GH#85)
(Olaf Alders)
0.000045 2022-06-16 21:18:31Z
- Document config file creation and Vim + ALE configuration (GH#83) (Olaf
Alders)
- Flush memoize cache on object creation (GH#82) (Olaf Alders)
- Apply perltidy 20220613 (GH#81) (Olaf Alders)
0.000044 2022-05-27 18:01:51Z
- Add log_filename to default config file content (GH#79) (Olaf Alders)
- Don't raise some expected Mojo eval problems to the warning level (GH#80)
(Olaf Alders)
0.000043 2022-05-18 13:28:01Z
- Relax TOML::Tiny version (GH#78) (James Raspass)
0.000042 2022-05-10 19:24:12Z
- Fix exception which was thrown when only global config existed (GH#77)
(Olaf Alders)
0.000041 2022-05-10 15:19:34Z
- exit() from script rather than from module (GH#74) (Olaf Alders)
- Find Perl files present in dirs, if they are passed as filename args
(GH#75) (Olaf Alders)
0.000040 2022-05-06 13:25:15Z
- Set minimum version of File::XDG to 1.01 (GH#73) (Olaf Alders)
0.000039 2022-05-05 21:55:32Z
- Remove coercion which broke environments without config files (GH#71)
(Olaf Alders)
0.000038 2022-05-05 20:45:48Z
- This release adds (experimental and underdocumented) support for TOML
config files (GH#69) (Olaf Alders)
- The use of TOML::Tiny means we're bumping the minimum Perl to 5.18
0.000037 2022-05-02 20:58:40Z
- This distribution no longer includes a fatpacked PPI (GH#70) (Olaf
Alders)
0.000036 2022-04-29 13:09:44Z
- Bump PPI from 1.272 to 1.273
- Allow multiple filenames to be passed to CLI (GH#68) (Olaf Alders)
0.000035 2022-02-23 00:35:26Z
- Bump Perl::Tidy from 20211029 to 20220217 (GH#67) (Olaf Alders)
- Bump PPI from 1.270 to 1.272
- Try to fix failures in t/never-exports.t
0.000034 2022-02-14 18:26:15Z
- Don't try to rewrite an import that we can't eval (GH#66) (Olaf Alders)
0.000033 2022-02-11 23:20:52Z
- Update forked PPI to include PPI 1.272 (GH#64) (Olaf Alders)
- Avoid exceptions when trying to unnest quotes (GH#65) (Olaf Alders)
0.000032 2022-01-15 03:41:49Z
- Require Perl::Tidy version 20211029
0.000031 2022-01-13 21:05:01Z
- Ignore PerlIO::gzip and Modern::Perl
- Rework formatting of Test::Builder modules (GH#61) (Olaf Alders)
0.000030 2021-12-21 22:55:49Z
- Avoid calling methods on undef variable (GH#59) (Olaf Alders)
- Preserve some arbitrary padding. It may have been added by a tidier.
(GH#60) (Olaf Alders)
0.000029 2021-12-20 19:24:54Z
- Improve import sort order (GH#58) (Olaf Alders)
0.000028 2021-12-18 02:26:13Z
- Maintain stable sort order for lists which include sigils (GH#57) (Olaf
Alders)
0.000027 2021-11-29 22:29:05Z
- Detect Test::Builder objects used in import() (GH#56) (Olaf Alders)
- Require Test::Script 1.29
0.000026 2021-11-26 21:35:12Z
- Ignore Env.pm for the time being (GH#47) (Olaf Alders)
- Allow module name to be passed to dump-perl-exports without flag (GH#46) (Olaf Alders)
- Ignore Constant::Generate and Git::Sub (GH#46) (Olaf Alders)
- Bump minimum Perl to 5.12.0 (GH#46) (Olaf Alders)
- Ignore modules which we cannot eval (GH#49) (Olaf Alders)
- Ignore Sort::ByExample and MLDBM
- Ensure --no-tidy-whitespace is passed as a CLI param (GH#53) (Olaf Alders)
- Ignore Import::Into (GH#52) (Olaf Alders)
- Ignore more whitespace changes (GH#54) (Olaf Alders)
0.000025 2021-10-13 21:42:40Z
- Add another minimum version to t/with-version.t (GH#43) (Olaf Alders)
0.000024 2021-10-12 15:58:08Z
- Fix t/with-version.t on some machines by requiring the correct minimum
needed module version via Test::Needs (GH#42) (Olaf Alders)
0.000023 2021-09-29 18:50:41Z
- Eval import() statements before changing them (GH#40) (Olaf Alders)
- Don't consider "my @Foo" to be a use of an imported "@Foo" (GH#40) (Olaf
Alders)
0.000022 2021-09-27 01:31:43Z
- Ensure PPI 1.270 is required in cpanfile (Reported by Slaven Rezić in
#39)
0.000021 2021-09-25 23:51:02Z
- Document how to configure Code::TidyAll and precious
- Add Carp::Always to ignored modules
- Require Log::Dispatch 2.70
0.000020 2021-09-23 22:49:41Z
- Add a --log-filename parameter (GH#37) (Olaf Alders)
- Add a --[no-]tidy-whitespace param (GH#38) (Olaf Alders)
- Fix disappearing module version numbers (GH#38) (Olaf Alders)
0.000019 2021-09-17 19:20:44Z
- Ignore modules with import errors (GH#35) (Olaf Alders)
- Stop special-casing Import::Into (GH#35) (Olaf Alders)
- Reduce required dependencies (GH#36) (Olaf Alders)
- Add an examples folder (GH#36) (Olaf Alders)
0.000018 2021-09-07 18:41:28Z
- Cover more object oriented modules (GH#32) (Olaf Alders)
0.000017 2021-07-17 15:54:27Z
- Bump version of IP::Random used in tests. Fixes #30. (GH#31) (Olaf
Alders)
0.000016 2021-07-09 17:54:06Z
- Detect Module::->new syntax (GH#29) (Olaf Alders)
- Fix some regex parsing behaviour (GH#29) (Olaf Alders)
0.000015 2021-07-08 22:35:18Z
- Reduce false positives introduced by 0.000014 (GH#28) (Olaf Alders)
0.000014 2021-07-08 19:47:54Z
- Detect symbols in nested quotes (GH#27) (Olaf Alders)
0.000013 2021-07-08 14:54:28Z
- Detect functions used in regex replacements (GH#26) (Olaf Alders)
0.000012 2021-06-23 17:52:22Z
- Fix a warning that was being triggered by the logger
0.000011 2021-06-14 20:24:05Z
- Fix export tag test
0.000010 2021-06-12 03:25:27Z
- Detect fully qualified symbol name interpolated in quotes
- Ignore HTTP::Message::PSGI
- Include docs for regex patterns which should have been included in
0.000009
0.000009 2021-06-10 18:41:59Z
- Remove dependency on Data::Printer
- Add support for ignoring modules via regular expression pattern (GH#16)
(Nicolas Mendoza)
- Silence "Use of uninitialized value" warning (GH#21) (Kenichi Ishigaki)
- Export tag are now converted to symbols
0.000008 2021-06-08 10:42:56Z
- Detect imported symbols used in prototypes
- Ignore more modules
- Make annotation regex less restrictive
- Add --libs arg to dump-perl-exports
- Detect when modules are only used via package variables
- Detect subs which are only re-exported via Sub::Exporter
- Optimize for speed a little bit more
0.000007 2021-05-27 15:24:53Z
- Add an experimental --cache flag
- Experiment with parsing signatures
- Optimize (a little bit) for speed
0.000006 2021-05-04 22:28:39Z
- Support ## no perlimports and ## use perlimports annotations (GH#5) (Olaf
Alders)
- Update docs to include --[no-]preserve-duplicates and
--[no-]preserve-unused
- Update docs on log-level
- Remove FindBin as a runtime dependency
0.000005 2021-05-01 16:49:07Z
- Require a minimum Data::Printer version of 0.36.
0.000004 2021-04-30 21:40:35Z
- Be explicit about more module versions in tests.
0.000003 2021-04-29 03:00:10Z
- Fix t/dump-perl-exports.t, which was sometimes testing against the wrong
perl.
0.000002 2021-04-22 20:35:47Z
- Add test-data to no_index directories.
0.000001 2021-04-22 20:10:45Z
- Initial release. Caveat emptor.
t 000755 001750 001751 0 15176664014 14261 5 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 cli.t 100644 001750 001751 35025 15176664014 15402 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 'test-data/lib', 't/lib';
use App::perlimports::CLI ();
use Capture::Tiny qw( capture );
use Cpanel::JSON::XS qw( decode_json );
use File::pushd qw( pushd );
use Path::Tiny ();
use TestHelper qw( logger );
use Test::Differences qw( eq_or_diff );
use Test::Fatal qw( exception );
use Test::More import => [qw( done_testing is like ok subtest )];
use Test::Needs qw( Perl::Critic::Utils );
subtest 'bad path to config file' => sub {
local @ARGV = (
'--config-file',
'test-data/XXX',
'test-data/a.pl',
);
ok( App::perlimports::CLI->new, '_config_file builder is lazy' );
like(
exception { App::perlimports::CLI->new->run }, qr{XXX not found},
'not found'
);
};
# Emulate a user with no local or global config file
subtest 'no config files' => sub {
my $dir = Path::Tiny->tempdir('testconfigXXXXXXXX');
local $ENV{XDG_CONFIG_HOME} = "$dir";
local @ARGV = ('--version');
my $pushd = pushd("$dir");
my $cli = App::perlimports::CLI->new;
my ($stdout) = capture { $cli->run };
like( $stdout, qr{$App::perlimports::CLI::VERSION}, 'prints version' );
};
# Emulate a user with only a global config file
subtest 'no local config file' => sub {
my $xdg_config_home = Path::Tiny->tempdir('testconfigXXXXXXXX');
local $ENV{XDG_CONFIG_HOME} = $xdg_config_home->stringify;
my $global_config_dir = $xdg_config_home->child('perlimports');
$global_config_dir->mkpath;
my $global_config = $global_config_dir->child('perlimports.toml');
local @ARGV = ( '--create-config-file', $global_config );
is( App::perlimports::CLI->new->run, '0', 'clean exit code' );
ok( -e $global_config, 'file created' );
my $project_dir = Path::Tiny->tempdir('testconfigXXXXXXXX');
my $pushd = pushd("$project_dir");
my $cli = App::perlimports::CLI->new;
is( $cli->_config_file, $global_config, 'config file found' );
# Try to recreate config file
local @ARGV = ( '--create-config-file', $global_config );
my $exit_code;
my ( undef, $stderr )
= capture { $exit_code = App::perlimports::CLI->new->run };
like(
$stderr, qr{perlimports.toml already exists},
'perlimports.toml already exists'
);
is( $exit_code, 1, 'non-zero exit code' );
};
subtest 'help' => sub {
local @ARGV = ('--help');
my $cli = App::perlimports::CLI->new;
my ($stdout) = capture { $cli->run };
like( $stdout, qr{filename STR}, 'prints help' );
};
subtest 'verbose help' => sub {
local @ARGV = ('--verbose-help');
# Verbose text on $0, which will differ when this is called from
# script/perlimports
local $0 = 'script/perlimports';
my $cli = App::perlimports::CLI->new;
my ($stdout) = capture { $cli->run };
like(
$stdout, qr{Create a sample config file},
'prints help'
);
};
subtest filter_paths => sub {
## no critic (Subroutines::ProtectPrivateSubs)
my @paths = App::perlimports::CLI::_filter_paths(
'test-data/filter-paths',
'test-data/filter-paths/foo.t'
);
## use critic
eq_or_diff(
[ sort @paths ],
[
'test-data/filter-paths/Foo.pl',
'test-data/filter-paths/Foo.pm',
'test-data/filter-paths/foo',
'test-data/filter-paths/foo.t',
]
);
};
subtest '--filename' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Perl::Critic::Utils qw( $QUOTE );
my %foo = (
$QUOTE => q{description},
);
EOF
local @ARGV = (
'--no-config-file',
'-f' => 'test-data/var-in-hash-key.pl',
);
my $cli = App::perlimports::CLI->new( logger => logger( [] ) );
my ($stdout) = capture {
$cli->run;
};
is( $stdout, $expected, 'parses filename' );
};
subtest 'invalid --filename' => sub {
local @ARGV = (
'--no-config-file',
'-f' => 'test-data/does-not-exist.pl',
);
my $cli = App::perlimports::CLI->new();
my ( $stdout, $stderr, $exit_code ) = capture {
$cli->run;
};
is( $stdout, q{}, 'no STDOUT' );
like(
$stderr,
qr{test-data/does-not-exist.pl does not appear to be a file},
'STDERR contains appropriate error message'
);
is( $exit_code, 1, 'exit code is error' );
};
subtest '--lint success' => sub {
local @ARGV = (
'--lint',
'--no-config-file',
'-f' => 'test-data/lint-success.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr, $exit ) = capture {
$cli->run;
};
is(
$stderr,
"test-data/lint-success.pl OK\n",
'success message on STDERR'
);
is( $stdout, q{}, 'no STDOUT' );
is( $exit, 0, 'exit code is success' );
};
subtest '--lint --json success' => sub {
local @ARGV = (
'--lint',
'--json',
'--no-config-file',
'-f' => 'test-data/lint-success.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr, $exit ) = capture {
$cli->run;
};
is( $stderr, q{}, 'success message on STDERR' );
is( $stdout, q{}, 'no STDOUT' );
is( $exit, 0, 'exit code is success' );
};
subtest '--lint failure import args' => sub {
local @ARGV = (
'--lint',
'--no-config-file',
'-f' => 'test-data/lint-failure-import-args.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr, $exit ) = capture {
$cli->run;
};
is( $stdout, q{}, 'no STDOUT' );
my $expected = <<'EOF';
❌ Perl::Critic::Utils (import arguments need tidying) at test-data/lint-failure-import-args.pl line 4
@@ -4 +4 @@
-use Perl::Critic::Utils;
+use Perl::Critic::Utils qw( $QUOTE );
EOF
is( $stderr, $expected, 'STDERR' );
is( $exit, 1, 'exit code is error' );
};
subtest '--lint failure unused import' => sub {
local @ARGV = (
'--lint',
'--no-config-file',
'--no-preserve-unused',
'-f' => 'test-data/lint-failure-unused-import.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr, $exit ) = capture {
$cli->run;
};
is( $stdout, q{}, 'no STDOUT' );
my $expected = <<'EOF';
❌ Carp (appears to be unused and should be removed) at test-data/lint-failure-unused-import.pl line 6
@@ -6 +5,0 @@
-use Carp;
EOF
is( $stderr, $expected, 'STDERR' );
is( $exit, 1, 'exit code is error' );
};
subtest '--lint failure duplicate import' => sub {
local @ARGV = (
'--lint',
'--no-config-file',
'--no-preserve-duplicates',
'-f' => 'test-data/lint-failure-duplicate-import.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr, $exit ) = capture {
$cli->run;
};
is( $stdout, q{}, 'no STDOUT' );
my $expected = <<'EOF';
❌ Carp (has already been used and should be removed) at test-data/lint-failure-duplicate-import.pl line 7
@@ -7 +6,0 @@
-use Carp;
EOF
is( $stderr, $expected, 'STDERR' );
is( $exit, 1, 'exit code is error' );
};
subtest '--lint --json failure duplicate import' => sub {
local @ARGV = (
'--lint',
'--json',
'--no-config-file',
'--no-preserve-duplicates',
'-f' => 'test-data/lint-failure-duplicate-import.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr, $exit ) = capture {
$cli->run;
};
is( $stdout, q{}, 'no STDOUT' );
my $parsed_stderr = decode_json($stderr);
eq_or_diff(
$parsed_stderr,
{
diff => "@@ -7 +6,0 @@\n-use Carp;\n",
filename => 'test-data/lint-failure-duplicate-import.pl',
location => {
end => {
column => 9,
line => 7,
},
start => {
column => 1,
line => 7,
},
},
module => 'Carp',
reason => 'has already been used and should be removed',
},
'lint failure as JSON'
);
is( $exit, 1, 'exit code is error' );
};
subtest '--log-filename' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Perl::Critic::Utils qw( $QUOTE );
my %foo = (
$QUOTE => q{description},
);
EOF
my $file = Path::Tiny->tempfile;
local @ARGV = (
'-f' => 'test-data/var-in-hash-key.pl',
'--log-filename' => "$file",
'--log-level' => 'info',
'--no-config-file',
);
my $cli = App::perlimports::CLI->new;
my ($stdout) = capture {
$cli->run;
};
is( $stdout, $expected, 'parses filename' );
ok( $file->lines, 'something was logged to file' );
};
subtest 'no filename' => sub {
local @ARGV = ();
my $cli = App::perlimports::CLI->new;
my ( undef, $stderr ) = capture {
$cli->run;
};
like(
$stderr, qr{Mandatory parameter 'filename' missing},
'filename missing'
);
};
subtest '--json without --lint' => sub {
local @ARGV = ( '--json', 'test-data/var-in-hash-key.pl' );
my $cli = App::perlimports::CLI->new;
my ( undef, $stderr ) = capture {
$cli->run;
};
like(
$stderr, qr{--json can only be used with --lint},
'meaningless --json flag'
);
};
subtest '--lint with -i' => sub {
local @ARGV = ( '--lint', '-i', 'test-data/var-in-hash-key.pl' );
my $cli = App::perlimports::CLI->new;
my ( undef, $stderr ) = capture {
$cli->run;
};
like(
$stderr, qr{Cannot lint if inplace edit has been enabled},
'trying to edit and lint at once'
);
};
subtest '--ignore-modules' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Perl::Critic::Utils;
my %foo = (
$QUOTE => q{description},
);
EOF
local @ARGV = (
'--no-config-file',
'--ignore-modules' => 'Perl::Critic::Utils',
'-f' => 'test-data/var-in-hash-key.pl',
);
my $cli = App::perlimports::CLI->new;
my ($stdout) = capture { $cli->run };
is( $stdout, $expected, 'stdout' );
};
subtest '--ignore-modules-pattern' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Perl::Critic::Utils;
my %foo = (
$QUOTE => q{description},
);
EOF
local @ARGV = (
'--no-config-file',
'--ignore-modules-pattern' => '^Perl::.*',
'-f' => 'test-data/var-in-hash-key.pl',
);
my $cli = App::perlimports::CLI->new;
my ($stdout) = capture { $cli->run };
is( $stdout, $expected, 'stdout' );
};
subtest '--never-export-modules' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Perl::Critic::Utils ();
my %foo = (
$QUOTE => q{description},
);
EOF
local @ARGV = (
'--no-config-file',
'--never-export-modules' => 'Perl::Critic::Utils',
'-f' => 'test-data/var-in-hash-key.pl',
);
my $cli = App::perlimports::CLI->new;
my ($stdout) = capture { $cli->run };
is( $stdout, $expected, 'stdout' );
};
subtest '--no-padding' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Perl::Critic::Utils qw($QUOTE);
my %foo = (
$QUOTE => q{description},
);
EOF
local @ARGV = (
'--no-config-file',
'--no-padding',
'-f' => 'test-data/var-in-hash-key.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
is( $stderr, q{}, 'no STDERR' );
is( $stdout, $expected, 'stdout' );
};
subtest '--stdout' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Local::STDOUT ();
BEGIN {
print "perlimports should trap this";
}
EOF
local @ARGV = (
'--no-config-file',
'--libs' => 'test-data/lib',
'-f' => 'test-data/stdout.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
is( $stderr, q{}, 'no STDERR' );
eq_or_diff( $stdout, $expected );
};
subtest 'range without end' => sub {
local @ARGV = (
'--range-begin', 1,
'test-data/stdout.pl',
);
my $expected = 'You must supply both range_begin and range_end';
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
is( $stdout, q{}, 'no STDOUT' );
chomp($stderr);
eq_or_diff( $stderr, $expected );
};
subtest 'range without begin' => sub {
local @ARGV = (
'--range-end', 1,
'test-data/stdout.pl',
);
my $expected = 'You must supply both range_begin and range_end';
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
is( $stdout, q{}, 'no STDOUT' );
chomp($stderr);
eq_or_diff( $stderr, $expected );
};
subtest 'range without --read-stdin' => sub {
local @ARGV = (
'--range-begin', 1,
'--range-end', 1,
'test-data/stdout.pl',
);
my $expected = 'You must specify --read-stdin if you provide a range';
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
is( $stdout, q{}, 'no STDOUT' );
chomp($stderr);
eq_or_diff( $stderr, $expected );
};
subtest 'range correct' => sub {
local @ARGV = (
'--range-begin', 1,
'--range-end', 1,
'--read-stdin',
'test-data/stdout.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
eq_or_diff( $stderr, q{}, 'no STDERR' );
eq_or_diff( $stdout, 'use strict;', 'range returned on STDOUT' );
};
subtest 'entire document range' => sub {
local @ARGV = (
'--range-begin', 1,
'--range-end', 8,
'--read-stdin',
'test-data/stdout.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
my $expected = <<'EOF';
use strict;
use warnings;
BEGIN {
print "perlimports should trap this";
}
EOF
chomp $expected;
eq_or_diff( $stderr, q{}, 'no STDERR' );
eq_or_diff( $stdout, $expected, 'range returned on STDOUT' );
};
subtest 'STDIN without document range' => sub {
local @ARGV = (
'--read-stdin',
'--filename', 'test-data/stdout.pl',
);
my $cli = App::perlimports::CLI->new;
my ( $stdout, $stderr ) = capture { $cli->run };
my $expected = <<'EOF';
use strict;
use warnings;
BEGIN {
print "perlimports should trap this";
}
EOF
eq_or_diff( $stderr, q{}, 'no STDERR' );
eq_or_diff( $stdout, $expected, 'range returned on STDOUT' );
};
done_testing();
moo.t 100755 001750 001751 2343 15176664014 15405 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 'test-data/lib', 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is subtest )];
use Test::Needs qw( Import::Into );
subtest 'Moo' => sub {
my ($doc) = doc(
filename => 'test-data/lib/Local/UsesMoo.pm',
selection => 'use Moo;'
);
is(
$doc->tidied_document,
'use Moo;',
'document unchanged'
);
};
subtest 'Import::Into' => sub {
my ($doc) = doc(
filename => 'test-data/lib/Local/MyOwnMoo.pm',
preserve_unused => 0,
);
my $expected = <<'EOF';
package Local::MyOwnMoo;
use strict;
use warnings;
use Import::Into;
sub import {
$_->import::into( scalar caller ) for qw( Moo );
}
1;
EOF
is(
$doc->tidied_document,
$expected,
'tidied_document'
);
};
subtest 'Uses MyOwnMoo' => sub {
my ($doc) = doc(
filename => 'test-data/lib/Local/UsesMyOwnMoo.pm',
preserve_unused => 0,
);
my $expected = <<'EOF';
package Local::UsesMyOwnMoo;
use strict;
use warnings;
use Local::MyOwnMoo;
1;
EOF
is(
$doc->tidied_document,
$expected,
'tidied_document'
);
};
done_testing();
tie.t 100644 001750 001751 654 15176664014 15354 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use Path::Tiny qw( path );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is $TODO )];
my $filename = 'test-data/tie.pl';
my ($doc) = doc(
filename => $filename,
preserve_unused => 0,
);
TODO: {
local $TODO = 'Cannot yet see packages used by tie';
is( $doc->tidied_document, path($filename)->slurp, 'tie observed' );
}
done_testing();
cpanfile 100644 001750 001751 6246 15176664014 15672 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 # This file is generated by Dist::Zilla::Plugin::CPANFile v6.037
# Do not edit this file directly. To change prereqs, edit the `dist.ini` file.
requires "Capture::Tiny" => "0";
requires "Class::Inspector" => "1.36";
requires "Cpanel::JSON::XS" => "0";
requires "Data::Dumper" => "0";
requires "Data::UUID" => "0";
requires "File::Basename" => "0";
requires "File::XDG" => "1.01";
requires "Getopt::Long::Descriptive" => "0";
requires "List::Util" => "0";
requires "Log::Dispatch" => "2.70";
requires "Memoize" => "0";
requires "Module::Runtime" => "0";
requires "Moo" => "0";
requires "Moo::Role" => "0";
requires "MooX::StrictConstructor" => "0";
requires "PPI" => "1.276";
requires "PPI::Document" => "0";
requires "PPIx::Utils::Classification" => "0";
requires "PPIx::Utils::Traversal" => "0";
requires "Path::Iterator::Rule" => "0";
requires "Path::Tiny" => "0";
requires "Perl::Tidy" => "20220613";
requires "Pod::Usage" => "0";
requires "Ref::Util" => "0";
requires "Scalar::Util" => "0";
requires "Sereal::Decoder" => "0";
requires "Sereal::Encoder" => "0";
requires "Sub::HandlesVia" => "0";
requires "Symbol::Get" => "0.10";
requires "TOML::Tiny" => "0.16";
requires "Text::Diff" => "0";
requires "Text::SimpleTable::AutoWidth" => "0";
requires "Try::Tiny" => "0";
requires "Types::Common::Numeric" => "0";
requires "Types::Standard" => "0";
requires "feature" => "0";
requires "perl" => "v5.18.0";
requires "strict" => "0";
requires "utf8" => "0";
requires "warnings" => "0";
on 'test' => sub {
requires "ExtUtils::MakeMaker" => "0";
requires "File::Spec" => "0";
requires "File::pushd" => "0";
requires "Log::Dispatch::Array" => "0";
requires "PPI::Dumper" => "0";
requires "Sub::Exporter" => "0";
requires "Test::Differences" => "0";
requires "Test::Fatal" => "0";
requires "Test::More" => "0";
requires "Test::Needs" => "0";
requires "Test::RequiresInternet" => "0";
requires "Test::Script" => "1.29";
requires "Test::Warnings" => "0";
requires "lib" => "0";
requires "perl" => "v5.18.0";
};
on 'test' => sub {
recommends "CPAN::Meta" => "2.120900";
};
on 'configure' => sub {
requires "ExtUtils::MakeMaker" => "0";
requires "perl" => "5.010";
};
on 'develop' => sub {
requires "Code::TidyAll" => "0.71";
requires "Code::TidyAll::Plugin::SortLines::Naturally" => "0.000003";
requires "Code::TidyAll::Plugin::Test::Vars" => "0.04";
requires "Code::TidyAll::Plugin::UniqueLines" => "0.000003";
requires "Parallel::ForkManager" => "1.19";
requires "Perl::Critic" => "1.132";
requires "Perl::Critic::Policy::ValuesAndExpressions::ProhibitAccessOfPrivateData" => "v1.0.0";
requires "Perl::Tidy" => "20180220";
requires "Pod::Coverage::TrustPod" => "0";
requires "Pod::Wordlist" => "0";
requires "Test::CPAN::Changes" => "0.19";
requires "Test::EOL" => "0";
requires "Test::Mojibake" => "0";
requires "Test::More" => "0.96";
requires "Test::Pod" => "1.41";
requires "Test::Pod::Coverage" => "1.08";
requires "Test::Portability::Files" => "0";
requires "Test::Spelling" => "0.17";
requires "Test::Vars" => "0.014";
requires "Test::Version" => "1";
};
on 'develop' => sub {
recommends "Dist::Zilla::PluginBundle::Git::VersionManager" => "0.007";
};
META.yml 100644 001750 001751 45424 15176664014 15460 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 ---
abstract: 'Make implicit imports explicit'
author:
- 'Olaf Alders '
build_requires:
ExtUtils::MakeMaker: '0'
File::Spec: '0'
File::pushd: '0'
Log::Dispatch::Array: '0'
PPI::Dumper: '0'
Sub::Exporter: '0'
Test::Differences: '0'
Test::Fatal: '0'
Test::More: '0'
Test::Needs: '0'
Test::RequiresInternet: '0'
Test::Script: '1.29'
Test::Warnings: '0'
lib: '0'
perl: v5.18.0
configure_requires:
ExtUtils::MakeMaker: '0'
perl: '5.010'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.037, CPAN::Meta::Converter version 2.150013'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: App-perlimports
no_index:
directory:
- examples
- t
- test-data
- xt
requires:
Capture::Tiny: '0'
Class::Inspector: '1.36'
Cpanel::JSON::XS: '0'
Data::Dumper: '0'
Data::UUID: '0'
File::Basename: '0'
File::XDG: '1.01'
Getopt::Long::Descriptive: '0'
List::Util: '0'
Log::Dispatch: '2.70'
Memoize: '0'
Module::Runtime: '0'
Moo: '0'
Moo::Role: '0'
MooX::StrictConstructor: '0'
PPI: '1.276'
PPI::Document: '0'
PPIx::Utils::Classification: '0'
PPIx::Utils::Traversal: '0'
Path::Iterator::Rule: '0'
Path::Tiny: '0'
Perl::Tidy: '20220613'
Pod::Usage: '0'
Ref::Util: '0'
Scalar::Util: '0'
Sereal::Decoder: '0'
Sereal::Encoder: '0'
Sub::HandlesVia: '0'
Symbol::Get: '0.10'
TOML::Tiny: '0.16'
Text::Diff: '0'
Text::SimpleTable::AutoWidth: '0'
Try::Tiny: '0'
Types::Common::Numeric: '0'
Types::Standard: '0'
feature: '0'
perl: v5.18.0
strict: '0'
utf8: '0'
warnings: '0'
resources:
bugtracker: https://github.com/perl-ide/App-perlimports/issues
homepage: https://github.com/perl-ide/App-perlimports
repository: https://github.com/perl-ide/App-perlimports.git
version: '0.000060'
x_Dist_Zilla:
perl:
version: '5.042002'
plugins:
-
class: Dist::Zilla::Plugin::PromptIfStale
config:
Dist::Zilla::Plugin::PromptIfStale:
check_all_plugins: 0
check_all_prereqs: 0
modules:
- Dist::Zilla::PluginBundle::Author::OALDERS
phase: build
run_under_travis: 0
skip: []
name: '@Author::OALDERS/stale modules, build'
version: '0.060'
-
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: []
name: '@Author::OALDERS/stale modules, release'
version: '0.060'
-
class: Dist::Zilla::Plugin::AutoPrereqs
name: '@Author::OALDERS/AutoPrereqs'
version: '6.037'
-
class: Dist::Zilla::Plugin::CheckChangesHasContent
name: '@Author::OALDERS/CheckChangesHasContent'
version: '0.011'
-
class: Dist::Zilla::Plugin::MakeMaker
config:
Dist::Zilla::Role::TestRunner:
default_jobs: '8'
name: '@Author::OALDERS/MakeMaker'
version: '6.037'
-
class: Dist::Zilla::Plugin::CPANFile
name: '@Author::OALDERS/CPANFile'
version: '6.037'
-
class: Dist::Zilla::Plugin::ContributorsFile
name: '@Author::OALDERS/ContributorsFile'
version: 0.4.0
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@Author::OALDERS/MetaJSON'
version: '6.037'
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@Author::OALDERS/MetaYAML'
version: '6.037'
-
class: Dist::Zilla::Plugin::Manifest
name: '@Author::OALDERS/Manifest'
version: '6.037'
-
class: Dist::Zilla::Plugin::MetaNoIndex
name: '@Author::OALDERS/MetaNoIndex'
version: '6.037'
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@Author::OALDERS/MetaConfig'
version: '6.037'
-
class: Dist::Zilla::Plugin::MetaResources
name: '@Author::OALDERS/MetaResources'
version: '6.037'
-
class: Dist::Zilla::Plugin::License
name: '@Author::OALDERS/License'
version: '6.037'
-
class: Dist::Zilla::Plugin::InstallGuide
config:
Dist::Zilla::Role::ModuleMetadata:
Module::Metadata: '1.000038'
version: '0.006'
name: '@Author::OALDERS/InstallGuide'
version: '1.200014'
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: develop
type: requires
name: '@Author::OALDERS/Modules for use with tidyall'
version: '6.037'
-
class: Dist::Zilla::Plugin::ExecDir
name: '@Author::OALDERS/ExecDir'
version: '6.037'
-
class: Dist::Zilla::Plugin::Test::PodSpelling
config:
Dist::Zilla::Plugin::Test::PodSpelling:
directories:
- bin
- lib
spell_cmd: ''
stopwords:
- Alders
- "Alders'"
- PPI
- sandboxed
wordlist: Pod::Wordlist
name: '@Author::OALDERS/Test::PodSpelling'
version: '2.007006'
-
class: Dist::Zilla::Plugin::MojibakeTests
name: '@Author::OALDERS/MojibakeTests'
version: '0.8'
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: '@Author::OALDERS/PodSyntaxTests'
version: '6.037'
-
class: Dist::Zilla::Plugin::Test::CPAN::Changes
config:
Dist::Zilla::Plugin::Test::CPAN::Changes:
changelog: Changes
filename: xt/release/cpan-changes.t
name: '@Author::OALDERS/Test::CPAN::Changes'
version: '0.013'
-
class: Dist::Zilla::Plugin::Test::EOL
config:
Dist::Zilla::Plugin::Test::EOL:
filename: xt/author/eol.t
finder:
- ':ExecFiles'
- ':InstallModules'
- ':TestFiles'
trailing_whitespace: 1
name: '@Author::OALDERS/Test::EOL'
version: '0.19'
-
class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable
name: '@Author::OALDERS/Test::Pod::Coverage::Configurable'
version: '0.07'
-
class: Dist::Zilla::Plugin::Test::Portability
config:
Dist::Zilla::Plugin::Test::Portability:
options: ''
name: '@Author::OALDERS/Test::Portability'
version: '2.001003'
-
class: Dist::Zilla::Plugin::TestRelease
name: '@Author::OALDERS/TestRelease'
version: '6.037'
-
class: Dist::Zilla::Plugin::Test::ReportPrereqs
name: '@Author::OALDERS/Test::ReportPrereqs'
version: '0.029'
-
class: Dist::Zilla::Plugin::Test::Version
name: '@Author::OALDERS/Test::Version'
version: '1.09'
-
class: Dist::Zilla::Plugin::RunExtraTests
config:
Dist::Zilla::Role::TestRunner:
default_jobs: '8'
name: '@Author::OALDERS/RunExtraTests'
version: '0.029'
-
class: Dist::Zilla::Plugin::MinimumPerl
name: '@Author::OALDERS/MinimumPerl'
version: '1.006'
-
class: Dist::Zilla::Plugin::PodWeaver
config:
Dist::Zilla::Plugin::PodWeaver:
finder:
- ':InstallModules'
- ':PerlExecFiles'
plugins:
-
class: Pod::Weaver::Plugin::EnsurePod5
name: '@CorePrep/EnsurePod5'
version: '4.020'
-
class: Pod::Weaver::Plugin::H1Nester
name: '@CorePrep/H1Nester'
version: '4.020'
-
class: Pod::Weaver::Plugin::SingleEncoding
name: '@Default/SingleEncoding'
version: '4.020'
-
class: Pod::Weaver::Section::Name
name: '@Default/Name'
version: '4.020'
-
class: Pod::Weaver::Section::Version
name: '@Default/Version'
version: '4.020'
-
class: Pod::Weaver::Section::Region
name: '@Default/prelude'
version: '4.020'
-
class: Pod::Weaver::Section::Generic
name: SYNOPSIS
version: '4.020'
-
class: Pod::Weaver::Section::Generic
name: DESCRIPTION
version: '4.020'
-
class: Pod::Weaver::Section::Generic
name: OVERVIEW
version: '4.020'
-
class: Pod::Weaver::Section::Collect
name: ATTRIBUTES
version: '4.020'
-
class: Pod::Weaver::Section::Collect
name: METHODS
version: '4.020'
-
class: Pod::Weaver::Section::Collect
name: FUNCTIONS
version: '4.020'
-
class: Pod::Weaver::Section::Leftovers
name: '@Default/Leftovers'
version: '4.020'
-
class: Pod::Weaver::Section::Region
name: '@Default/postlude'
version: '4.020'
-
class: Pod::Weaver::Section::Authors
name: '@Default/Authors'
version: '4.020'
-
class: Pod::Weaver::Section::Legal
name: '@Default/Legal'
version: '4.020'
name: '@Author::OALDERS/PodWeaver'
version: '4.010'
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@Author::OALDERS/PruneCruft'
version: '6.037'
-
class: Dist::Zilla::Plugin::CopyFilesFromBuild
name: '@Author::OALDERS/CopyFilesFromBuild'
version: '0.170880'
-
class: Dist::Zilla::Plugin::GithubMeta
name: '@Author::OALDERS/GithubMeta'
version: '0.58'
-
class: Dist::Zilla::Plugin::Git::GatherDir
config:
Dist::Zilla::Plugin::GatherDir:
exclude_filename:
- Install
- LICENSE
- META.json
- Makefile.PL
- README.md
- cpanfile
exclude_match: []
include_dotfiles: 0
prefix: ''
prune_directory: []
root: .
Dist::Zilla::Plugin::Git::GatherDir:
include_untracked: 0
name: '@Author::OALDERS/Git::GatherDir'
version: '2.052'
-
class: Dist::Zilla::Plugin::CopyFilesFromRelease
config:
Dist::Zilla::Plugin::CopyFilesFromRelease:
filename:
- Install
match: []
name: '@Author::OALDERS/CopyFilesFromRelease'
version: '0.007'
-
class: Dist::Zilla::Plugin::Git::Check
config:
Dist::Zilla::Plugin::Git::Check:
untracked_files: die
Dist::Zilla::Role::Git::DirtyFiles:
allow_dirty:
- Changes
- Install
- LICENSE
- META.json
- Makefile.PL
- README.md
- cpanfile
- dist.ini
allow_dirty_match: []
changelog: Changes
Dist::Zilla::Role::Git::Repo:
git_version: 2.43.0
repo_root: .
name: '@Author::OALDERS/Git::Check'
version: '2.052'
-
class: Dist::Zilla::Plugin::Git::Contributors
config:
Dist::Zilla::Plugin::Git::Contributors:
git_version: 2.43.0
include_authors: 0
include_releaser: 1
order_by: name
paths: []
name: '@Author::OALDERS/Git::Contributors'
version: '0.039'
-
class: Dist::Zilla::Plugin::ReadmeAnyFromPod
config:
Dist::Zilla::Role::FileWatcher:
version: '0.006'
name: '@Author::OALDERS/ReadmeMdInBuild'
version: '0.163250'
-
class: Dist::Zilla::Plugin::StaticInstall
config:
Dist::Zilla::Plugin::StaticInstall:
dry_run: 0
mode: on
name: '@Author::OALDERS/StaticInstall'
version: '0.012'
-
class: Dist::Zilla::Plugin::ShareDir
name: '@Author::OALDERS/ShareDir'
version: '6.037'
-
class: Dist::Zilla::Plugin::CheckIssues
name: '@Author::OALDERS/CheckIssues'
version: '0.011'
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@Author::OALDERS/ConfirmRelease'
version: '6.037'
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@Author::OALDERS/UploadToCPAN'
version: '6.037'
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: develop
type: recommends
name: '@Author::OALDERS/@Git::VersionManager/pluginbundle version'
version: '6.037'
-
class: Dist::Zilla::Plugin::RewriteVersion::Transitional
config:
Dist::Zilla::Plugin::RewriteVersion:
add_tarball_name: 0
finders:
- ':ExecFiles'
- ':InstallModules'
global: 0
skip_version_provider: 0
Dist::Zilla::Plugin::RewriteVersion::Transitional: {}
name: '@Author::OALDERS/@Git::VersionManager/RewriteVersion::Transitional'
version: '0.009'
-
class: Dist::Zilla::Plugin::MetaProvides::Update
name: '@Author::OALDERS/@Git::VersionManager/MetaProvides::Update'
version: '0.007'
-
class: Dist::Zilla::Plugin::CopyFilesFromRelease
config:
Dist::Zilla::Plugin::CopyFilesFromRelease:
filename:
- Changes
match: []
name: '@Author::OALDERS/@Git::VersionManager/CopyFilesFromRelease'
version: '0.007'
-
class: Dist::Zilla::Plugin::Git::Commit
config:
Dist::Zilla::Plugin::Git::Commit:
add_files_in: []
commit_msg: v%V%n%n%c
signoff: 0
Dist::Zilla::Role::Git::DirtyFiles:
allow_dirty:
- Changes
- Install
- LICENSE
- META.json
- Makefile.PL
- README.md
- cpanfile
- dist.ini
allow_dirty_match: []
changelog: Changes
Dist::Zilla::Role::Git::Repo:
git_version: 2.43.0
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
name: '@Author::OALDERS/@Git::VersionManager/release snapshot'
version: '2.052'
-
class: Dist::Zilla::Plugin::Git::Tag
config:
Dist::Zilla::Plugin::Git::Tag:
branch: ~
changelog: Changes
signed: 0
tag: v0.000060
tag_format: v%V
tag_message: v%V
Dist::Zilla::Role::Git::Repo:
git_version: 2.43.0
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
name: '@Author::OALDERS/@Git::VersionManager/Git::Tag'
version: '2.052'
-
class: Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional
config:
Dist::Zilla::Plugin::BumpVersionAfterRelease:
finders:
- ':ExecFiles'
- ':InstallModules'
global: 0
munge_makefile_pl: 1
Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional: {}
name: '@Author::OALDERS/@Git::VersionManager/BumpVersionAfterRelease::Transitional'
version: '0.009'
-
class: Dist::Zilla::Plugin::NextRelease
name: '@Author::OALDERS/@Git::VersionManager/NextRelease'
version: '6.037'
-
class: Dist::Zilla::Plugin::Git::Commit
config:
Dist::Zilla::Plugin::Git::Commit:
add_files_in: []
commit_msg: 'increment $VERSION after %v release'
signoff: 0
Dist::Zilla::Role::Git::DirtyFiles:
allow_dirty:
- Build.PL
- Changes
- Makefile.PL
allow_dirty_match:
- (?^:^lib/.*\.pm$)
changelog: Changes
Dist::Zilla::Role::Git::Repo:
git_version: 2.43.0
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
name: '@Author::OALDERS/@Git::VersionManager/post-release commit'
version: '2.052'
-
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.43.0
repo_root: .
name: '@Author::OALDERS/Git::Push'
version: '2.052'
-
class: Dist::Zilla::Plugin::PruneFiles
name: PruneFiles
version: '6.037'
-
class: Dist::Zilla::Plugin::GitHubREADME::Badge
name: GitHubREADME::Badge
version: '0.35'
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: runtime
type: requires
name: RuntimeRequires
version: '6.037'
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: test
type: requires
name: TestRequires
version: '6.037'
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: develop
type: requires
name: DevelopRequires
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':IncModules'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExtraTestFiles'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':PerlExecFiles'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':MainModule'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':AllFiles'
version: '6.037'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':NoFiles'
version: '6.037'
zilla:
class: Dist::Zilla::Dist::Builder
config:
is_trial: 0
version: '6.037'
x_contributors:
- 'copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>'
- 'dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>'
- 'E. Choroba '
- 'James Raspass '
- 'José Manuel Rodríguez D '
- 'Kenichi Ishigaki '
- 'Nelo Onyiah '
- 'Nicolas Mendoza '
- 'Olaf Alders '
- 'Paul Johnson '
- 'Peter Oliver '
- 'pyrrhlin <1197072+myrrhlin@users.noreply.github.com>'
x_generated_by_perl: v5.42.2
x_serialization_backend: 'YAML::Tiny version 1.76'
x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
x_static_install: 1
MANIFEST 100644 001750 001751 13466 15176664014 15341 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.037
CLAUDE.md
CONTRIBUTING.md
CONTRIBUTORS
Changes
INSTALL
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README.md
cpanfile
dist.ini
git/hooks/pre-commit
git/setup.sh
lib/App/perlimports.pm
lib/App/perlimports/Annotations.pm
lib/App/perlimports/CLI.pm
lib/App/perlimports/Config.pm
lib/App/perlimports/Document.pm
lib/App/perlimports/ExportInspector.pm
lib/App/perlimports/Include.pm
lib/App/perlimports/Role/Logger.pm
lib/App/perlimports/Sandbox.pm
perlcriticrc
perlimports.toml
perltidyrc
precious.toml
script/dump-perl-exports
script/perlimports
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/Config.t
t/Document.t
t/ExportInspector/SubExporter.t
t/ExportInspector/load.t
t/Sandbox.t
t/after.t
t/annotations.t
t/args-in-import.t
t/builtin.t
t/carp.t
t/cast-in-regex.t
t/cast.t
t/cli-args.t
t/cli.t
t/config-in-import.t
t/constants.t
t/cpan-modules/pithub.t
t/cpan-modules/test2-v0.t
t/datetime.t
t/do-block.t
t/doc-imports.t
t/double-quoted-q.t
t/dump-perl-exports.t
t/dupes.t
t/english.t
t/explodes.t
t/export-tags.t
t/exported-variables.t
t/find-bin.t
t/fully-qualified.t
t/func-in-use.t
t/func-in-var.t
t/function-reference.t
t/geo-ip.t
t/hash-in-regex.t
t/hash-key-expression.t
t/hash-key.t
t/hash-unquoted-key.t
t/heredoc.t
t/ignored-modules.t
t/import-error.t
t/indent.t
t/interpolation.t
t/is-ignored.t
t/lib/TestHelper.pm
t/locally-defined-sub.t
t/lookalike-words.t
t/maybe-new-include.t
t/memoize.t
t/meta.t
t/method.t
t/missing-semicolon-in-import.t
t/module-with-inner-packages.t
t/moo.t
t/moose-types.t
t/moose.t
t/moosex-types-moose.t
t/nested-quotes.t
t/never-exports.t
t/original-imports.t
t/pad-brackets.t
t/padding.t
t/perl-imports.t
t/perl.t
t/perlimports.t
t/pragma.t
t/preserve-some-padding.t
t/preserve-spaces.t
t/qualified-bareword.t
t/quoted-var.t
t/re-export-via-sub-exporter.t
t/regex-replacement.t
t/require.t
t/script-with-inner-packages.t
t/signatures.t
t/skip-all.t
t/socket.t
t/sort-imports.t
t/switches-in-import.t
t/symbol-as-method-call.t
t/symbol-in-export.t
t/test-builder.t
t/tie.t
t/typeglob.t
t/unnest-quotes.t
t/use-and-require.t
t/var-in-hash-key.t
t/var-in-regex.t
t/variable.t
t/via-sub-exporter-exception.pl
t/warning.t
t/with-version.t
test-data/a.pl
test-data/annotate-everything.pl
test-data/annotation.pl
test-data/args-in-import.t
test-data/b.pl
test-data/builtin.pl
test-data/carp-with-no-imports.pl
test-data/carp-without-verbose.pl
test-data/carp.pl
test-data/cast-in-regex.pl
test-data/cast.pl
test-data/config-in-import.pl
test-data/datetime.pl
test-data/doc-imports.pl
test-data/double-quoted-q.pl
test-data/dupes.pl
test-data/english.pl
test-data/exceptional.pl
test-data/explodes.pl
test-data/export-tags.pl
test-data/exported-variables.pl
test-data/filter-paths/Foo.pl
test-data/filter-paths/Foo.pm
test-data/filter-paths/foo
test-data/filter-paths/foo.py
test-data/filter-paths/foo.t
test-data/filter-paths/foo.txt
test-data/find-bin.pl
test-data/foo.pl
test-data/foo.t
test-data/fully-qualified.pl
test-data/func-in-use-2.pl
test-data/func-in-use.pl
test-data/func-in-var.pl
test-data/function-reference.pl
test-data/geo-ip.pl
test-data/getopt-long.pl
test-data/getopt.pl
test-data/hash-in-regex.pl
test-data/hash-key-expression.pl
test-data/hash-unquoted-key.pl
test-data/heredoc.pl
test-data/http-status.pl
test-data/ignore-modules-pattern.txt
test-data/ignore-modules.txt
test-data/inner-package.pl
test-data/interpolation.pl
test-data/lib/Local/After.pm
test-data/lib/Local/CustomImport.pm
test-data/lib/Local/Explodes.pm
test-data/lib/Local/ImportException.pm
test-data/lib/Local/LongList.pm
test-data/lib/Local/MooseTypeLibrary.pm
test-data/lib/Local/MyOwnMoo.pm
test-data/lib/Local/MyOwnMoose.pm
test-data/lib/Local/ReExportViaSubExporter.pm
test-data/lib/Local/RequireExporter.pm
test-data/lib/Local/Round.pm
test-data/lib/Local/STDOUT.pm
test-data/lib/Local/Sort.pm
test-data/lib/Local/SymbolInExport.pm
test-data/lib/Local/UsesMoo.pm
test-data/lib/Local/UsesMoose.pm
test-data/lib/Local/UsesMyOwnMoo.pm
test-data/lib/Local/UsesMyOwnMoose.pm
test-data/lib/Local/UsesTypesStandard.pm
test-data/lib/Local/UsesUsesImportInto.pm
test-data/lib/Local/ViaExporter.pm
test-data/lib/Local/ViaSubExporter.pm
test-data/lib/Local/ViaSubExporter/Exception.pm
test-data/lib/Local/WithInnerPkg.pm
test-data/lint-failure-duplicate-import.pl
test-data/lint-failure-import-args.pl
test-data/lint-failure-unused-import.pl
test-data/lint-success.pl
test-data/long-list.pl
test-data/long-test-more.pl
test-data/lookalike-words.pl
test-data/messy-imports.pl
test-data/meta.t
test-data/method.pl
test-data/missing-semicolon-in-import.pl
test-data/mojo-url.pl
test-data/moosex-types-moose.pl
test-data/more-find-bin.pl
test-data/nested-quotes.pl
test-data/never-export-modules.txt
test-data/noop.t
test-data/original-imports.pl
test-data/pack-qq.pl
test-data/perl-version.pl
test-data/perlimports.toml
test-data/pithub.pl
test-data/pragma.t
test-data/preserve-some-padding.pl
test-data/preserve-spaces.pl
test-data/qualified-bareword.pl
test-data/quoted-var.pl
test-data/regex-replacement.pl
test-data/require.pl
test-data/same-import.pl
test-data/signatures.pl
test-data/skip-all.t
test-data/socket.pl
test-data/sort.pl
test-data/stdout.pl
test-data/switches-in-import.pl
test-data/symbol-as-method-call.pl
test-data/symbol-in-signature.pl
test-data/test-html-lint.t
test-data/test-more.t
test-data/tie.pl
test-data/typeglob.pl
test-data/unnest-quotes.pl
test-data/use-and-require.pl
test-data/use-constant.pm
test-data/var-in-hash-key.pl
test-data/var-in-regex.pl
test-data/variable.pl
test-data/various-quote-strings.pl
test-data/via-exporter.pl
test-data/via-sub-exporter-exception.pl
test-data/with-version.pl
test-needs-cpanfile
xt/author/eol.t
xt/author/mojibake.t
xt/author/pod-coverage.t
xt/author/pod-spell.t
xt/author/pod-syntax.t
xt/author/portability.t
xt/author/test-version.t
xt/release/cpan-changes.t
dist.ini 100644 001750 001751 2121 15176664014 15616 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 name = App-perlimports
author = Olaf Alders
license = Perl_5
copyright_holder = Olaf Alders
copyright_year = 2020
main_module = lib/App/perlimports.pm
[@Author::OALDERS]
MetaNoIndex.directory[] = test-data
StaticInstall.mode = on
StaticInstall.dry_run = 0
Test::Pod::Coverage::Configurable.also_private = qr/(BUILD|BUILDARGS)/
Test::Pod::Coverage::Configurable.trustme = App::perlimports::Role::Logger => qr/.*/
-remove = Test::Synopsis
-remove = Test::TidyAll
[PruneFiles]
match = ^author/
match = ^inc/
[GitHubREADME::Badge]
badges = github_actions/dzil-build-and-test.yml
badges = codecov
badges = cpants
badges = github_tag
badges = license
place = top
phase = build
[Prereqs / RuntimeRequires]
Class::Inspector = 1.36
File::XDG = 1.01
Log::Dispatch = 2.70
perl = 5.18.0
Perl::Tidy = 20220613
PPI = 1.276
Symbol::Get = 0.10
TOML::Tiny = 0.16
; Mostly needed for files in ./test-data
[Prereqs / TestRequires]
Test::RequiresInternet = 0
Test::Script = 1.29
[Prereqs / DevelopRequires]
Perl::Critic::Policy::ValuesAndExpressions::ProhibitAccessOfPrivateData = v1.0.0
carp.t 100755 001750 001751 2511 15176664014 15535 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is_deeply subtest )];
subtest 'verbose' => sub {
my ($doc) = doc( filename => 'test-data/carp.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Carp qw( croak verbose );
croak('oof');
EOF
eq_or_diff(
$doc->tidied_document,
$expected,
'verbose is preserved'
);
};
subtest 'no verbose' => sub {
my ($doc) = doc( filename => 'test-data/carp-without-verbose.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Carp qw( croak );
croak('oof');
EOF
eq_or_diff(
$doc->tidied_document,
$expected,
'verbose is not inserted'
);
};
subtest 'no imports' => sub {
my ($doc) = doc( filename => 'test-data/carp-with-no-imports.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Carp qw( croak );
croak('oof');
EOF
is_deeply(
$doc->found_imports->{Carp},
undef,
'found imports'
);
eq_or_diff(
$doc->tidied_document,
$expected,
'verbose is not inserted'
);
is_deeply(
$doc->found_imports,
{ Carp => ['croak'] },
'found imports updated'
);
};
done_testing();
cast.t 100755 001750 001751 564 15176664014 15530 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( Mojo::Util );
my ($doc) = doc(
filename => 'test-data/cast.pl',
selection => 'use Mojo::Util;',
);
is(
$doc->tidied_document,
'use Mojo::Util qw( split_header );',
'interpolated func found'
);
done_testing;
meta.t 100755 001750 001751 656 15176664014 15526 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( Test2::V0 );
my ($doc) = doc(
filename => 'test-data/meta.t',
);
my $expected = <<'EOF';
use strict;
use warnings;
use Test2::V0 qw( !meta done_testing ok );
ok(1);
done_testing;
EOF
is(
$doc->tidied_document,
$expected,
'!meta preserved in import'
);
done_testing;
perl.t 100644 001750 001751 522 15176664014 15527 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
my ($doc) = doc( filename => 'test-data/perl-version.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use 5.008001;
EOF
is( $doc->tidied_document, $expected, 'perl use statement ignored' );
done_testing();
META.json 100644 001750 001751 73257 15176664014 15635 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 {
"abstract" : "Make implicit imports explicit",
"author" : [
"Olaf Alders "
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.037, CPAN::Meta::Converter version 2.150013",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "App-perlimports",
"no_index" : {
"directory" : [
"examples",
"t",
"test-data",
"xt"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0",
"perl" : "5.010"
}
},
"develop" : {
"recommends" : {
"Dist::Zilla::PluginBundle::Git::VersionManager" : "0.007"
},
"requires" : {
"Code::TidyAll" : "0.71",
"Code::TidyAll::Plugin::SortLines::Naturally" : "0.000003",
"Code::TidyAll::Plugin::Test::Vars" : "0.04",
"Code::TidyAll::Plugin::UniqueLines" : "0.000003",
"Parallel::ForkManager" : "1.19",
"Perl::Critic" : "1.132",
"Perl::Critic::Policy::ValuesAndExpressions::ProhibitAccessOfPrivateData" : "v1.0.0",
"Perl::Tidy" : "20180220",
"Pod::Coverage::TrustPod" : "0",
"Pod::Wordlist" : "0",
"Test::CPAN::Changes" : "0.19",
"Test::EOL" : "0",
"Test::Mojibake" : "0",
"Test::More" : "0.96",
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08",
"Test::Portability::Files" : "0",
"Test::Spelling" : "0.17",
"Test::Vars" : "0.014",
"Test::Version" : "1"
}
},
"runtime" : {
"requires" : {
"Capture::Tiny" : "0",
"Class::Inspector" : "1.36",
"Cpanel::JSON::XS" : "0",
"Data::Dumper" : "0",
"Data::UUID" : "0",
"File::Basename" : "0",
"File::XDG" : "1.01",
"Getopt::Long::Descriptive" : "0",
"List::Util" : "0",
"Log::Dispatch" : "2.70",
"Memoize" : "0",
"Module::Runtime" : "0",
"Moo" : "0",
"Moo::Role" : "0",
"MooX::StrictConstructor" : "0",
"PPI" : "1.276",
"PPI::Document" : "0",
"PPIx::Utils::Classification" : "0",
"PPIx::Utils::Traversal" : "0",
"Path::Iterator::Rule" : "0",
"Path::Tiny" : "0",
"Perl::Tidy" : "20220613",
"Pod::Usage" : "0",
"Ref::Util" : "0",
"Scalar::Util" : "0",
"Sereal::Decoder" : "0",
"Sereal::Encoder" : "0",
"Sub::HandlesVia" : "0",
"Symbol::Get" : "0.10",
"TOML::Tiny" : "0.16",
"Text::Diff" : "0",
"Text::SimpleTable::AutoWidth" : "0",
"Try::Tiny" : "0",
"Types::Common::Numeric" : "0",
"Types::Standard" : "0",
"feature" : "0",
"perl" : "v5.18.0",
"strict" : "0",
"utf8" : "0",
"warnings" : "0"
}
},
"test" : {
"recommends" : {
"CPAN::Meta" : "2.120900"
},
"requires" : {
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
"File::pushd" : "0",
"Log::Dispatch::Array" : "0",
"PPI::Dumper" : "0",
"Sub::Exporter" : "0",
"Test::Differences" : "0",
"Test::Fatal" : "0",
"Test::More" : "0",
"Test::Needs" : "0",
"Test::RequiresInternet" : "0",
"Test::Script" : "1.29",
"Test::Warnings" : "0",
"lib" : "0",
"perl" : "v5.18.0"
}
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/perl-ide/App-perlimports/issues"
},
"homepage" : "https://github.com/perl-ide/App-perlimports",
"repository" : {
"type" : "git",
"url" : "https://github.com/perl-ide/App-perlimports.git",
"web" : "https://github.com/perl-ide/App-perlimports"
}
},
"version" : "0.000060",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.042002"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::PromptIfStale",
"config" : {
"Dist::Zilla::Plugin::PromptIfStale" : {
"check_all_plugins" : 0,
"check_all_prereqs" : 0,
"modules" : [
"Dist::Zilla::PluginBundle::Author::OALDERS"
],
"phase" : "build",
"run_under_travis" : 0,
"skip" : []
}
},
"name" : "@Author::OALDERS/stale modules, build",
"version" : "0.060"
},
{
"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" : []
}
},
"name" : "@Author::OALDERS/stale modules, release",
"version" : "0.060"
},
{
"class" : "Dist::Zilla::Plugin::AutoPrereqs",
"name" : "@Author::OALDERS/AutoPrereqs",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::CheckChangesHasContent",
"name" : "@Author::OALDERS/CheckChangesHasContent",
"version" : "0.011"
},
{
"class" : "Dist::Zilla::Plugin::MakeMaker",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : "8"
}
},
"name" : "@Author::OALDERS/MakeMaker",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::CPANFile",
"name" : "@Author::OALDERS/CPANFile",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::ContributorsFile",
"name" : "@Author::OALDERS/ContributorsFile",
"version" : "0.4.0"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@Author::OALDERS/MetaJSON",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@Author::OALDERS/MetaYAML",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@Author::OALDERS/Manifest",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::MetaNoIndex",
"name" : "@Author::OALDERS/MetaNoIndex",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@Author::OALDERS/MetaConfig",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::MetaResources",
"name" : "@Author::OALDERS/MetaResources",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@Author::OALDERS/License",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::InstallGuide",
"config" : {
"Dist::Zilla::Role::ModuleMetadata" : {
"Module::Metadata" : "1.000038",
"version" : "0.006"
}
},
"name" : "@Author::OALDERS/InstallGuide",
"version" : "1.200014"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "develop",
"type" : "requires"
}
},
"name" : "@Author::OALDERS/Modules for use with tidyall",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@Author::OALDERS/ExecDir",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Test::PodSpelling",
"config" : {
"Dist::Zilla::Plugin::Test::PodSpelling" : {
"directories" : [
"bin",
"lib"
],
"spell_cmd" : "",
"stopwords" : [
"Alders",
"Alders'",
"PPI",
"sandboxed"
],
"wordlist" : "Pod::Wordlist"
}
},
"name" : "@Author::OALDERS/Test::PodSpelling",
"version" : "2.007006"
},
{
"class" : "Dist::Zilla::Plugin::MojibakeTests",
"name" : "@Author::OALDERS/MojibakeTests",
"version" : "0.8"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "@Author::OALDERS/PodSyntaxTests",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Test::CPAN::Changes",
"config" : {
"Dist::Zilla::Plugin::Test::CPAN::Changes" : {
"changelog" : "Changes",
"filename" : "xt/release/cpan-changes.t"
}
},
"name" : "@Author::OALDERS/Test::CPAN::Changes",
"version" : "0.013"
},
{
"class" : "Dist::Zilla::Plugin::Test::EOL",
"config" : {
"Dist::Zilla::Plugin::Test::EOL" : {
"filename" : "xt/author/eol.t",
"finder" : [
":ExecFiles",
":InstallModules",
":TestFiles"
],
"trailing_whitespace" : 1
}
},
"name" : "@Author::OALDERS/Test::EOL",
"version" : "0.19"
},
{
"class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable",
"name" : "@Author::OALDERS/Test::Pod::Coverage::Configurable",
"version" : "0.07"
},
{
"class" : "Dist::Zilla::Plugin::Test::Portability",
"config" : {
"Dist::Zilla::Plugin::Test::Portability" : {
"options" : ""
}
},
"name" : "@Author::OALDERS/Test::Portability",
"version" : "2.001003"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@Author::OALDERS/TestRelease",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Test::ReportPrereqs",
"name" : "@Author::OALDERS/Test::ReportPrereqs",
"version" : "0.029"
},
{
"class" : "Dist::Zilla::Plugin::Test::Version",
"name" : "@Author::OALDERS/Test::Version",
"version" : "1.09"
},
{
"class" : "Dist::Zilla::Plugin::RunExtraTests",
"config" : {
"Dist::Zilla::Role::TestRunner" : {
"default_jobs" : "8"
}
},
"name" : "@Author::OALDERS/RunExtraTests",
"version" : "0.029"
},
{
"class" : "Dist::Zilla::Plugin::MinimumPerl",
"name" : "@Author::OALDERS/MinimumPerl",
"version" : "1.006"
},
{
"class" : "Dist::Zilla::Plugin::PodWeaver",
"config" : {
"Dist::Zilla::Plugin::PodWeaver" : {
"finder" : [
":InstallModules",
":PerlExecFiles"
],
"plugins" : [
{
"class" : "Pod::Weaver::Plugin::EnsurePod5",
"name" : "@CorePrep/EnsurePod5",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Plugin::H1Nester",
"name" : "@CorePrep/H1Nester",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Plugin::SingleEncoding",
"name" : "@Default/SingleEncoding",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Name",
"name" : "@Default/Name",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Version",
"name" : "@Default/Version",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@Default/prelude",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "SYNOPSIS",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "DESCRIPTION",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "OVERVIEW",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "ATTRIBUTES",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "METHODS",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "FUNCTIONS",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Leftovers",
"name" : "@Default/Leftovers",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@Default/postlude",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Authors",
"name" : "@Default/Authors",
"version" : "4.020"
},
{
"class" : "Pod::Weaver::Section::Legal",
"name" : "@Default/Legal",
"version" : "4.020"
}
]
}
},
"name" : "@Author::OALDERS/PodWeaver",
"version" : "4.010"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@Author::OALDERS/PruneCruft",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::CopyFilesFromBuild",
"name" : "@Author::OALDERS/CopyFilesFromBuild",
"version" : "0.170880"
},
{
"class" : "Dist::Zilla::Plugin::GithubMeta",
"name" : "@Author::OALDERS/GithubMeta",
"version" : "0.58"
},
{
"class" : "Dist::Zilla::Plugin::Git::GatherDir",
"config" : {
"Dist::Zilla::Plugin::GatherDir" : {
"exclude_filename" : [
"Install",
"LICENSE",
"META.json",
"Makefile.PL",
"README.md",
"cpanfile"
],
"exclude_match" : [],
"include_dotfiles" : 0,
"prefix" : "",
"prune_directory" : [],
"root" : "."
},
"Dist::Zilla::Plugin::Git::GatherDir" : {
"include_untracked" : 0
}
},
"name" : "@Author::OALDERS/Git::GatherDir",
"version" : "2.052"
},
{
"class" : "Dist::Zilla::Plugin::CopyFilesFromRelease",
"config" : {
"Dist::Zilla::Plugin::CopyFilesFromRelease" : {
"filename" : [
"Install"
],
"match" : []
}
},
"name" : "@Author::OALDERS/CopyFilesFromRelease",
"version" : "0.007"
},
{
"class" : "Dist::Zilla::Plugin::Git::Check",
"config" : {
"Dist::Zilla::Plugin::Git::Check" : {
"untracked_files" : "die"
},
"Dist::Zilla::Role::Git::DirtyFiles" : {
"allow_dirty" : [
"Changes",
"Install",
"LICENSE",
"META.json",
"Makefile.PL",
"README.md",
"cpanfile",
"dist.ini"
],
"allow_dirty_match" : [],
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.43.0",
"repo_root" : "."
}
},
"name" : "@Author::OALDERS/Git::Check",
"version" : "2.052"
},
{
"class" : "Dist::Zilla::Plugin::Git::Contributors",
"config" : {
"Dist::Zilla::Plugin::Git::Contributors" : {
"git_version" : "2.43.0",
"include_authors" : 0,
"include_releaser" : 1,
"order_by" : "name",
"paths" : []
}
},
"name" : "@Author::OALDERS/Git::Contributors",
"version" : "0.039"
},
{
"class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
"config" : {
"Dist::Zilla::Role::FileWatcher" : {
"version" : "0.006"
}
},
"name" : "@Author::OALDERS/ReadmeMdInBuild",
"version" : "0.163250"
},
{
"class" : "Dist::Zilla::Plugin::StaticInstall",
"config" : {
"Dist::Zilla::Plugin::StaticInstall" : {
"dry_run" : 0,
"mode" : "on"
}
},
"name" : "@Author::OALDERS/StaticInstall",
"version" : "0.012"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@Author::OALDERS/ShareDir",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::CheckIssues",
"name" : "@Author::OALDERS/CheckIssues",
"version" : "0.011"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@Author::OALDERS/ConfirmRelease",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@Author::OALDERS/UploadToCPAN",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "develop",
"type" : "recommends"
}
},
"name" : "@Author::OALDERS/@Git::VersionManager/pluginbundle version",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::RewriteVersion::Transitional",
"config" : {
"Dist::Zilla::Plugin::RewriteVersion" : {
"add_tarball_name" : 0,
"finders" : [
":ExecFiles",
":InstallModules"
],
"global" : 0,
"skip_version_provider" : 0
},
"Dist::Zilla::Plugin::RewriteVersion::Transitional" : {}
},
"name" : "@Author::OALDERS/@Git::VersionManager/RewriteVersion::Transitional",
"version" : "0.009"
},
{
"class" : "Dist::Zilla::Plugin::MetaProvides::Update",
"name" : "@Author::OALDERS/@Git::VersionManager/MetaProvides::Update",
"version" : "0.007"
},
{
"class" : "Dist::Zilla::Plugin::CopyFilesFromRelease",
"config" : {
"Dist::Zilla::Plugin::CopyFilesFromRelease" : {
"filename" : [
"Changes"
],
"match" : []
}
},
"name" : "@Author::OALDERS/@Git::VersionManager/CopyFilesFromRelease",
"version" : "0.007"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
"config" : {
"Dist::Zilla::Plugin::Git::Commit" : {
"add_files_in" : [],
"commit_msg" : "v%V%n%n%c",
"signoff" : 0
},
"Dist::Zilla::Role::Git::DirtyFiles" : {
"allow_dirty" : [
"Changes",
"Install",
"LICENSE",
"META.json",
"Makefile.PL",
"README.md",
"cpanfile",
"dist.ini"
],
"allow_dirty_match" : [],
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.43.0",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"time_zone" : "local"
}
},
"name" : "@Author::OALDERS/@Git::VersionManager/release snapshot",
"version" : "2.052"
},
{
"class" : "Dist::Zilla::Plugin::Git::Tag",
"config" : {
"Dist::Zilla::Plugin::Git::Tag" : {
"branch" : null,
"changelog" : "Changes",
"signed" : 0,
"tag" : "v0.000060",
"tag_format" : "v%V",
"tag_message" : "v%V"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.43.0",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"time_zone" : "local"
}
},
"name" : "@Author::OALDERS/@Git::VersionManager/Git::Tag",
"version" : "2.052"
},
{
"class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional",
"config" : {
"Dist::Zilla::Plugin::BumpVersionAfterRelease" : {
"finders" : [
":ExecFiles",
":InstallModules"
],
"global" : 0,
"munge_makefile_pl" : 1
},
"Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional" : {}
},
"name" : "@Author::OALDERS/@Git::VersionManager/BumpVersionAfterRelease::Transitional",
"version" : "0.009"
},
{
"class" : "Dist::Zilla::Plugin::NextRelease",
"name" : "@Author::OALDERS/@Git::VersionManager/NextRelease",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
"config" : {
"Dist::Zilla::Plugin::Git::Commit" : {
"add_files_in" : [],
"commit_msg" : "increment $VERSION after %v release",
"signoff" : 0
},
"Dist::Zilla::Role::Git::DirtyFiles" : {
"allow_dirty" : [
"Build.PL",
"Changes",
"Makefile.PL"
],
"allow_dirty_match" : [
"(?^:^lib/.*\\.pm$)"
],
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.43.0",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"time_zone" : "local"
}
},
"name" : "@Author::OALDERS/@Git::VersionManager/post-release commit",
"version" : "2.052"
},
{
"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.43.0",
"repo_root" : "."
}
},
"name" : "@Author::OALDERS/Git::Push",
"version" : "2.052"
},
{
"class" : "Dist::Zilla::Plugin::PruneFiles",
"name" : "PruneFiles",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::GitHubREADME::Badge",
"name" : "GitHubREADME::Badge",
"version" : "0.35"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "runtime",
"type" : "requires"
}
},
"name" : "RuntimeRequires",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "test",
"type" : "requires"
}
},
"name" : "TestRequires",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
"config" : {
"Dist::Zilla::Plugin::Prereqs" : {
"phase" : "develop",
"type" : "requires"
}
},
"name" : "DevelopRequires",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExtraTestFiles",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":PerlExecFiles",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":AllFiles",
"version" : "6.037"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":NoFiles",
"version" : "6.037"
}
],
"zilla" : {
"class" : "Dist::Zilla::Dist::Builder",
"config" : {
"is_trial" : 0
},
"version" : "6.037"
}
},
"x_contributors" : [
"copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>",
"dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>",
"E. Choroba ",
"James Raspass ",
"Jos\u00e9 Manuel Rodri\u0301guez D ",
"Kenichi Ishigaki ",
"Nelo Onyiah ",
"Nicolas Mendoza ",
"Olaf Alders ",
"Paul Johnson ",
"Peter Oliver ",
"pyrrhlin <1197072+myrrhlin@users.noreply.github.com>"
],
"x_generated_by_perl" : "v5.42.2",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.40",
"x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later",
"x_static_install" : 1
}
CLAUDE.md 100644 001750 001751 7231 15176664014 15440 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 # CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
`App::perlimports` is a Perl CLI tool and library that automates cleanup of Perl `use` import statements — making implicit imports explicit and removing unused ones. It requires Perl 5.18+.
## Commands
**Run all tests:**
```bash
prove -lr -j2 t
```
**Run a single test file:**
```bash
prove -l t/cli.t
```
**Lint all code:**
```bash
precious lint --all
```
**Tidy all code:**
```bash
precious tidy --all
```
**Build the distribution (requires Dist::Zilla):**
```bash
dzil build
```
## Code Quality Tools
`precious.toml` configures:
- `perlimports` — run via `perl -Ilib script/perlimports`, with `--lint` for linting or `-i` for tidying
- `perltidy` — formatter governed by `perltidyrc` (4-space indent, 78-char lines)
- `perlcritic` — style checker governed by `perlcriticrc` (severity 3)
- `omegasort` — sorts `.gitignore` and `.stopwords`
## Architecture
The tool is built on [PPI](https://metacpan.org/pod/PPI) (Perl Parse Interface) and uses [Moo](https://metacpan.org/pod/Moo) for its object system with [Types::Standard](https://metacpan.org/pod/Types::Standard) for validation.
**Data flow:**
```
CLI -> Document -> Include -> ExportInspector -> Sandbox
|-> Config
|-> Annotations
|-> PPI (parse tree)
```
**Key modules in `lib/App/perlimports/`:**
- **CLI.pm** — Parses CLI arguments, manages I/O (file or stdin), dispatches to Document. Handles `--inplace-edit`, `--json`, `--lint`, `--config`. Discovers config via `XDG_CONFIG_HOME` when `--config` is not specified.
- **Document.pm** — Core logic. Wraps `PPI::Document`, identifies all imports in a file, determines which symbols are actually used, and coordinates rewriting.
- **Include.pm** — Represents a single `use Module ...` statement. Tracks which exported symbols are used and formats the corrected import line.
- **ExportInspector.pm** — Inspects a module's `@EXPORT`, `@EXPORT_OK`, and `@EXPORT_TAGS` by loading it in a sandboxed `eval`. Handles both `Exporter` and `Sub::Exporter` styles.
- **Config.pm** — Reads `perlimports.toml`. Manages ignore lists, lib paths, logging, and output format.
- **Annotations.pm** — Parses `## no perlimports` / `## use perlimports` inline comment directives that let users disable or re-enable the tool for ranges of code.
- **Sandbox.pm** — Provides an isolated environment for safely evaluating module exports without polluting the main namespace.
**Entry points:**
- `script/perlimports` — Thin CLI script that delegates to `App::perlimports::CLI`.
- `script/dump-perl-exports` — Utility to inspect a module's exports directly.
## Test Layout
- `t/*.t` — Main test suite (~85 files)
- `t/ExportInspector/` — Tests specific to export inspection logic
- `t/cpan-modules/` — Integration tests against real CPAN modules
- `t/lib/` — Shared test utilities (`TestHelper.pm`)
- `test-data/lib/` — Sample Perl modules used as test fixtures
## Dependencies
Declared in `cpanfile`. The build is managed by [Dist::Zilla](https://metacpan.org/pod/Dist::Zilla) via `dist.ini` — **do not edit `Makefile.PL` directly**, it is generated.
## Development Notes
- The `perlimports.toml` at the repo root configures the tool for its own source (libs: `lib` and `t/lib`).
- Attributes in the Moo classes use lazy initialization extensively — be careful when adding new attributes that existing tests may not exercise lazy code paths.
- A pre-commit hook (`git/hooks/pre-commit`) runs `precious lint --staged`; install it with `bash git/setup.sh`.
- PPI is a regular CPAN dependency (version 1.276 minimum), not a fork.
after.t 100755 001750 001751 1060 15176664014 15707 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib', 'test-data/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( List::AllUtils );
my ($doc) = doc(
filename => 'test-data/lib/Local/After.pm',
);
my $expected = <<'EOF';
package Local::After;
use Moose;
use List::AllUtils qw( uniq );
my @foo = uniq { 1..10 };
after run => sub { my @foo = uniq ( 1..9 ) };
sub run { 1; }
1;
EOF
is(
$doc->tidied_document,
$expected,
'Moose::after() is not assigned to List::AllUtils'
);
done_testing;
dupes.t 100755 001750 001751 2212 15176664014 15726 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is subtest )];
subtest 'preserve duplicates' => sub {
my ($doc) = doc(
filename => 'test-data/dupes.pl',
);
my $expected = <<'EOF';
use strict;
use warnings;
use File::Temp qw( tempdir tempfile );
use List::Util qw( any );
use File::Temp qw( tempdir tempfile ); # some comments
sub foo {
my $dir = tempdir();
my $file = tempfile();
return any { $_ > 1 } ( 0 .. 2 );
}
EOF
my $got = $doc->tidied_document;
is(
$got,
$expected,
'duplicate use statement removed'
);
};
subtest 'strip duplicates' => sub {
my ($doc) = doc(
filename => 'test-data/dupes.pl',
preserve_duplicates => 0,
);
my $expected = <<'EOF';
use strict;
use warnings;
use File::Temp qw( tempdir tempfile );
use List::Util qw( any );
sub foo {
my $dir = tempdir();
my $file = tempfile();
return any { $_ > 1 } ( 0 .. 2 );
}
EOF
is(
$doc->tidied_document,
$expected,
'duplicate use statement removed'
);
};
done_testing;
moose.t 100755 001750 001751 2640 15176664014 15735 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 'test-data/lib', 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is subtest )];
use Test::Needs qw( Import::Into Moose );
subtest 'Moose' => sub {
my ($doc) = doc(
filename => 'test-data/lib/Local/UsesMoose.pm',
preserve_unused => 1,
);
my $expected = <<'EOF';
package Local::UsesMoose;
use Moose;
has foo => (
is => 'ro',
isa => 'Str',
);
__PACKAGE__->meta->make_immutable;
1;
EOF
is(
$doc->tidied_document,
$expected,
'document unchanged'
);
};
subtest 'Import::Into' => sub {
my ($doc) = doc(
filename => 'test-data/lib/Local/MyOwnMoose.pm',
preserve_unused => 1,
);
my $expected = <<'EOF';
package Local::MyOwnMoose;
use strict;
use warnings;
use Import::Into;
sub import {
$_->import::into( scalar caller ) for qw( Moose );
}
1;
EOF
is(
$doc->tidied_document,
$expected,
'tidied_document'
);
};
subtest 'Uses MyOwnMoose' => sub {
my ($doc) = doc(
filename => 'test-data/lib/Local/UsesMyOwnMoose.pm',
preserve_unused => 1,
);
my $expected = <<'EOF';
package Local::UsesMyOwnMoose;
use strict;
use warnings;
use Local::MyOwnMoose;
1;
EOF
is(
$doc->tidied_document,
$expected,
'tidied_document'
);
};
done_testing();
README.md 100644 001750 001751 1226 15176664014 15436 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 # NAME
App::perlimports - Make implicit imports explicit
# VERSION
version 0.000060
# DESCRIPTION
This distribution provides the [perlimports](https://metacpan.org/pod/perlimports) command line interface (CLI),
which aims to automate the cleanup and maintenance of Perl import statements.
See [perlimports](https://metacpan.org/pod/perlimports) for detailed information on how to use this tool.
# AUTHOR
Olaf Alders
# COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by Olaf Alders.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
perltidyrc 100644 001750 001751 362 15176664014 16243 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 --blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
--character-encoding=none
-b
-bar
-boc
-ci=4
-i=4
-l=78
-nolq
-se
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
Config.t 100755 001750 001751 3542 15176664014 16022 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use App::perlimports::Config ();
use Path::Tiny ();
use Test::Differences qw( eq_or_diff );
use Test::Fatal qw( exception );
use Test::More import => [qw( done_testing is like ok subtest )];
use TOML::Tiny qw( from_toml );
my $dir = Path::Tiny->tempdir('testconfigXXXXXXXX');
my $file = $dir->child('perlimports.toml');
ok( App::perlimports::Config->create_config($file), 'create_config' );
{
my $config = from_toml( $file->slurp );
eq_or_diff( $config->{libs}, [ 'lib', 't/lib' ], 'default libs' );
}
like(
exception {
App::perlimports::Config->create_config($file)
},
qr{already exists},
'file already exists'
);
subtest 'defaults' => sub {
# Isolate from a user ~/.perltidyrc that could change the indent
# default asserted below.
my $home = Path::Tiny->tempdir;
local $ENV{HOME} = "$home";
delete local $ENV{PERLTIDY};
# Ensure defaults don't throw exceptions
my $config = App::perlimports::Config->new;
ok( !$config->cache, 'no cache' );
eq_or_diff( $config->ignore, [], 'empty ignore' );
eq_or_diff( $config->ignore_pattern, [], 'empty ignore_pattern' );
eq_or_diff( $config->libs, [], 'empty libs' );
is( $config->log_filename, q{}, 'empty log_filename' );
is( $config->log_level, 'error', 'log_level is error' );
eq_or_diff( $config->never_export, [], 'empty never_export' );
ok( $config->padding, 'padding on' );
ok( $config->preserve_duplicates, 'preserve_duplicates on' );
ok( $config->preserve_unused, 'preserve_unused on' );
ok( $config->tidy_whitespace, 'tidy_whitespace on' );
ok( !$config->pad_brackets, 'pad_brackets off by default' );
is( $config->indent, 4, 'indent defaults to 4 (from perltidy)' );
};
done_testing;
geo-ip.t 100755 001750 001751 1016 15176664014 15767 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
# misses import in ternary
use lib 't/lib';
use TestHelper qw( source2pi );
use Test::More import => [qw( done_testing is is_deeply )];
use Test::Needs qw( Geo::IP );
my $e = source2pi(
'test-data/geo-ip.pl',
'use Geo::IP;',
);
is_deeply(
$e->_imports, [ 'GEOIP_MEMORY_CACHE', 'GEOIP_STANDARD' ],
'_imports'
);
is(
$e->formatted_ppi_statement,
'use Geo::IP qw( GEOIP_MEMORY_CACHE GEOIP_STANDARD );',
'formatted_ppi_statement'
);
done_testing();
indent.t 100644 001750 001751 4145 15176664014 16073 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib', 'test-data/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is like subtest unlike )];
subtest 'default indent' => sub {
my ($doc) = doc( filename => 'test-data/long-list.pl' );
is(
$doc->tidied_document,
<<'EOF', 'default indent is 4 spaces' );
use strict;
use warnings;
use lib 'test-data/lib';
use Local::LongList qw(
alpha
bravo
charlie
delta
echo
foxtrot
golf
hotel
india
juliet
);
alpha();
bravo();
charlie();
delta();
echo();
foxtrot();
golf();
hotel();
india();
juliet();
EOF
};
subtest 'indent=2' => sub {
my ($doc) = doc(
filename => 'test-data/long-list.pl',
indent => 2,
);
is(
$doc->tidied_document,
<<'EOF', 'indent=2 produces 2-space indent' );
use strict;
use warnings;
use lib 'test-data/lib';
use Local::LongList qw(
alpha
bravo
charlie
delta
echo
foxtrot
golf
hotel
india
juliet
);
alpha();
bravo();
charlie();
delta();
echo();
foxtrot();
golf();
hotel();
india();
juliet();
EOF
};
subtest 'indent=8' => sub {
my ($doc) = doc(
filename => 'test-data/long-list.pl',
indent => 8,
);
is(
$doc->tidied_document,
<<'EOF', 'indent=8 produces 8-space indent' );
use strict;
use warnings;
use lib 'test-data/lib';
use Local::LongList qw(
alpha
bravo
charlie
delta
echo
foxtrot
golf
hotel
india
juliet
);
alpha();
bravo();
charlie();
delta();
echo();
foxtrot();
golf();
hotel();
india();
juliet();
EOF
};
subtest 'indent=2 applies to wrapped test-builder imports' => sub {
my ($doc) = doc(
filename => 'test-data/long-test-more.pl',
indent => 2,
);
my $tidied = $doc->tidied_document;
like(
$tidied,
qr/^ qw\(/m,
'wrapped test-builder qw() uses 2-space indent'
);
unlike(
$tidied,
qr/^ qw\(/m,
'wrapped test-builder qw() does not use default 4-space indent'
);
};
done_testing();
method.t 100755 001750 001751 1025 15176664014 16067 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( LWP::UserAgent );
my ($doc) = doc(
filename => 'test-data/method.pl',
selection => 'use HTTP::Status;'
);
# Ensure that the ->is_success method call on an HTTP::Response object doesn't
# result in an "is_success" function import for HTTP::Status.
is(
$doc->tidied_document,
'use HTTP::Status ();',
'is_success method not added to function imports'
);
done_testing();
pragma.t 100755 001750 001751 1473 15176664014 16065 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
# Ensure that the pragma "use warnings;" does not get mistaken for a use of the
# warnings() function exported via Test::Warnings.
use lib 't/lib';
use Path::Tiny qw( path );
use TestHelper qw( source2pi );
use Test::More import => [qw( done_testing is ok )];
my $filename = 'test-data/pragma.t';
my $content = path($filename)->slurp;
my $doc = PPI::Document->new( \$content );
my $includes = $doc->find(
sub {
$_[1]->isa('PPI::Statement::Include');
}
) || [];
is( scalar @{$includes}, 4, 'found 4 includes' );
my $e = source2pi(
$filename,
undef,
{ include => $includes->[3] },
);
ok( !$e->_is_ignored, 'is not ignored' );
is(
$e->formatted_ppi_statement,
'use Test::Warnings ();',
'formatted_ppi_statement'
);
done_testing;
socket.t 100755 001750 001751 3332 15176664014 16102 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc logger );
use Test::More import => [qw( done_testing is ok subtest )];
subtest tidy => sub {
my ($doc) = doc(
filename => 'test-data/socket.pl',
);
my $expected = <<'EOF';
use strict;
use warnings;
use IO::Socket::INET ();
use Socket qw( SO_REUSEPORT SOL_SOCKET );
foo( SO_REUSEPORT, SOL_SOCKET );
sub foo { }
EOF
is(
$doc->tidied_document,
$expected,
'Two modules with the same exports do not get conflated'
);
};
subtest lint => sub {
my @log;
my $logger = logger( \@log, 'error' );
my ($doc) = doc(
filename => 'test-data/socket.pl',
lint => 1,
logger => $logger,
);
ok( !$doc->linter_success, 'fails linting' );
## no critic (ValuesAndExpressions::ProhibitImplicitNewlines)
eq_or_diff(
\@log,
[
{
level => 'error',
message => "\x{274c}"
. ' IO::Socket::INET (import arguments need tidying) at test-data/socket.pl line 4',
},
{
level => 'error',
message => '@@ -4 +4 @@
-use IO::Socket::INET;
+use IO::Socket::INET ();
',
},
{
level => 'error',
message => "\x{274c}"
. ' Socket (import arguments need tidying) at test-data/socket.pl line 5',
},
{
level => 'error',
message => '@@ -5 +5 @@
-use Socket qw(SO_REUSEPORT SOL_SOCKET);
+use Socket ();
',
},
],
'linting errors logged'
);
};
done_testing;
Makefile.PL 100644 001750 001751 7356 15176664014 16143 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.037
use strict;
use warnings;
use 5.018000;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "Make implicit imports explicit",
"AUTHOR" => "Olaf Alders ",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "App-perlimports",
"EXE_FILES" => [
"script/dump-perl-exports",
"script/perlimports"
],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.018000",
"NAME" => "App::perlimports",
"PREREQ_PM" => {
"Capture::Tiny" => 0,
"Class::Inspector" => "1.36",
"Cpanel::JSON::XS" => 0,
"Data::Dumper" => 0,
"Data::UUID" => 0,
"File::Basename" => 0,
"File::XDG" => "1.01",
"Getopt::Long::Descriptive" => 0,
"List::Util" => 0,
"Log::Dispatch" => "2.70",
"Memoize" => 0,
"Module::Runtime" => 0,
"Moo" => 0,
"Moo::Role" => 0,
"MooX::StrictConstructor" => 0,
"PPI" => "1.276",
"PPI::Document" => 0,
"PPIx::Utils::Classification" => 0,
"PPIx::Utils::Traversal" => 0,
"Path::Iterator::Rule" => 0,
"Path::Tiny" => 0,
"Perl::Tidy" => 20220613,
"Pod::Usage" => 0,
"Ref::Util" => 0,
"Scalar::Util" => 0,
"Sereal::Decoder" => 0,
"Sereal::Encoder" => 0,
"Sub::HandlesVia" => 0,
"Symbol::Get" => "0.10",
"TOML::Tiny" => "0.16",
"Text::Diff" => 0,
"Text::SimpleTable::AutoWidth" => 0,
"Try::Tiny" => 0,
"Types::Common::Numeric" => 0,
"Types::Standard" => 0,
"feature" => 0,
"strict" => 0,
"utf8" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
"File::pushd" => 0,
"Log::Dispatch::Array" => 0,
"PPI::Dumper" => 0,
"Sub::Exporter" => 0,
"Test::Differences" => 0,
"Test::Fatal" => 0,
"Test::More" => 0,
"Test::Needs" => 0,
"Test::RequiresInternet" => 0,
"Test::Script" => "1.29",
"Test::Warnings" => 0,
"lib" => 0
},
"VERSION" => "0.000060",
"test" => {
"TESTS" => "t/*.t t/ExportInspector/*.t t/cpan-modules/*.t"
}
);
my %FallbackPrereqs = (
"Capture::Tiny" => 0,
"Class::Inspector" => "1.36",
"Cpanel::JSON::XS" => 0,
"Data::Dumper" => 0,
"Data::UUID" => 0,
"ExtUtils::MakeMaker" => 0,
"File::Basename" => 0,
"File::Spec" => 0,
"File::XDG" => "1.01",
"File::pushd" => 0,
"Getopt::Long::Descriptive" => 0,
"List::Util" => 0,
"Log::Dispatch" => "2.70",
"Log::Dispatch::Array" => 0,
"Memoize" => 0,
"Module::Runtime" => 0,
"Moo" => 0,
"Moo::Role" => 0,
"MooX::StrictConstructor" => 0,
"PPI" => "1.276",
"PPI::Document" => 0,
"PPI::Dumper" => 0,
"PPIx::Utils::Classification" => 0,
"PPIx::Utils::Traversal" => 0,
"Path::Iterator::Rule" => 0,
"Path::Tiny" => 0,
"Perl::Tidy" => 20220613,
"Pod::Usage" => 0,
"Ref::Util" => 0,
"Scalar::Util" => 0,
"Sereal::Decoder" => 0,
"Sereal::Encoder" => 0,
"Sub::Exporter" => 0,
"Sub::HandlesVia" => 0,
"Symbol::Get" => "0.10",
"TOML::Tiny" => "0.16",
"Test::Differences" => 0,
"Test::Fatal" => 0,
"Test::More" => 0,
"Test::Needs" => 0,
"Test::RequiresInternet" => 0,
"Test::Script" => "1.29",
"Test::Warnings" => 0,
"Text::Diff" => 0,
"Text::SimpleTable::AutoWidth" => 0,
"Try::Tiny" => 0,
"Types::Common::Numeric" => 0,
"Types::Standard" => 0,
"feature" => 0,
"lib" => 0,
"strict" => 0,
"utf8" => 0,
"warnings" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
Sandbox.t 100644 001750 001751 3215 15176664014 16205 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib', 'test-data/lib';
use App::perlimports::Sandbox ();
use TestHelper qw( doc );
use Test::Differences qw( eq_or_diff );
use Test::More import => [qw( cmp_ok done_testing ok subtest )];
my $pkg1 = App::perlimports::Sandbox::pkg_for('fakeblock');
my $pkg2 = App::perlimports::Sandbox::pkg_for('fakeblock');
ok( $pkg1, 'first pkg' );
ok( $pkg2, 'second pkg' );
cmp_ok( $pkg1, 'ne', $pkg2, 'names are not the same' );
subtest 'Carp' => sub {
my $eval = App::perlimports::Sandbox::eval_pkg(
'Carp',
'use Carp qw( croak );',
);
ok( !$eval, 'no problems with eval' );
};
subtest 'missing module' => sub {
my $eval = App::perlimports::Sandbox::eval_pkg(
'Local::ZZZ::XXX',
'use Local::ZZZ::XXX ();',
);
ok( $eval, 'eval failure' );
};
subtest 'local module' => sub {
my $eval = App::perlimports::Sandbox::eval_pkg(
'Local::ImportException',
'use Local::ImportException ();',
);
ok( !$eval, 'no eval failure' );
};
subtest 'local module with exception' => sub {
my $eval = App::perlimports::Sandbox::eval_pkg(
'Local::ImportException',
'use Local::ImportException qw( exceptional );',
);
ok( $eval, 'eval failure' );
};
subtest 'eval in tidied_document' => sub {
my ($doc) = doc( filename => 'test-data/exceptional.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Carp qw( croak );
use Local::ImportException;
exceptional();
croak();
EOF
eq_or_diff(
$doc->tidied_document, $expected,
'does not update import with eval failure'
);
};
done_testing();
builtin.t 100644 001750 001751 627 15176664014 16241 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use App::perlimports::Document ();
use Test::More import => [qw( done_testing is )];
my $doc
= App::perlimports::Document->new( filename => 'test-data/builtin.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use POSIX ();
printf('%s', 'ok');
EOF
is(
$doc->tidied_document, $expected,
'Perl builtin does not get added to POSIX imports'
);
done_testing();
english.t 100644 001750 001751 544 15176664014 16222 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
my ($doc) = doc( filename => 'test-data/english.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use English qw( -no_match_vars );
EOF
is( $doc->tidied_document, $expected, '-no-match-vars is preserved' );
done_testing();
heredoc.t 100755 001750 001751 667 15176664014 16213 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( Perl::Critic::Utils );
use TestHelper qw( source2pi );
my $source_text = 'use Perl::Critic::Utils;';
my $e = source2pi( 'test-data/heredoc.pl', $source_text );
is(
$e->formatted_ppi_statement,
'use Perl::Critic::Utils qw( $QUOTE );',
'var in heredoc found'
);
done_testing();
memoize.t 100755 001750 001751 2236 15176664014 16261 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
# This is a regression test for an error which occurs when using
# "memoize('is_function_call')" in Include.pm. It appears only in cases where
# the CLI is processing multiple files in a specific order. In the bug
# scenario, "use MooseX::Types::UUID ();" in test-data/b.pl is transformed to
# "use MooseX::Types::UUID qw( UUID );", despite the fact that "UUID" is not an
# imported symbol in b.pl. This happens in the case where "a.pl" is process
# first and "is_function_call('UUID')" has already been memoized.
#
# We use "memoize" on "is_function_call" because it was identified as a hotspot
# in earlier profiling.
use lib 't/lib';
use Path::Tiny qw( path );
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing )];
use Test::Needs qw( MooseX::Types::UUID UUID );
{
my ($doc) = doc( filename => 'test-data/a.pl' );
$doc->tidied_document;
}
{
my ($doc) = doc( filename => 'test-data/b.pl', preserve_unused => 1, );
eq_or_diff(
$doc->tidied_document,
path('test-data/b.pl')->slurp,
'doc has not changed'
);
}
done_testing();
padding.t 100755 001750 001751 615 15176664014 16201 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
my ($doc) = doc(
filename => 'test-data/carp.pl',
padding => 0,
);
my $expected = <<'EOF';
use strict;
use warnings;
use Carp qw(croak verbose);
croak('oof');
EOF
is( $doc->tidied_document, $expected, 'list is not padded' );
done_testing();
require.t 100755 001750 001751 6105 15176664014 16267 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use Path::Tiny qw( path );
use TestHelper qw( doc source2pi );
use Test::More import => [qw( done_testing is ok subtest )];
use Test::Needs qw( LWP::UserAgent );
my $filename = 'test-data/require.pl';
subtest 'replace top level require via snippet' => sub {
my $e = source2pi(
$filename,
'require LWP::UserAgent;',
);
ok( !$e->_is_ignored, 'is not ignored' );
is(
$e->formatted_ppi_statement,
'use LWP::UserAgent ();',
'formatted_ppi_statement'
);
};
my $content = path($filename)->slurp;
my ($require_doc) = PPI::Document->new( \$content );
my $includes = $require_doc->find(
sub {
$_[1]->isa('PPI::Statement::Include');
}
) || [];
subtest 'replace top level require from document' => sub {
my $e = source2pi(
$filename,
undef,
{ include => $includes->[2] },
);
ok( !$e->_is_ignored, 'is not ignored' );
is(
$e->formatted_ppi_statement,
'use LWP::UserAgent ();',
'formatted_ppi_statement'
);
};
subtest 'preserve require inside if block' => sub {
my $e = source2pi(
$filename,
undef,
{ include => $includes->[3] },
);
ok( $e->_is_ignored, 'is ignored' );
is(
$e->formatted_ppi_statement,
'require WWW::Mechanize;',
'formatted_ppi_statement'
);
};
subtest 'preserve require inside postfix if defined' => sub {
my $e = source2pi(
$filename,
undef,
{ include => $includes->[4] },
);
ok( $e->_is_ignored, 'is ignored' );
is(
$e->formatted_ppi_statement,
'require Carp if $ENV{BAR};',
'formatted_ppi_statement'
);
};
subtest 'do not import fully qualified function calls' => sub {
my $e = source2pi(
$filename,
undef,
{ include => $includes->[5] },
);
is(
$e->formatted_ppi_statement,
'use List::Util ();',
'formatted_ppi_statement'
);
};
subtest 'preserve require inside postfix if eq' => sub {
my $e = source2pi(
$filename,
undef,
{ include => $includes->[6] },
);
ok( $e->_is_ignored, 'is ignored' );
is(
$e->formatted_ppi_statement,
q{require Time::Local if $^O eq 'MacOS';},
'formatted_ppi_statement'
);
};
subtest 'require rewritten as use' => sub {
my $e = source2pi(
$filename,
undef,
{ include => $includes->[7] },
);
ok( !$e->_is_ignored, 'is not ignored' );
is(
$e->formatted_ppi_statement,
'use Cwd ();',
'formatted_ppi_statement'
);
};
subtest 'require Exporter not rewritten' => sub {
my ($doc) = doc(
filename => 'test-data/lib/Local/RequireExporter.pm',
);
my $expected = <<'EOF';
package Local::RequireExporter;
use strict;
use warnings;
require Exporter;
our @EXPORT = qw(foo);
sub foo { return 'from sub foo' }
1;
EOF
is(
$doc->tidied_document,
$expected,
'statement is unchanged'
);
};
done_testing();
warning.t 100755 001750 001751 676 15176664014 16247 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use Test::Differences qw( eq_or_diff );
use Test::More import => [qw( done_testing )];
use Test::Needs qw( Mojo::URL );
use lib 't/lib';
use TestHelper qw( doc logger );
my $log = [];
my $logger = logger( $log, 'warning' );
my ($doc) = doc(
filename => 'test-data/mojo-url.pl',
logger => $logger,
);
$doc->tidied_document;
eq_or_diff( $log, [], 'no Mojo warnings' );
done_testing();
CONTRIBUTORS 100644 001750 001751 1000 15176664014 16025 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060
# APP-PERLIMPORTS CONTRIBUTORS #
This is the (likely incomplete) list of people who have helped
make this distribution what it is, either via code contributions,
patches, bug reports, help with troubleshooting, etc. A huge
'thank you' to all of them.
* copilot-swe-agent[bot]
* dependabot[bot]
* E. Choroba
* James Raspass
* José Manuel Rodríguez D
* Kenichi Ishigaki
* Nelo Onyiah
* Nicolas Mendoza
* Olaf Alders
* Paul Johnson
* Peter Oliver
* pyrrhlin
git 000755 001750 001751 0 15176664014 14601 5 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 setup.sh 100644 001750 001751 142 15176664014 16412 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/git #!/usr/bin/env bash
chmod +x git/hooks/pre-commit
cd .git/hooks
ln -s ../../git/hooks/pre-commit
perlcriticrc 100644 001750 001751 5735 15176664014 16600 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 severity = 3
verbose = 11
# default set for non-test files:
theme = (core + pbp + bugs + maintenance + cosmetic + complexity + security + moose)
# for tests, we will use slightly different list:
#theme = (core+pbp+bugs+maintenance+cosmetic+complexity+security+moose + tests) && !nontest
program-extensions = pl psgi t
# better syntax to disable a policy is prefixing with hyphen like:
# [-Subroutines::ProhibitCallsToUndeclaredSubs]
# but then perlcritic whines if you don't have it installed.
exclude = Subroutines::ProhibitCallsToUndeclaredSubs
[BuiltinFunctions::ProhibitStringySplit]
severity = 3
[CodeLayout::RequireTrailingCommas]
severity = 3
[ControlStructures::ProhibitCStyleForLoops]
severity = 3
[Documentation::RequirePackageMatchesPodName]
severity = 3
[Freenode::WhileDiamondDefaultAssignment]
set_themes = core
[InputOutput::RequireCheckedSyscalls]
functions = :builtins
exclude_functions = binmode print say sleep
severity = 3
[Moose::RequireCleanNamespace]
modules = Moose Moose::Role MooseX::Role::Parameterized Moose::Util::TypeConstraints
cleaners = namespace::autoclean
[NamingConventions::Capitalization]
package_exemptions = perlimports
file_lexical_variables = [A-Z]\w+|[^A-Z]+
global_variables = :starts_with_upper
scoped_lexical_variables = [A-Z]\w+|[^A-Z]+
severity = 3
# Given our code base, leaving this at 5 would be a huge pain
[Subroutines::ProhibitManyArgs]
max_arguments = 10
[RegularExpressions::ProhibitComplexRegexes]
max_characters = 200
[RegularExpressions::ProhibitUnusualDelimiters]
severity = 3
[Subroutines::ProhibitUnusedPrivateSubroutines]
private_name_regex = _(?!build)\w+
[TestingAndDebugging::ProhibitNoWarnings]
allow = redefine
[ValuesAndExpressions::ProhibitEmptyQuotes]
severity = 3
[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
severity = 3
[ValuesAndExpressions::RequireUpperCaseHeredocTerminator]
severity = 3
[Variables::ProhibitPackageVars]
add_packages = Test::Builder
[-ControlStructures::ProhibitCascadingIfElse]
[-ErrorHandling::RequireCarping]
[-InputOutput::RequireBriefOpen]
[-ValuesAndExpressions::ProhibitConstantPragma]
# No need for /xsm everywhere
[-RegularExpressions::RequireDotMatchAnything]
[-RegularExpressions::RequireExtendedFormatting]
[-RegularExpressions::RequireLineBoundaryMatching]
# This incorrectly thinks signatures are prototypes.
[-Subroutines::ProhibitSubroutinePrototypes]
# http://stackoverflow.com/questions/2275317/why-does-perlcritic-dislike-using-shift-to-populate-subroutine-variables
[-Subroutines::RequireArgUnpacking]
[-Subroutines::RequireFinalReturn]
# "use v5.14" is more readable than "use 5.014"
[-ValuesAndExpressions::ProhibitVersionStrings]
[-Subroutines::ProhibitExplicitReturnUndef]
# Too many false positives
[-ValuesAndExpressions::ProhibitAccessOfPrivateData]
# --- policies that should not be applied to tests:
[Bangs::ProhibitNumberedNames]
add_themes = nontest
[Bangs::ProhibitDebuggingModules]
add_themes = nontest
#[Modules::RequireExplicitInclusion]
#add_themes = nontest
Document.t 100755 001750 001751 566 15176664014 16356 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing ok )];
my ($doc) = doc( filename => 'test-data/original-imports.pl' );
ok( $doc->inspector_for('Carp'), 'Carp' );
ok( $doc->inspector_for('Data::Dumper'), 'Data::Dumper' );
ok( $doc->inspector_for('POSIX'), 'POSIX' );
done_testing();
cli-args.t 100644 001750 001751 5011 15176664014 16304 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 'test-data/lib', 't/lib';
use App::perlimports::CLI ();
use Capture::Tiny qw( capture );
use Path::Tiny ();
use TestHelper qw( logger );
use Test::Differences qw( eq_or_diff );
use Test::More import => [qw( diag done_testing is like subtest )];
use Test::Needs qw( Perl::Critic::Utils );
subtest 'almost all of the args' => sub {
my $expected = <<'EOF';
use strict;
use warnings;
use Perl::Critic::Utils qw($QUOTE);
my %foo = (
$QUOTE => q{description},
);
EOF
my $log_file = Path::Tiny->tempfile('perlimportsXXXXXXXX');
local @ARGV = (
'--ignore-modules' => 'CGI,Plack',
'--ignore-modules-filename' => 'test-data/ignore-modules.txt',
'--ignore-modules-pattern' => '^(Foo|Foo::Bar)',
'--ignore-modules-pattern-filename' =>
'test-data/ignore-modules-pattern.txt',
'--indent' => 2,
'--libs' => 'lib,t/lib',
'--never-export-modules' => 'Never::One,Never::Two',
'--never-export-modules-filename' =>
'test-data/never-export-modules.txt',
'--log-filename' => "$log_file",
'--log-level' => 'info',
'--no-cache',
'--no-padding',
'--no-preserve-duplicates',
'--no-preserve-unused',
'--no-tidy-whitespace',
'--pad-brackets',
'test-data/var-in-hash-key.pl',
);
my $cli = App::perlimports::CLI->new( logger => logger( [] ) );
my ( $stdout, $stderr ) = capture {
$cli->run;
};
is( $stdout, $expected, 'no exception on args' ) || diag $stderr;
my $c = $cli->_config;
is( $c->cache, 0, 'cache' );
eq_or_diff(
$c->ignore, [ 'CGI', 'Plack', 'Data::Printer', 'Git::Sub' ],
'ignore'
);
eq_or_diff(
$c->ignore_pattern, ['^(Foo|Foo::Bar)'],
'ignore_pattern'
);
eq_or_diff( $c->libs, [ 'lib', 't/lib' ], 'libs' );
like( $c->log_filename, qr{perlimports}, 'log_filename' );
is( $c->log_level, 'info', 'log_level' );
eq_or_diff(
$c->never_export,
[ 'Never::One', 'Never::Two', 'Never::Three', 'Never::Four', ],
'never_export'
);
is( $c->indent, 2, 'indent' );
is( $c->pad_brackets, 1, 'pad_brackets' );
is( $c->padding, 0, 'padding' );
is( $c->preserve_duplicates, 0, 'preserve_duplicates' );
is( $c->tidy_whitespace, 0, 'tidy_whitespace' );
};
done_testing();
datetime.t 100644 001750 001751 622 15176664014 16362 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( DateTime );
my ($doc) = doc( filename => 'test-data/datetime.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use DateTime ();
my $dt = DateTime->now;
EOF
is( $doc->tidied_document, $expected, 'DateTime does not import' );
done_testing();
do-block.t 100755 001750 001751 731 15176664014 16264 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( source2pi );
use Test::More import => [qw( done_testing is ok )];
my $source_text
= q[use Test::More do { $ENV{COVERAGE} ? ( skip_all => 'skip under Devel::Cover' ) : () };];
my $e = source2pi(
'test-data/skip-all.t',
$source_text,
);
ok( !$e->_is_ignored, 'noop' );
is(
$e->formatted_ppi_statement,
$source_text,
'formatted_ppi_statement'
);
done_testing();
explodes.t 100755 001750 001751 1271 15176664014 16435 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib', 'test-data/lib';
use PPI::Document ();
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is ok )];
my ($doc) = doc(
filename => 'test-data/explodes.pl',
preserve_unused => 0,
);
my $expected = <<'EOF';
use strict;
use warnings;
use Local::Explodes qw( foo );
foo();
EOF
is(
$doc->tidied_document,
$expected,
'modules which throw exceptions are ignored'
);
my $raw_include = 'use Local::Explodes qw( foo );';
my $inc = PPI::Document->new( \$raw_include );
my $found = $inc->find('PPI::Statement::Include')->[0];
ok( $doc->_is_ignored($found), '_is_ignored' );
done_testing;
find-bin.t 100755 001750 001751 1621 15176664014 16277 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc source2pi );
use Test::More import => [qw( done_testing is is_deeply ok )];
my $e = source2pi(
'test-data/find-bin.pl',
'use FindBin qw( $Bin );',
);
is(
$e->module_name(), 'FindBin',
'module_name'
);
ok( !$e->_is_ignored, 'no longer ignored' );
is_deeply( $e->_imports, [qw($Bin)], 'found import' );
eq_or_diff(
$e->formatted_ppi_statement . q{},
'use FindBin qw( $Bin );',
'formatted_ppi_statement'
);
my ($doc) = doc(
filename => 'test-data/more-find-bin.pl',
preserve_unused => 0,
);
my $expected = <<'EOF';
#!/usr/bin/env perl
use FindBin ();
use lib "$FindBin::Bin/../../../lib";
EOF
eq_or_diff(
$doc->tidied_document, $expected,
'fully qualified symbol name interpolated into quotes detected'
);
done_testing();
hash-key.t 100755 001750 001751 752 15176664014 16306 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( file2includes source2pi );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( HTTP::Status );
my @includes = file2includes('test-data/http-status.pl');
my $e = source2pi(
'test-data/http-status.pl', undef,
{ include => $includes[2] }
);
is(
$e->formatted_ppi_statement,
'use HTTP::Status qw( is_info );',
'does not think hash key is a function'
);
done_testing;
skip-all.t 100755 001750 001751 1320 15176664014 16321 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( source2pi );
use Test::Differences qw( eq_or_diff );
use Test::More import => [qw( done_testing ok )];
my $e = source2pi(
'test-data/skip-all.t',
q{use Test::More 0.93 skip_all => 'Test is broken', tests => 3, foo => ['bar'] ;},
);
ok( !$e->_is_ignored, 'not an ignored module' );
my $expected = <<'EOF';
use Test::More 0.93 import => [qw( is is_deeply ok )],
foo => ['bar'],
skip_all => 'Test is broken',
tests => 3;
EOF
chomp $expected;
eq_or_diff(
$e->formatted_ppi_statement . q{},
$expected,
'formatted_ppi_statement'
);
done_testing();
typeglob.t 100755 001750 001751 575 15176664014 16425 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( File::chdir );
my ($doc) = doc(
filename => 'test-data/typeglob.pl',
selection => 'use File::chdir;',
);
is(
$doc->tidied_document,
'use File::chdir qw( *CWD );',
'translates $CWD to *CWD in import'
);
done_testing;
variable.t 100644 001750 001751 1051 15176664014 16370 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib';
use Test::More import => [qw( done_testing is is_deeply )];
use TestHelper qw( source2pi );
my $source_text = 'use Getopt::Long qw( $REQUIRE_ORDER $RETURN_IN_ORDER );';
my $include = source2pi( 'test-data/variable.pl', $source_text );
is(
$include->formatted_ppi_statement,
$source_text,
'variable in block is found'
);
is_deeply(
$include->_document->interpolated_symbols,
{ '$REQUIRE_ORDER' => 1, '$RETURN_IN_ORDER' => 1, },
'interpolated_symbols'
);
done_testing();
precious.toml 100644 001750 001751 3376 15176664014 16715 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 exclude = [
# Used by Dist::Zilla
".build",
"build_dir/**/*",
"App-perlimports-*",
"blib",
"inc",
"test-data/**/*",
# All of these are generated by Dist::Zilla
"t/00-*",
"t/author-*",
"t/release-*",
"xt/author",
"xt/release",
]
[commands.omegasort-gitignore]
type = "both"
include = "**/.gitignore"
cmd = [ "omegasort", "--sort=text" ]
lint_flags = "--check"
tidy_flags = "--in-place"
ok_exit_codes = 0
lint_failure_exit_codes = 1
# If you have an external stopwords file for use with Test::Spelling
[commands.omegasort-stopwords]
type = "both"
include = ".stopwords"
cmd = [ "omegasort", "--sort=text", "--case-insensitive" ]
lint_flags = "--check"
tidy_flags = "--in-place"
ok_exit_codes = 0
lint_failure_exit_codes = 1
[commands.perlimports]
type = "both"
include = [ "**/*.{pl,pm,t,psgi}" ]
cmd = [ "perl", "-Ilib", "script/perlimports" ]
lint_flags = ["--lint" ]
tidy_flags = ["-i" ]
ok_exit_codes = 0
ignore_stderr = [".* OK"]
[commands.perltidy]
type = "both"
include = [ "**/*.{pl,pm,t,psgi}" ]
cmd = [ "perltidy", "--profile=$PRECIOUS_ROOT/perltidyrc" ]
lint_flags = [ "--assert-tidy", "--no-standard-output", "--outfile=/dev/null" ]
tidy_flags = [ "--backup-and-modify-in-place", "--backup-file-extension=/" ]
ok_exit_codes = 0
lint_failure_exit_codes = 2
[commands.perlcritic]
type = "lint"
include = [ "**/*.{pl,pm,psgi}" ]
cmd = [ "perlcritic", "--profile=$PRECIOUS_ROOT/perlcriticrc" ]
ok_exit_codes = 0
lint_failure_exit_codes = 2
[commands.perlcritic-tests]
type = "lint"
include = [ "**/*.{t}" ]
cmd = [ "perlcritic", "--profile=$PRECIOUS_ROOT/perlcriticrc", "--severity=3", "--theme=(core+pbp+bugs+maintenance+cosmetic+complexity+security+moose+tests) && !nontest" ]
ok_exit_codes = 0
lint_failure_exit_codes = 2
constants.t 100644 001750 001751 3142 15176664014 16622 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use feature 'say';
use lib 'test-data/lib', 't/lib';
use App::perlimports::Document ();
use TestHelper qw( logger );
use Test::More import => [qw( done_testing is is_deeply ok subtest )];
subtest 'constants parsed' => sub {
my @log;
my $doc = App::perlimports::Document->new(
lint => 1,
filename => 'test-data/use-constant.pm',
logger => logger( \@log ),
);
is $doc->linter_success, q{}, 'test code has lint issues';
my @possible = $doc->possibly_imported_tokens;
my $found = $doc->_ppi_selection->find(
sub {
$_[1]->isa('PPI::Statement::Package')
&& $_[1]->file_scoped;
}
) || [];
my ($packname) = map { $_->namespace } @$found;
ok $packname, "package name $packname detected";
$found = grep { $_ eq $packname } @possible;
is $found, 0, 'package name is excluded from possible_imports';
$found = grep { $_ eq 'package' } @possible;
is $found, 0, 'keyword "package" also excluded';
$found = grep { $_ eq 'use' } @possible;
is $found, 0, 'keyword "use" also excluded';
my @cnames
= qw(FIRST_IDX IDX_FORMAT IDX_SEP IDX_SEP_RE IDX_STR IDX_UTIME);
my @found = sort $doc->all_constants;
is_deeply \@found, \@cnames, 'parsed all 6 constants';
# find all "possible imported" tokens that match any of the constants
my %cnames = map { $_ => 1 } @cnames;
my @matches = grep { $cnames{"$_"} } @possible;
is scalar(@matches), 0,
'constants are entirely excluded from possible_imports';
};
done_testing();
is-ignored.t 100755 001750 001751 1114 15176664014 16646 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is ok )];
my ($doc) = doc(
filename => 'test-data/lib/Local/UsesTypesStandard.pm',
);
my $expected = <<'EOF';
package Local::UsesTypesStandard;
use Types::Standard;
1;
EOF
my $includes = $doc->ppi_document->find('PPI::Statement::Include');
is( $includes->[0]->module, 'Types::Standard', 'module name' );
ok( $doc->_is_ignored( $includes->[0] ), 'is_ignored flag set' );
is( $doc->tidied_document, $expected, 'Types::Standard is ignored' );
done_testing();
quoted-var.t 100755 001750 001751 1255 15176664014 16703 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use Path::Tiny qw( path );
use TestHelper qw( source2pi );
use Test::More import => [qw( done_testing is ok )];
my $filename = 'test-data/quoted-var.pl';
my $content = path($filename)->slurp;
my $doc = PPI::Document->new( \$content );
my $includes = $doc->find(
sub {
$_[1]->isa('PPI::Statement::Include');
}
) || [];
my $e = source2pi(
$filename,
undef,
{ include => $includes->[2] },
);
ok( !$e->_is_ignored, 'is not ignored' );
is(
$e->formatted_ppi_statement,
'use IO::Uncompress::Gunzip qw( $GunzipError );',
'var is detected inside of quotes'
);
done_testing();
signatures.t 100644 001750 001751 1441 15176664014 16772 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use Test::Differences qw( eq_or_diff );
use Test::More import => [qw( done_testing )];
use Test::Needs { 'HTTP::Status' => 6.28, perl => 5.020 };
use lib 't/lib';
use TestHelper qw( doc );
my $expected = <<'EOF';
use strict;
use warnings;
use v5.20;
use feature qw(signatures);
no warnings qw(experimental::signatures);
use signatures;
use FindBin qw( $Bin );
use HTTP::Status qw( HTTP_CONTINUE HTTP_OK );
## no critic (Subroutines::ProhibitSubroutinePrototypes)
sub one ( $continue = HTTP_CONTINUE, $foo = 'bar', $two = HTTP_OK() ) {
return $continue;
}
sub two ( $cwd = $Bin ) { }
EOF
my ($doc)
= doc( filename => 'test-data/signatures.pl', preserve_unused => 0 );
eq_or_diff( $doc->tidied_document, $expected, 'tidied_document' );
done_testing;
test-data 000755 001750 001751 0 15176664014 15704 5 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 a.pl 100755 001750 001751 152 15176664014 16602 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data #!/usr/bin/env perl
use strict;
use warnings;
use MooseX::Types::UUID qw(UUID);
foo(UUID);
sub foo {}
b.pl 100644 001750 001751 171 15176664014 16601 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data #!/usr/bin/env perl
use strict;
use warnings;
use MooseX::Types::UUID ();
use UUID qw( uuid );
foo(uuid);
sub foo {}
author 000755 001750 001751 0 15176664014 15753 5 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/xt eol.t 100644 001750 001751 5551 15176664014 17065 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/xt/author use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19
use Test::More 0.88;
use Test::EOL;
my @files = (
'lib/App/perlimports.pm',
'lib/App/perlimports/Annotations.pm',
'lib/App/perlimports/CLI.pm',
'lib/App/perlimports/Config.pm',
'lib/App/perlimports/Document.pm',
'lib/App/perlimports/ExportInspector.pm',
'lib/App/perlimports/Include.pm',
'lib/App/perlimports/Role/Logger.pm',
'lib/App/perlimports/Sandbox.pm',
'script/dump-perl-exports',
'script/perlimports',
't/00-report-prereqs.dd',
't/00-report-prereqs.t',
't/Config.t',
't/Document.t',
't/ExportInspector/SubExporter.t',
't/ExportInspector/load.t',
't/Sandbox.t',
't/after.t',
't/annotations.t',
't/args-in-import.t',
't/builtin.t',
't/carp.t',
't/cast-in-regex.t',
't/cast.t',
't/cli-args.t',
't/cli.t',
't/config-in-import.t',
't/constants.t',
't/cpan-modules/pithub.t',
't/cpan-modules/test2-v0.t',
't/datetime.t',
't/do-block.t',
't/doc-imports.t',
't/double-quoted-q.t',
't/dump-perl-exports.t',
't/dupes.t',
't/english.t',
't/explodes.t',
't/export-tags.t',
't/exported-variables.t',
't/find-bin.t',
't/fully-qualified.t',
't/func-in-use.t',
't/func-in-var.t',
't/function-reference.t',
't/geo-ip.t',
't/hash-in-regex.t',
't/hash-key-expression.t',
't/hash-key.t',
't/hash-unquoted-key.t',
't/heredoc.t',
't/ignored-modules.t',
't/import-error.t',
't/indent.t',
't/interpolation.t',
't/is-ignored.t',
't/lib/TestHelper.pm',
't/locally-defined-sub.t',
't/lookalike-words.t',
't/maybe-new-include.t',
't/memoize.t',
't/meta.t',
't/method.t',
't/missing-semicolon-in-import.t',
't/module-with-inner-packages.t',
't/moo.t',
't/moose-types.t',
't/moose.t',
't/moosex-types-moose.t',
't/nested-quotes.t',
't/never-exports.t',
't/original-imports.t',
't/pad-brackets.t',
't/padding.t',
't/perl-imports.t',
't/perl.t',
't/perlimports.t',
't/pragma.t',
't/preserve-some-padding.t',
't/preserve-spaces.t',
't/qualified-bareword.t',
't/quoted-var.t',
't/re-export-via-sub-exporter.t',
't/regex-replacement.t',
't/require.t',
't/script-with-inner-packages.t',
't/signatures.t',
't/skip-all.t',
't/socket.t',
't/sort-imports.t',
't/switches-in-import.t',
't/symbol-as-method-call.t',
't/symbol-in-export.t',
't/test-builder.t',
't/tie.t',
't/typeglob.t',
't/unnest-quotes.t',
't/use-and-require.t',
't/var-in-hash-key.t',
't/var-in-regex.t',
't/variable.t',
't/via-sub-exporter-exception.pl',
't/warning.t',
't/with-version.t'
);
eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files;
done_testing;
CONTRIBUTING.md 100644 001750 001751 677 15176664014 16401 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 CONTRIBUTING
* [Git Hooks](#git-hooks)
* [Sending Pull Requests](#sending-pull-requests)
# Git Hooks
A pre-commit hook that runs `precious lint --staged` is provided. To install it:
```
bash git/setup.sh
```
# Sending Pull Requests
If you're proposing an invasive change, please get in touch first by opening a
GitHub issue so we can co-ordinate before significant work is invested.
annotations.t 100755 001750 001751 4520 15176664014 17147 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib';
use App::perlimports::Annotations ();
use PPI::Document ();
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is ok subtest )];
subtest 'mixed' => sub {
my $doc = PPI::Document->new( 'test-data/annotation.pl', readonly => 1, );
die 'could not parse' unless $doc;
my $anno = App::perlimports::Annotations->new( ppi_document => $doc );
my $includes = $doc->find('PPI::Statement::Include');
is( $includes->[0]->module, 'strict', 'strict' );
ok( !$anno->is_ignored( $includes->[0] ), 'pragma not ignored' );
is( $includes->[1]->module, 'warnings', 'warnings' );
ok( !$anno->is_ignored( $includes->[1] ), 'pragma not ignored' );
is( $includes->[2]->module, 'Carp', 'Carp' );
ok( $anno->is_ignored( $includes->[2] ), 'Carp is ignored' );
is( $includes->[3]->module, 'POSIX', 'POSIX' );
ok( !$anno->is_ignored( $includes->[3] ), 'POSIX is not ignored' );
is( $includes->[4]->module, 'Cwd', 'Cwd' );
ok( $anno->is_ignored( $includes->[4] ), 'Cwd is ignored' );
is( $includes->[5]->module, 'Digest', 'Digest' );
ok( $anno->is_ignored( $includes->[5] ), 'Digest is ignored' );
is( $includes->[6]->module, 'Encode', 'Encode' );
ok( !$anno->is_ignored( $includes->[6] ), 'Encode is not ignored' );
};
subtest 'all' => sub {
my $doc = PPI::Document->new(
'test-data/annotate-everything.pl',
readonly => 1,
);
die 'could not parse' unless $doc;
my $anno = App::perlimports::Annotations->new( ppi_document => $doc );
my $includes = $doc->find('PPI::Statement::Include');
for my $include ( @{$includes} ) {
ok( $anno->is_ignored($include), "$include ignored" );
}
};
subtest 'via Document.pm' => sub {
my ($doc)
= doc( filename => 'test-data/annotation.pl', preserve_unused => 0, );
my $expected = <<'EOF';
use strict;
use warnings;
use Carp; ## no perlimports
use POSIX qw( sprintf );
## no perlimports
use Cwd;
use Digest;
## use perlimports
use Encode qw( decode encode );
use FindBin; # Reasons ## no perlimports
print decode(
'utf8',
sprintf(
'hey %s', encode( 'utf8', 'Sofia Margareta Götschenhjelm-Helin' )
)
);
EOF
is( $doc->tidied_document, $expected, 'tidied_document' );
};
done_testing();
doc-imports.t 100644 001750 001751 4635 15176664014 17056 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 'test-data/lib', 't/lib';
use App::perlimports::Document ();
use TestHelper qw( logger );
use Test::More import => [qw( done_testing is is_deeply subtest )];
subtest 'linting doesnt change found_imports' => sub {
my @log;
my $doc = App::perlimports::Document->new(
lint => 1,
filename => 'test-data/doc-imports.pl',
logger => logger( \@log ),
);
# expected value
my $original_imports = { Carp => [ 'confess', 'croak' ] };
is_deeply $doc->found_imports, $original_imports,
'found_imports before linting as expected';
my $result = $doc->linter_success;
is $result, q{}, 'linting failure';
my $found
= grep { $_->{message} =~ /import arguments need tidying/ } @log;
is $found, 2, 'log indicates Carp imports need fixing';
is_deeply $doc->found_imports, $original_imports,
'but doc found_imports unchanged in lint mode';
};
subtest 'found_imports edited' => sub {
my @log;
my $doc = App::perlimports::Document->new(
lint => 0,
filename => 'test-data/doc-imports.pl',
logger => logger( \@log ),
);
# expected original and cleaned values
my $original_imports = { Carp => [ 'confess', 'croak' ] };
my $clean_imports = { Carp => ['croak'] };
is_deeply $doc->found_imports, $original_imports,
'found_imports before editing as expected';
my $clean_source = $doc->tidied_document;
my $found
= grep { $_->{message} =~ /resetting imports for .use Carp/ } @log;
is $found, 2, 'log indicates Carp import was fixed';
is_deeply $doc->found_imports, $clean_imports,
'doc found_imports changed in edit mode';
# preserve_duplicates defaulted to 1, so we now have two
# identical use statements!
# diag $clean_source;
# -----------
@log = ();
my $ppi_doc = PPI::Document->new( \$clean_source );
my $cdoc = App::perlimports::Document->new(
lint => 1,
logger => logger( \@log ),
filename => 'none',
ppi_document => $ppi_doc,
);
is_deeply $cdoc->found_imports, $clean_imports,
'verified doc imports (with duplicate use statements)';
is $cdoc->linter_success, 1, 'lint succeeds';
is_deeply $cdoc->found_imports, $clean_imports,
'linting does not change doc found_imports';
};
done_testing();
export-tags.t 100644 001750 001751 1170 15176664014 17062 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::Differences qw( eq_or_diff );
use Test::More import => [qw( done_testing )];
use Test::Needs { 'HTTP::Status' => 6.28 };
my ($doc) = doc( filename => 'test-data/export-tags.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use HTTP::Status qw(
HTTP_I_AM_A_TEAPOT
HTTP_NO_CODE
HTTP_REQUEST_ENTITY_TOO_LARGE
);
my $pot = HTTP_I_AM_A_TEAPOT;
my $big = HTTP_REQUEST_ENTITY_TOO_LARGE;
my $what = HTTP_NO_CODE;
EOF
eq_or_diff(
$doc->tidied_document, $expected,
'export tags converted to symbols'
);
done_testing();
func-in-use.t 100644 001750 001751 1552 15176664014 16742 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc source2pi );
use Test::More import => [qw( done_testing is subtest )];
use Test::Needs;
subtest 'catdir' => sub {
test_needs { 'File::Spec::Functions' => '3.75' };
my $source_text = 'use File::Spec::Functions;';
my $e = source2pi( 'test-data/func-in-use.pl', $source_text );
is(
$e->formatted_ppi_statement,
'use File::Spec::Functions qw( catdir );',
'func in use statement is detected'
);
};
subtest 'Mojo::File' => sub {
test_needs { Mojolicious => '8.25' };
my ($doc) = doc(
filename => 'test-data/func-in-use-2.pl',
selection => 'use Mojo::File;',
);
is(
$doc->tidied_document,
'use Mojo::File qw( curfile );',
'func in use is recognized'
);
};
done_testing();
func-in-var.t 100755 001750 001751 573 15176664014 16723 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( Mojo::Util );
my ($doc) = doc(
filename => 'test-data/func-in-var.pl',
selection => 'use Mojo::Util;',
);
is(
$doc->tidied_document,
'use Mojo::Util qw( class_to_path );',
'func in hash key found'
);
done_testing;
moose-types.t 100755 001750 001751 1124 15176664014 17073 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib', 'test-data/lib';
use TestHelper qw( source2pi );
use Test::More import => [qw( done_testing is )];
use Test::Needs qw( MooseX::Types::Path::Class );
my $e = source2pi(
'test-data/messy-imports.pl',
'use Local::MooseTypeLibrary;',
);
my $expected = <<'EOF';
use Local::MooseTypeLibrary qw(
ArrayRef
Bool
CodeRef
FileHandle
HashRef
Maybe
Object
RegexpRef
Str
);
EOF
chomp $expected;
is(
$e->formatted_ppi_statement,
$expected,
'formatted_ppi_statement'
);
done_testing();
perlimports.t 100755 001750 001751 6500 15176664014 17172 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use Path::Tiny ();
use Test::Differences qw( eq_or_diff );
use Test::More import => [qw( done_testing subtest )];
use Test::Needs qw( Moose );
use Test::Script 1.27 qw(
script_compiles
script_fails
script_runs
script_stderr_is
script_stderr_like
script_stdout_like
);
use TOML::Tiny qw( from_toml );
my $script = 'script/perlimports';
my @filename = ( '--filename', 'test-data/carp.pl' );
script_compiles($script);
sub tmp_perl_file {
my $file = Path::Tiny->tempfile('testXXXX');
$file->spew('use strict;use warnings;');
return $file;
}
subtest 'provide config file' => sub {
my $file = tmp_perl_file();
script_runs(
[ $script, '--config-file', 'test-data/perlimports.toml', "$file" ] );
script_stderr_is( q{}, 'no errors' );
};
subtest 'config file not found' => sub {
my $file = tmp_perl_file();
script_fails(
[ $script, '--config-file', 'test-data/Xperlimports.toml', "$file" ],
{ exit => 1 }
);
script_stderr_like( qr{Xperlimports.toml not found}, 'not found error' );
};
subtest 'create config file' => sub {
my $dir = Path::Tiny->tempdir('testconfigXXXXXXXX');
my $file = $dir->child('perlimports.toml');
script_runs( [ $script, '--create-config-file', "$file" ] );
script_stderr_is( q{}, 'no errors' );
my $config = from_toml( $file->slurp );
eq_or_diff( $config->{libs}, [ 'lib', 't/lib' ], 'default libs' );
script_fails(
[ $script, '--create-config-file', "$file" ],
{ exit => 1 },
);
script_stderr_like( qr{already exists}, 'error clobbering file' );
};
subtest 'filename' => sub {
script_runs( [ $script, @filename ] );
script_stderr_is( q{}, 'no errors' );
};
subtest 'implied --filename' => sub {
script_runs( [ $script, 'test-data/carp.pl' ] );
script_stderr_is( q{}, 'no errors' );
};
subtest 'help' => sub {
script_runs( [ $script, '--help' ] );
script_stderr_is( q{}, 'no errors' );
};
subtest 'libs' => sub {
script_runs(
[
$script,
'--libs',
'test-data/lib',
'--filename',
'test-data/lib/Local/ViaExporter.pm',
]
);
script_stderr_is( q{}, 'no errors' );
};
subtest 'log level' => sub {
script_runs( [ $script, @filename, '--log-level', 'info', ] );
script_stderr_like( qr{Starting file: test-data/carp.pl}, 'no errors' );
};
subtest 'help' => sub {
script_runs( [ $script, '--help' ] );
script_stderr_is( q{}, 'no errors' );
};
subtest 'tidy_whitespace' => sub {
script_runs(
[
$script, '--no-config-file', '--no-tidy-whitespace',
'test-data/preserve-spaces.pl'
]
);
script_stderr_is( q{}, 'no errors' );
script_stdout_like( qr{use Carp \(\);}, 'whitespace preserved' );
};
subtest 'verbose help' => sub {
script_runs( [ $script, '--verbose-help' ] );
script_stderr_is( q{}, 'no errors' );
};
subtest 'version' => sub {
script_runs( [ $script, '--version' ] );
script_stderr_is( q{}, 'no errors' );
};
subtest 'Not Found' => sub {
script_fails(
[ $script, '--filename', 'x', ],
{ exit => 1 }
);
script_stderr_like(
qr{x does not appear to be a file},
'error when module not found'
);
};
done_testing();
foo.t 100644 001750 001751 101 15176664014 16764 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data use strict;
use warnings;
use Test::More;
ok(1);
done_testing;
perlimports.toml 100644 001750 001751 2200 15176664014 17425 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 # Valid log levels are:
# debug, info, notice, warning, error, critical, alert, emergency
# critical, alert and emergency are not currently used.
#
# Please use boolean values in this config file. Negated options (--no-*) are
# not permitted here. Explicitly set options to true or false.
#
# Some of these values deviate from the regular perlimports defaults. In
# particular, you're encouraged to leave preserve_duplicates and
# preserve_unused disabled.
cache = false # setting this to true is currently discouraged
ignore_modules = []
ignore_modules_filename = ""
ignore_modules_pattern = "" # regex like "^(Foo|Foo::Bar)"
ignore_modules_pattern_filename = ""
# indent = 4 # default: perltidy -i
libs = ["lib", "t/lib"]
log_level = "warn"
never_export_modules = []
never_export_modules_filename = ""
pad_brackets = false
padding = true
preserve_duplicates = false
preserve_unused = false
tidy_whitespace = true
import-error.t 100755 001750 001751 1023 15176664014 17246 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing ok )];
my $source_text = 'use Local::Module::Does::Not::Exist::At::All;';
my ( $doc, $log ) = doc(
filename => 'test-data/geo-ip.pl',
selection => $source_text,
);
$doc->tidied_document;
my $found = grep {
$_->{level} eq 'warning'
&& $_->{message} =~ qr{Can't locate Local/Module}
} @{$log};
ok(
$found,
'exception on module not found'
);
done_testing();
pad-brackets.t 100644 001750 001751 3570 15176664014 17153 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc source2pi );
use Test::More import => [qw( done_testing is subtest )];
subtest 'default (tight brackets)' => sub {
my $e = source2pi(
'test-data/foo.t',
'use Test::More;',
);
is(
$e->formatted_ppi_statement,
'use Test::More import => [qw( done_testing ok )];',
'default uses tight brackets'
);
};
subtest 'no padding' => sub {
my ($doc) = doc(
filename => 'test-data/foo.t',
pad_brackets => 0,
);
is(
$doc->tidied_document,
<<'EOF', 'pad_brackets=0 produces tight brackets' );
use strict;
use warnings;
use Test::More import => [qw( done_testing ok )];
ok(1);
done_testing;
EOF
};
subtest 'padded brackets explicitly' => sub {
my ($doc) = doc(
filename => 'test-data/foo.t',
pad_brackets => 1,
);
is(
$doc->tidied_document,
<<'EOF', 'pad_brackets=1 produces padded brackets' );
use strict;
use warnings;
use Test::More import => [ qw( done_testing ok ) ];
ok(1);
done_testing;
EOF
};
subtest 'path 1 tight brackets (test builder with args)' => sub {
my $e = source2pi(
'test-data/foo.t',
'use Test::More import => [qw( ok )];',
{ pad_brackets => 0 },
);
is(
$e->formatted_ppi_statement,
'use Test::More import => [qw( done_testing ok )];',
'path 1 with pad_brackets=0 produces tight brackets'
);
};
subtest 'path 1 padded brackets (test builder with args)' => sub {
my $e = source2pi(
'test-data/foo.t',
'use Test::More import => [qw( ok )];',
{ pad_brackets => 1 },
);
is(
$e->formatted_ppi_statement,
'use Test::More import => [ qw( done_testing ok ) ];',
'path 1 with pad_brackets=1 produces padded brackets'
);
};
done_testing();
perl-imports.t 100755 001750 001751 4370 15176664014 17252 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib', 'test-data/lib';
use TestHelper qw( doc source2pi );
use Test::More import => [qw( done_testing is is_deeply ok subtest )];
subtest 'Getopt::Long' => sub {
my $e = source2pi(
'test-data/foo.pl',
'use Getopt::Long;',
);
is(
$e->module_name(), 'Getopt::Long',
'module_name'
);
ok( $e->_has_explicit_exports, 'Found some _explicit_exports' );
ok( !$e->_isa_test_builder_module, 'isa_test_builder_module' );
is_deeply( $e->_imports, ['GetOptions'], '_imports' );
is(
$e->formatted_ppi_statement,
'use Getopt::Long qw( GetOptions );',
'formatted_ppi_statement'
);
};
subtest 'Test::More' => sub {
my $e = source2pi(
'test-data/foo.t',
'use Test::More;',
);
is(
$e->module_name(), 'Test::More',
'module_name'
);
ok( $e->_has_explicit_exports, 'Found some _explicit_exports' );
ok( $e->_isa_test_builder_module, 'isa_test_builder_module' );
is_deeply( $e->_imports, [qw( done_testing ok)], '_imports' );
is(
$e->formatted_ppi_statement,
'use Test::More import => [qw( done_testing ok )];',
'formatted_ppi_statement'
);
};
subtest 'pragma' => sub {
my ($doc) = doc(
filename => 'test-data/foo.t',
selection => 'use strict;',
);
is(
$doc->tidied_document,
'use strict;',
'formatted_ppi_statement'
);
};
subtest 'ViaExporter' => sub {
my $e = source2pi(
'test-data/via-exporter.pl',
'use Local::ViaExporter qw( foo $foo @foo %foo );',
);
is(
$e->module_name(), 'Local::ViaExporter',
'module_name'
);
is_deeply(
$e->_explicit_exports,
{
'$foo' => '$foo',
'%foo' => '%foo',
'@foo' => '@foo',
'foo' => 'foo',
},
'Found some _explicit_exports'
);
ok( !$e->_isa_test_builder_module, 'isa_test_builder_module' );
is_deeply( $e->_imports, [qw( foo $foo @foo %foo )], '_imports' );
is(
$e->formatted_ppi_statement,
'use Local::ViaExporter qw( foo $foo @foo %foo );',
'formatted_ppi_statement'
);
};
done_testing();
sort-imports.t 100644 001750 001751 1033 15176664014 17265 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib', 'test-data/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing )];
my ($doc) = doc( filename => 'test-data/sort.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Local::Sort qw( $AAA $AAA_2FA bbb @BBB %CCC );
bbb();
bbb_2fa();
if ( defined $AAA || defined $AAA_2FA || scalar @BBB || keys %CCC ) {
print 'defined';
}
EOF
eq_or_diff( $doc->tidied_document, $expected, 'sorted' );
done_testing();
test-builder.t 100644 001750 001751 426 15176664014 17173 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( inspector );
use Test::Needs qw( Test::HTML::Lint );
use Test::More import => [qw( done_testing ok )];
my ($ei) = inspector('Test::HTML::Lint');
ok( $ei->isa_test_builder, 'isa_test_builder' );
done_testing();
var-in-regex.t 100644 001750 001751 666 15176664014 17102 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use Test::More import => [qw( done_testing is )];
use TestHelper qw( source2pi );
use Test::Needs qw( Perl::Critic::Utils );
my $source_text = 'use Perl::Critic::Utils qw( $BACKTICK $PERIOD );';
my $include = source2pi( 'test-data/var-in-regex.pl', $source_text );
is(
$include->formatted_ppi_statement,
$source_text,
'exported var in regex is detected'
);
done_testing();
with-version.t 100644 001750 001751 1660 15176664014 17247 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [qw( diag done_testing )];
use Test::Needs {
'Cpanel::JSON::XS' => 4.19,
'Getopt::Long' => 2.40,
'LWP::UserAgent' => 5.00,
};
my ( $doc, $log ) = doc( filename => 'test-data/with-version.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Cpanel::JSON::XS 4.19 qw( decode_json );
use Getopt::Long 2.40 qw( GetOptions );
use LWP::UserAgent 5.00 ();
use Test::Script 1.27 qw(
script_compiles
script_runs
script_stderr_is
script_stderr_like
);
my $foo = decode_json( { foo => 'bar' } );
my @foo = GetOptions();
script_compiles();
script_runs();
script_stderr_is();
script_stderr_like();
EOF
eq_or_diff(
$doc->tidied_document,
$expected,
'versions preserved'
) || do { require Data::Dumper; diag Data::Dumper::Dumper($log); };
done_testing();
foo.pl 100755 001750 001751 133 15176664014 17144 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data #!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
my @foo = GetOptions();
meta.t 100644 001750 001751 115 15176664014 17134 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data use strict;
use warnings;
use Test2::V0 qw( !meta );
ok(1);
done_testing;
noop.t 100644 001750 001751 171 15176664014 17163 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data use strict;
use warnings;
use Test::More;
use Test::RequiresInternet ( 'www.example.com' => 80 );
ok(1);
done_testing;
tie.pl 100644 001750 001751 136 15176664014 17142 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data use strict;
use warnings;
use Tie::SubstrHash ();
tie my %hash, 'Tie::SubstrHash', 1, 1, 1;
cast-in-regex.t 100644 001750 001751 1143 15176664014 17253 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is_deeply )];
use Test::Needs qw( Lingua::EN::Inflect );
my ($doc) = doc(
filename => 'test-data/cast-in-regex.pl', preserve_unused => 0,
);
is_deeply( $doc->interpolated_symbols, {}, 'vars' );
my $expected = <<'END';
use strict;
use warnings;
my $thing = 'B';
if ( $thing =~ m{ \A b }x ) { ... }
END
eq_or_diff(
$doc->tidied_document,
$expected,
'Did not mistake \A for A() provided by Lingua::EN::Inflect'
);
done_testing();
hash-in-regex.t 100644 001750 001751 736 15176664014 17233 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is $TODO )];
my ($doc) = doc( filename => 'test-data/hash-in-regex.pl' );
my $expected = <<'EOF';
use strict;
use warnings;
use Config qw( $Config );
sub foo {
return $INC{'Foo.pm'} =~ /^\Q$Config{sitelibexp}/;
}
EOF
TODO: {
local $TODO = 'Cannot find hash var in regex yet';
is( $doc->tidied_document, $expected, 'var found' );
}
done_testing();
interpolation.t 100644 001750 001751 516 15176664014 17457 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing )];
my ($doc) = doc( filename => 'test-data/interpolation.pl' );
eq_or_diff(
$doc->interpolated_symbols, { '$code' => 1, encode => 1 },
'vars'
);
done_testing();
nested-quotes.t 100644 001750 001751 1144 15176664014 17406 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t use strict;
use warnings;
use lib 't/lib';
use Test::Differences qw( eq_or_diff );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing is_deeply )];
my ($doc) = doc( filename => 'test-data/nested-quotes.pl' );
is_deeply(
$doc->interpolated_symbols, { path => 1, '$thing' => 1, },
'vars'
);
my $expected = <<'EOF';
use strict;
use warnings;
use Path::Tiny qw( path );
my $thing = qq{content="${ \( path('one/two.txt')->stringify )}"};
print "$thing\n";
EOF
eq_or_diff(
$doc->tidied_document, $expected,
'function call in nested quotes detected'
);
done_testing();
never-exports.t 100755 001750 001751 3367 15176664014 17443 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use TestHelper qw( source2pi );
use Test::More import => [qw( done_testing is is_deeply ok subtest )];
use Test::Needs {
'Cpanel::JSON::XS' => 4.19,
'Getopt::Long' => 2.40,
'LWP::UserAgent' => 5.00,
'Test::Script' => 1.27,
};
subtest 'with version' => sub {
my $pi = source2pi(
'test-data/with-version.pl',
'use LWP::UserAgent 5.00;',
);
ok( !$pi->_is_ignored, '_is_ignored' );
is(
$pi->formatted_ppi_statement,
'use LWP::UserAgent 5.00 ();',
'formatted_ppi_statement'
);
ok( !$pi->_has_export_inspector, 'export inspection bypassed' );
is_deeply( $pi->_imports, [], '_imports' );
is_deeply( $pi->_explicit_exports, {}, 'no _explicit_exports' );
};
subtest 'without version' => sub {
my $pi = source2pi(
'test-data/with-version.pl',
'use LWP::UserAgent;',
);
ok( !$pi->_is_ignored, '_is_ignored' );
is(
$pi->formatted_ppi_statement,
'use LWP::UserAgent ();',
'formatted_ppi_statement'
);
ok( !$pi->_has_export_inspector, 'export inspection bypassed' );
is_deeply( $pi->_imports, [], '_imports' );
};
subtest 'without incorrect import' => sub {
my $pi = source2pi(
'test-data/with-version.pl',
'use LWP::UserAgent qw( new );',
);
ok( !$pi->_is_ignored, '_is_ignored' );
is(
$pi->formatted_ppi_statement,
'use LWP::UserAgent ();',
'formatted_ppi_statement'
);
ok( !$pi->_has_export_inspector, 'export inspection bypassed' );
is_deeply( $pi->_imports, [], '_imports' );
is_deeply( $pi->_explicit_exports, {}, 'no _explicit_exports' );
};
done_testing();
unnest-quotes.t 100644 001750 001751 556 15176664014 17426 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/t #!perl
use strict;
use warnings;
use lib 't/lib';
use List::Util qw( none );
use TestHelper qw( doc );
use Test::More import => [qw( done_testing ok )];
my ( $doc, $logs ) = doc(
filename => 'test-data/unnest-quotes.pl',
);
$doc->tidied_document;
ok(
do {
none { $_->{level} eq 'error' } @$logs;
},
'no errors in logs'
);
done_testing;
carp.pl 100644 001750 001751 110 15176664014 17276 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data use strict;
use warnings;
use Carp qw( croak verbose );
croak('oof');
cast.pl 100644 001750 001751 136 15176664014 17313 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data use strict;
use warnings;
use Mojo::Util;
my @pairs = map {@$_} @{split_header $str // ''};
sort.pl 100644 001750 001751 307 15176664014 17350 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/test-data use strict;
use warnings;
use Local::Sort qw( $AAA_2FA bbb bba_2fa $AAA @BBB %CCC );
bbb();
bbb_2fa();
if ( defined $AAA || defined $AAA_2FA || scalar @BBB || keys %CCC ) {
print 'defined';
}
script 000755 001750 001751 0 15176664014 15322 5 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060 perlimports 100755 001750 001751 60646 15176664014 20024 0 ustar 00olaf olaf 000000 000000 App-perlimports-0.000060/script #!perl
use strict;
use warnings;
use App::perlimports::CLI ();
use Try::Tiny qw( catch try );
my $exit_code = 0;
try {
$exit_code = App::perlimports::CLI->new->run;
}
catch {
print STDERR $_;
$exit_code = 1;
};
exit($exit_code);
# PODNAME: perlimports
# ABSTRACT: A command line utility for cleaning up imports in your Perl code
__END__
=pod
=encoding UTF-8
=head1 NAME
perlimports - A command line utility for cleaning up imports in your Perl code
=head1 VERSION
version 0.000060
=head1 SYNOPSIS
Create a config file called C at the top level of your
application or repository:
perlimports --create-config-file perlimports.toml
You can also have a config file with a leading C<.>.
perlimports --create-config-file .perlimports.toml
For system-wide defaults, you can create a file in C<$XDG_HOME>. Something like:
perlimports --create-config-file ~/.config/perlimports/perlimports.toml
After you have set up the config file to your liking, you can do away with most
command line switches, other than C<-i>, C<--lint> or C<--read-stdin>.
Now, let's update a file in place. (Make sure you can revert the file if you
need to, as C will not make a backup.)
perlimports -i foo.pl
Lint a file:
perlimports --lint foo.pl
In-place edits on directories:
perlimports -i lib t xt
Lint directories:
perlimports --lint lib t xt
In-place edits on files and directories
perlimports -i foo.pl lib t xt
Run C on a file and only print the results to STDOUT.
perlimports foo.pl
If some of your imported modules are in local directories, you can give some
hints as to where to find them:
perlimports -i --libs t/lib,/some/dir/lib foo.pl
Redirect output to a new file:
perlimports foo.pl > foo.new.pl
=head1 DESCRIPTION
This distribution provides the C command line interface (CLI),
which automates the cleanup and maintenance of Perl C