Perl-Critic-Freenode-0.033 000755 001750 001750 0 13770240140 15360 5 ustar 00grinnz grinnz 000000 000000 README 100644 001750 001750 10322 13770240140 16337 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 NAME
Perl::Critic::Freenode - Perl::Critic policies inspired by #perl on
freenode IRC
SYNOPSIS
$ perlcritic --theme freenode script.pl
$ perlcritic --theme freenode lib/
# .perlcriticrc
theme = freenode
severity = 1
DESCRIPTION
A set of Perl::Critic policies to enforce the practices generally
recommended by the denizens of #perl on Freenode IRC
. Because this policy "theme" is designed to be
used with zero configuration on the command line, some duplication will
occur if it is used in combination with core Perl::Critic policies.
AFFILIATION
This module has no functionality, but instead contains documentation
for this distribution and acts as a means of pulling other modules into
a bundle. All of the Policy modules contained herein will have an
"AFFILIATION" section announcing their participation in this grouping.
POLICIES
Perl::Critic::Policy::Freenode::AmpersandSubCalls
Don't use & to call subroutines
Perl::Critic::Policy::Freenode::ArrayAssignAref
Don't assign an anonymous arrayref to an array
Perl::Critic::Policy::Freenode::BarewordFilehandles
Don't use bareword filehandles other than built-ins
Perl::Critic::Policy::Freenode::ConditionalDeclarations
Don't declare variables conditionally
Perl::Critic::Policy::Freenode::ConditionalImplicitReturn
Don't end a subroutine with a conditional block
Perl::Critic::Policy::Freenode::DeprecatedFeatures
Avoid features that have been deprecated or removed from Perl
Perl::Critic::Policy::Freenode::DiscouragedModules
Various modules discouraged from use
Perl::Critic::Policy::Freenode::DollarAB
Don't use $a or $b as variable names outside sort()
Perl::Critic::Policy::Freenode::Each
Don't use each() to iterate through a hash
Perl::Critic::Policy::Freenode::EmptyReturn
Don't use return with no arguments
Perl::Critic::Policy::Freenode::IndirectObjectNotation
Don't call methods indirectly
Perl::Critic::Policy::Freenode::LexicalForeachIterator
Don't use undeclared foreach loop iterators
Perl::Critic::Policy::Freenode::LoopOnHash
Don't loop over hashes
Perl::Critic::Policy::Freenode::ModPerl
Don't use mod_perl to write web applications
Perl::Critic::Policy::Freenode::MultidimensionalArrayEmulation
Don't use multidimensional array emulation
Perl::Critic::Policy::Freenode::OpenArgs
Always use the three-argument form of open()
Perl::Critic::Policy::Freenode::OverloadOptions
Don't use overload without specifying a bool overload and enabling
fallback
Perl::Critic::Policy::Freenode::PackageMatchesFilename
Module files should declare a package matching the filename
Perl::Critic::Policy::Freenode::POSIXImports
Don't use POSIX without specifying an import list
Perl::Critic::Policy::Freenode::PreferredAlternatives
Various modules with preferred alternatives
Perl::Critic::Policy::Freenode::Prototypes
Don't use function prototypes
Perl::Critic::Policy::Freenode::StrictWarnings
Always use strict and warnings, or a module that imports these
Perl::Critic::Policy::Freenode::Threads
Interpreter-based threads are officially discouraged
Perl::Critic::Policy::Freenode::Wantarray
Don't write context-sensitive functions using wantarray()
Perl::Critic::Policy::Freenode::WarningsSwitch
Scripts should not use the -w switch on the shebang line
Perl::Critic::Policy::Freenode::WhileDiamondDefaultAssignment
Don't use while with implicit assignment to $_
CONFIGURATION AND ENVIRONMENT
All policies included are in the "freenode" theme. See the Perl::Critic
documentation for how to make use of this.
AUTHOR
Dan Book, dbook@cpan.org
CONTRIBUTORS
Graham Knop (haarg)
H.Merijn Brand (Tux)
John SJ Anderson (genehack)
Matt S Trout (mst)
William Taylor (willt)
COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it
under the terms of the Artistic License version 2.0.
SEE ALSO
Perl::Critic
Changes 100600 001750 001750 11533 13770240140 16747 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 0.033 2020-12-21 19:39:58 EST
- Update various recommendations for alternatives in DiscouragedModules policy
- Add better examples for EmptyReturn (#39) and Each policies
0.032 2019-11-11 11:09:08 EST
- Add check for CORE::wantarray and CORE'wantarray to WantArray policy (simcop2387 #37)
0.031 2019-09-25 19:00:39 EDT
- Add FindBin to DiscouragedModules policy (#31)
- Add MultidimensionalArrayEmulation policy (#35)
0.030 2019-08-26 11:27:15 EDT
- Allow signature_enablers to be configured for Prototypes policy (#34)
0.029 2019-04-26 13:12:43 EDT
- Added LexicalForeachIterator policy
- Require PPI 1.252+ allowing simplifications to the DeprecatedFeatures and
WhileDiamondDefaultAssignment policies
0.028 2018-11-29 19:32:49 EST
- Split out lower severity violations from DiscouragedModules policy into a
new PreferredAlternatives policy. Perl::Critic does not support filtering
individual violations by severity, only policies, so this will allow
separately configuring and filtering these violations.
- Fixed DiscouragedModules and DeprecatedFeatures policy violations to report
severity as configured.
- Fixed DeprecatedFeatures to avoid false positives on method calls with the
same name as autoderef functions.
- Added /\C/, chdir(''), and bare here-docs to DeprecatedFeatures policy.
0.027 2018-06-20 20:17:06 EDT
- Add LoopOnHash policy
0.026 2018-02-16 20:50:14 EST
- Update Prototypes policy to recognize more ways of activating the signatures feature
0.025 2018-02-11 01:31:58 EST
- Fix DeprecatedFeatures to recognize correctly-parsed postderef in PPI 1.237+
- Avoid warning from running PackageMatchesFilename policy on a document without a filename (willt #29)
- Fix another false positive in DollarAB policy
0.024 2017-08-16 22:39:53 EDT
- Make PackageMatchesFilename more robust against infinite loops
0.023 2017-08-16 22:22:40 EDT
- Fix issue where PackageMatchesFilename policy would loop infinitely
0.022 2017-08-16 22:17:38 EDT
- Also consider -W a violation of WarningsSwitch policy
- Fix false positive in DollarAB policy where $a or $b is within another block
- Add PackageMatchesFilename policy
0.021 2017-06-03 19:49:16 EDT
- Be more lenient when trying to detect postderef for DeprecatedFeatures autoderef violations
0.020 2017-05-15 20:45:02 EDT
- Updates to documentation for DeprecatedFeatures and DiscouragedModules policies
- Add require ::Foo::Bar to DeprecatedFeatures policy
- Remove qr//xx from DeprecatedFeatures policy as this is now a valid regex modifier in 5.26.
0.019 2017-01-29 22:13:34 EST
- Add autoderef to DeprecatedFeatures policy
0.018 2016-12-08 21:32:40 EST
- Add IndirectObjectNotation policy
0.017 2016-09-29 17:24:15 EDT
- DeprecatedFeatures will now consider "use UNIVERSAL;" a policy violation
- Add OverloadOptions policy
0.016 2016-07-02 17:53:20 EDT
- Support <<>> operator in WhileDiamondDefaultAssignment policy
- Fixes for DeprecatedFeatures checking of /xx violations
0.015 2016-07-02 03:20:35 EDT
- add ArrayAssignAref policy
- update DeprecatedFeatures policy with features deprecated in 5.22 and to be removed in 5.26
0.014 2016-01-26 20:45:18 EST
- allow pairwise in DollarAB policy
- allow DollarAB pair functions to be extended
0.013 2015-12-17 18:07:03 EST
- Add ConditionalDeclarations policy
0.012 2015-10-16 15:13:21 EDT
- add IO::Socket::INET6 to discouraged modules
- Fix EmptyReturn to avoid reporting violations in void context functions
- Add POSIXImports policy
- Add ConditionalImplicitReturn policy
0.011 2015-09-15 13:32:44 EDT
- add Getopt::Std to discouraged modules
- Fix EmptyReturn to catch more cases
- Add DeprecatedFeatures policy
0.010 2015-08-28 17:11:40 EDT
- Fix Changes
- Change installer to Module::Build::Tiny
0.009 2015-08-27 15:09:22 EDT
- Add Class::DBI, Error.pm, and Readonly.pm to discouraged modules
0.008 2015-08-25 21:42:10 EDT
- Various documentation updates
- Add Switch.pm to discouraged modules
0.007 2015-08-15 17:18:23 EDT
- fix StrictWarnings parsing of "use VERSION" (Tux)
- handle readline/readdir/each in WhileDiamondDefaultAssignment
0.006 2015-07-30 22:34:15 EDT
- just use core policy for AmpersandSubCalls
- add clarification for policies that are similar to core policies
0.005 2015-07-13 10:49:45 EDT
- fix false positives in DollarAB policy
0.004 2015-07-01 17:21:16 EDT
- use default strict/warnings importers from Perl::Critic::Utils::Constants
0.003 2015-06-27 17:53:00 EDT
- allow prototypes containing &
- add Each polciy
- make StrictWarnings policy configurable with extra importers
0.002 2015-06-27 00:07:19 EDT
- add AmpersandSubCalls policy
- add policy abstracts
0.001 2015-06-26 21:01:32 EDT
- First release
LICENSE 100644 001750 001750 21515 13770240140 16472 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 This software is Copyright (c) 2015 by Dan Book.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
Definitions
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
procedures.
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
Holder.
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
Version.
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
under
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
license.
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty:
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
INSTALL 100644 001750 001750 4474 13770240140 16503 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 This is the Perl distribution Perl-Critic-Freenode.
Installing Perl-Critic-Freenode is straightforward.
## Installation with cpanm
If you have cpanm, you only need one line:
% cpanm Perl::Critic::Freenode
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 Perl::Critic::Freenode
## Manual installation
As a last resort, you can manually install it. Download the tarball, untar it,
install configure prerequisites (see below), then build it:
% perl Build.PL
% ./Build && ./Build test
Then install it:
% ./Build install
Or the more portable variation:
% perl Build.PL
% perl Build
% perl Build test
% perl Build install
If your perl is system-managed, you can create a local::lib in your home
directory to install modules to. For details, see the local::lib documentation:
https://metacpan.org/pod/local::lib
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
Build.PL.
Look for prerequisites in the following phases:
* to run ./Build, 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
Perl-Critic-Freenode documentation is available as POD.
You can run `perldoc` from a shell to read the documentation:
% perldoc Perl::Critic::Freenode
For more information on installing Perl modules via CPAN, please see:
https://www.cpan.org/modules/INSTALL.html
dist.ini 100644 001750 001750 463 13770240140 17070 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 name = Perl-Critic-Freenode
author = Dan Book
license = Artistic_2_0
copyright_holder = Dan Book
copyright_year = 2015
[@Author::DBOOK]
:version = v1.0.2
installer = ModuleBuildTiny::Fallback
irc = irc://chat.freenode.net/#perl
pod_tests = syntax
Test::ReportPrereqs.include[] = PPI
META.yml 100644 001750 001750 12556 13770240140 16743 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 ---
abstract: 'Perl::Critic policies inspired by #perl on freenode IRC'
author:
- 'Dan Book '
build_requires:
File::Spec: '0'
Module::Metadata: '0'
Test::More: '0'
configure_requires:
Module::Build::Tiny: '0.034'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Perl-Critic-Freenode
no_index:
directory:
- eg
- examples
- inc
- share
- t
- xt
provides:
Perl::Critic::Freenode:
file: lib/Perl/Critic/Freenode.pm
version: '0.033'
Perl::Critic::Freenode::Utils:
file: lib/Perl/Critic/Freenode/Utils.pm
version: '0.033'
Perl::Critic::Policy::Freenode::AmpersandSubCalls:
file: lib/Perl/Critic/Policy/Freenode/AmpersandSubCalls.pm
version: '0.033'
Perl::Critic::Policy::Freenode::ArrayAssignAref:
file: lib/Perl/Critic/Policy/Freenode/ArrayAssignAref.pm
version: '0.033'
Perl::Critic::Policy::Freenode::BarewordFilehandles:
file: lib/Perl/Critic/Policy/Freenode/BarewordFilehandles.pm
version: '0.033'
Perl::Critic::Policy::Freenode::ConditionalDeclarations:
file: lib/Perl/Critic/Policy/Freenode/ConditionalDeclarations.pm
version: '0.033'
Perl::Critic::Policy::Freenode::ConditionalImplicitReturn:
file: lib/Perl/Critic/Policy/Freenode/ConditionalImplicitReturn.pm
version: '0.033'
Perl::Critic::Policy::Freenode::DeprecatedFeatures:
file: lib/Perl/Critic/Policy/Freenode/DeprecatedFeatures.pm
version: '0.033'
Perl::Critic::Policy::Freenode::DiscouragedModules:
file: lib/Perl/Critic/Policy/Freenode/DiscouragedModules.pm
version: '0.033'
Perl::Critic::Policy::Freenode::DollarAB:
file: lib/Perl/Critic/Policy/Freenode/DollarAB.pm
version: '0.033'
Perl::Critic::Policy::Freenode::Each:
file: lib/Perl/Critic/Policy/Freenode/Each.pm
version: '0.033'
Perl::Critic::Policy::Freenode::EmptyReturn:
file: lib/Perl/Critic/Policy/Freenode/EmptyReturn.pm
version: '0.033'
Perl::Critic::Policy::Freenode::IndirectObjectNotation:
file: lib/Perl/Critic/Policy/Freenode/IndirectObjectNotation.pm
version: '0.033'
Perl::Critic::Policy::Freenode::LexicalForeachIterator:
file: lib/Perl/Critic/Policy/Freenode/LexicalForeachIterator.pm
version: '0.033'
Perl::Critic::Policy::Freenode::LoopOnHash:
file: lib/Perl/Critic/Policy/Freenode/LoopOnHash.pm
version: '0.033'
Perl::Critic::Policy::Freenode::ModPerl:
file: lib/Perl/Critic/Policy/Freenode/ModPerl.pm
version: '0.033'
Perl::Critic::Policy::Freenode::MultidimensionalArrayEmulation:
file: lib/Perl/Critic/Policy/Freenode/MultidimensionalArrayEmulation.pm
version: '0.033'
Perl::Critic::Policy::Freenode::OpenArgs:
file: lib/Perl/Critic/Policy/Freenode/OpenArgs.pm
version: '0.033'
Perl::Critic::Policy::Freenode::OverloadOptions:
file: lib/Perl/Critic/Policy/Freenode/OverloadOptions.pm
version: '0.033'
Perl::Critic::Policy::Freenode::POSIXImports:
file: lib/Perl/Critic/Policy/Freenode/POSIXImports.pm
version: '0.033'
Perl::Critic::Policy::Freenode::PackageMatchesFilename:
file: lib/Perl/Critic/Policy/Freenode/PackageMatchesFilename.pm
version: '0.033'
Perl::Critic::Policy::Freenode::PreferredAlternatives:
file: lib/Perl/Critic/Policy/Freenode/PreferredAlternatives.pm
version: '0.033'
Perl::Critic::Policy::Freenode::Prototypes:
file: lib/Perl/Critic/Policy/Freenode/Prototypes.pm
version: '0.033'
Perl::Critic::Policy::Freenode::StrictWarnings:
file: lib/Perl/Critic/Policy/Freenode/StrictWarnings.pm
version: '0.033'
Perl::Critic::Policy::Freenode::Threads:
file: lib/Perl/Critic/Policy/Freenode/Threads.pm
version: '0.033'
Perl::Critic::Policy::Freenode::Wantarray:
file: lib/Perl/Critic/Policy/Freenode/Wantarray.pm
version: '0.033'
Perl::Critic::Policy::Freenode::WarningsSwitch:
file: lib/Perl/Critic/Policy/Freenode/WarningsSwitch.pm
version: '0.033'
Perl::Critic::Policy::Freenode::WhileDiamondDefaultAssignment:
file: lib/Perl/Critic/Policy/Freenode/WhileDiamondDefaultAssignment.pm
version: '0.033'
requires:
Carp: '0'
Exporter: '0'
List::Util: '1.33'
PPI: '1.254'
Path::Tiny: '0.101'
Perl::Critic: '1.126'
Perl::Critic::Policy::Objects::ProhibitIndirectSyntax: '1.126'
Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils: '1.126'
Perl::Critic::Policy::ValuesAndExpressions::ProhibitArrayAssignAref: '90'
Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations: '1.126'
Perl::Critic::Policy::Variables::ProhibitLoopOnHash: '0.005'
Perl::Critic::Policy::Variables::RequireLexicalLoopIterators: '1.126'
Scalar::Util: '0'
parent: '0'
perl: '5.010001'
version: '0'
resources:
IRC: irc://chat.freenode.net/#perl
bugtracker: https://github.com/Grinnz/Perl-Critic-Freenode/issues
homepage: https://github.com/Grinnz/Perl-Critic-Freenode
repository: https://github.com/Grinnz/Perl-Critic-Freenode.git
version: '0.033'
x_contributors:
- 'Dan Book '
- 'Dan Book '
- 'Graham Knop '
- 'Ryan Voots '
- 'Tomasz Konojacki '
- 'William Taylor '
x_generated_by_perl: v5.32.0
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: Artistic-2.0
MANIFEST 100644 001750 001750 4705 13770240140 16600 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.017.
Build.PL
CONTRIBUTING.md
Changes
INSTALL
LICENSE
MANIFEST
META.json
META.yml
README
dist.ini
lib/Perl/Critic/Freenode.pm
lib/Perl/Critic/Freenode/Utils.pm
lib/Perl/Critic/Policy/Freenode/AmpersandSubCalls.pm
lib/Perl/Critic/Policy/Freenode/ArrayAssignAref.pm
lib/Perl/Critic/Policy/Freenode/BarewordFilehandles.pm
lib/Perl/Critic/Policy/Freenode/ConditionalDeclarations.pm
lib/Perl/Critic/Policy/Freenode/ConditionalImplicitReturn.pm
lib/Perl/Critic/Policy/Freenode/DeprecatedFeatures.pm
lib/Perl/Critic/Policy/Freenode/DiscouragedModules.pm
lib/Perl/Critic/Policy/Freenode/DollarAB.pm
lib/Perl/Critic/Policy/Freenode/Each.pm
lib/Perl/Critic/Policy/Freenode/EmptyReturn.pm
lib/Perl/Critic/Policy/Freenode/IndirectObjectNotation.pm
lib/Perl/Critic/Policy/Freenode/LexicalForeachIterator.pm
lib/Perl/Critic/Policy/Freenode/LoopOnHash.pm
lib/Perl/Critic/Policy/Freenode/ModPerl.pm
lib/Perl/Critic/Policy/Freenode/MultidimensionalArrayEmulation.pm
lib/Perl/Critic/Policy/Freenode/OpenArgs.pm
lib/Perl/Critic/Policy/Freenode/OverloadOptions.pm
lib/Perl/Critic/Policy/Freenode/POSIXImports.pm
lib/Perl/Critic/Policy/Freenode/PackageMatchesFilename.pm
lib/Perl/Critic/Policy/Freenode/PreferredAlternatives.pm
lib/Perl/Critic/Policy/Freenode/Prototypes.pm
lib/Perl/Critic/Policy/Freenode/StrictWarnings.pm
lib/Perl/Critic/Policy/Freenode/Threads.pm
lib/Perl/Critic/Policy/Freenode/Wantarray.pm
lib/Perl/Critic/Policy/Freenode/WarningsSwitch.pm
lib/Perl/Critic/Policy/Freenode/WhileDiamondDefaultAssignment.pm
prereqs.yml
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/Freenode/AmpersandSubCalls.run
t/Freenode/ArrayAssignAref.run
t/Freenode/BarewordFilehandles.run
t/Freenode/ConditionalDeclarations.run
t/Freenode/ConditionalImplicitReturn.run
t/Freenode/DeprecatedFeatures.run
t/Freenode/DiscouragedModules.run
t/Freenode/DollarAB.run
t/Freenode/Each.run
t/Freenode/EmptyReturn.run
t/Freenode/IndirectObjectNotation.run
t/Freenode/LexicalForeachIterator.run
t/Freenode/LoopOnHash.run
t/Freenode/ModPerl.run
t/Freenode/MultidimensionalArrayEmulation.run
t/Freenode/OpenArgs.run
t/Freenode/OverloadOptions.run
t/Freenode/POSIXImports.run
t/Freenode/PackageMatchesFilename.run
t/Freenode/PreferredAlternatives.run
t/Freenode/Prototypes.run
t/Freenode/StrictWarnings.run
t/Freenode/Threads.run
t/Freenode/Wantarray.run
t/Freenode/WarningsSwitch.run
t/Freenode/WhileDiamondDefaultAssignment.run
t/policies.t
xt/author/pod-syntax.t
Build.PL 100644 001750 001750 7773 13770240140 16753 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 # This Build.PL for Perl-Critic-Freenode was generated by
# Dist::Zilla::Plugin::ModuleBuildTiny::Fallback 0.025
use strict;
use warnings;
my %configure_requires = (
'Module::Build::Tiny' => '0.034',
);
my %errors = map {
eval "require $_; $_->VERSION($configure_requires{$_}); 1";
$_ => $@,
} keys %configure_requires;
if (!grep { $_ } values %errors)
{
# This section for Perl-Critic-Freenode was generated by Dist::Zilla::Plugin::ModuleBuildTiny 0.015.
use strict;
use warnings;
use 5.010001;
# use Module::Build::Tiny 0.034;
Module::Build::Tiny::Build_PL();
}
else
{
if (not $ENV{PERL_MB_FALLBACK_SILENCE_WARNING})
{
warn <<'EOW'
*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***
If you're seeing this warning, your toolchain is really, really old* and you'll
almost certainly have problems installing CPAN modules from this century. But
never fear, dear user, for we have the technology to fix this!
If you're using CPAN.pm to install things, then you can upgrade it using:
cpan CPAN
If you're using CPANPLUS to install things, then you can upgrade it using:
cpanp CPANPLUS
If you're using cpanminus, you shouldn't be seeing this message in the first
place, so please file an issue on github.
This public service announcement was brought to you by the Perl Toolchain
Gang, the irc.perl.org #toolchain IRC channel, and the number 42.
----
* Alternatively, you are running this file manually, in which case you need
to learn to first fulfill all configure requires prerequisites listed in
META.yml or META.json -- or use a cpan client to install this distribution.
You can also silence this warning for future installations by setting the
PERL_MB_FALLBACK_SILENCE_WARNING environment variable, but please don't do
that until you fix your toolchain as described above.
Errors from configure prereqs:
EOW
. do {
require Data::Dumper; Data::Dumper->new([ \%errors ])->Indent(2)->Terse(1)->Sortkeys(1)->Dump;
};
sleep 10 if -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
}
# This section was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.017.
use strict;
use warnings;
require Module::Build; Module::Build->VERSION(0.28);
my %module_build_args = (
"configure_requires" => {
"Module::Build::Tiny" => "0.034"
},
"dist_abstract" => "Perl::Critic policies inspired by #perl on freenode IRC",
"dist_author" => [
"Dan Book "
],
"dist_name" => "Perl-Critic-Freenode",
"dist_version" => "0.033",
"license" => "artistic_2",
"module_name" => "Perl::Critic::Freenode",
"recursive_test_files" => 1,
"requires" => {
"Carp" => 0,
"Exporter" => 0,
"List::Util" => "1.33",
"PPI" => "1.254",
"Path::Tiny" => "0.101",
"Perl::Critic" => "1.126",
"Perl::Critic::Policy::Objects::ProhibitIndirectSyntax" => "1.126",
"Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils" => "1.126",
"Perl::Critic::Policy::ValuesAndExpressions::ProhibitArrayAssignAref" => 90,
"Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations" => "1.126",
"Perl::Critic::Policy::Variables::ProhibitLoopOnHash" => "0.005",
"Perl::Critic::Policy::Variables::RequireLexicalLoopIterators" => "1.126",
"Scalar::Util" => 0,
"parent" => 0,
"perl" => "5.010001",
"version" => 0
},
"test_requires" => {
"File::Spec" => 0,
"Module::Metadata" => 0,
"Test::More" => 0
}
);
my %fallback_build_requires = (
"File::Spec" => 0,
"Module::Metadata" => 0,
"Test::More" => 0
);
unless ( eval { Module::Build->VERSION(0.4004) } ) {
delete $module_build_args{test_requires};
$module_build_args{build_requires} = \%fallback_build_requires;
}
my $build = Module::Build->new(%module_build_args);
$build->create_build_script;
}
META.json 100644 001750 001750 17000 13770240140 17100 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 {
"abstract" : "Perl::Critic policies inspired by #perl on freenode IRC",
"author" : [
"Dan Book "
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.017, CPAN::Meta::Converter version 2.150010",
"license" : [
"artistic_2"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "Perl-Critic-Freenode",
"no_index" : {
"directory" : [
"eg",
"examples",
"inc",
"share",
"t",
"xt"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"Module::Build::Tiny" : "0.034"
}
},
"develop" : {
"requires" : {
"Test::Pod" : "1.41"
},
"suggests" : {
"App::PPI::Dumper" : "0"
}
},
"runtime" : {
"requires" : {
"Carp" : "0",
"Exporter" : "0",
"List::Util" : "1.33",
"PPI" : "1.254",
"Path::Tiny" : "0.101",
"Perl::Critic" : "1.126",
"Perl::Critic::Policy::Objects::ProhibitIndirectSyntax" : "1.126",
"Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils" : "1.126",
"Perl::Critic::Policy::ValuesAndExpressions::ProhibitArrayAssignAref" : "90",
"Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations" : "1.126",
"Perl::Critic::Policy::Variables::ProhibitLoopOnHash" : "0.005",
"Perl::Critic::Policy::Variables::RequireLexicalLoopIterators" : "1.126",
"Scalar::Util" : "0",
"parent" : "0",
"perl" : "5.010001",
"version" : "0"
}
},
"test" : {
"recommends" : {
"CPAN::Meta" : "2.120900"
},
"requires" : {
"File::Spec" : "0",
"Module::Metadata" : "0",
"Test::More" : "0"
}
}
},
"provides" : {
"Perl::Critic::Freenode" : {
"file" : "lib/Perl/Critic/Freenode.pm",
"version" : "0.033"
},
"Perl::Critic::Freenode::Utils" : {
"file" : "lib/Perl/Critic/Freenode/Utils.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::AmpersandSubCalls" : {
"file" : "lib/Perl/Critic/Policy/Freenode/AmpersandSubCalls.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::ArrayAssignAref" : {
"file" : "lib/Perl/Critic/Policy/Freenode/ArrayAssignAref.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::BarewordFilehandles" : {
"file" : "lib/Perl/Critic/Policy/Freenode/BarewordFilehandles.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::ConditionalDeclarations" : {
"file" : "lib/Perl/Critic/Policy/Freenode/ConditionalDeclarations.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::ConditionalImplicitReturn" : {
"file" : "lib/Perl/Critic/Policy/Freenode/ConditionalImplicitReturn.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::DeprecatedFeatures" : {
"file" : "lib/Perl/Critic/Policy/Freenode/DeprecatedFeatures.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::DiscouragedModules" : {
"file" : "lib/Perl/Critic/Policy/Freenode/DiscouragedModules.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::DollarAB" : {
"file" : "lib/Perl/Critic/Policy/Freenode/DollarAB.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::Each" : {
"file" : "lib/Perl/Critic/Policy/Freenode/Each.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::EmptyReturn" : {
"file" : "lib/Perl/Critic/Policy/Freenode/EmptyReturn.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::IndirectObjectNotation" : {
"file" : "lib/Perl/Critic/Policy/Freenode/IndirectObjectNotation.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::LexicalForeachIterator" : {
"file" : "lib/Perl/Critic/Policy/Freenode/LexicalForeachIterator.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::LoopOnHash" : {
"file" : "lib/Perl/Critic/Policy/Freenode/LoopOnHash.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::ModPerl" : {
"file" : "lib/Perl/Critic/Policy/Freenode/ModPerl.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::MultidimensionalArrayEmulation" : {
"file" : "lib/Perl/Critic/Policy/Freenode/MultidimensionalArrayEmulation.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::OpenArgs" : {
"file" : "lib/Perl/Critic/Policy/Freenode/OpenArgs.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::OverloadOptions" : {
"file" : "lib/Perl/Critic/Policy/Freenode/OverloadOptions.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::POSIXImports" : {
"file" : "lib/Perl/Critic/Policy/Freenode/POSIXImports.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::PackageMatchesFilename" : {
"file" : "lib/Perl/Critic/Policy/Freenode/PackageMatchesFilename.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::PreferredAlternatives" : {
"file" : "lib/Perl/Critic/Policy/Freenode/PreferredAlternatives.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::Prototypes" : {
"file" : "lib/Perl/Critic/Policy/Freenode/Prototypes.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::StrictWarnings" : {
"file" : "lib/Perl/Critic/Policy/Freenode/StrictWarnings.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::Threads" : {
"file" : "lib/Perl/Critic/Policy/Freenode/Threads.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::Wantarray" : {
"file" : "lib/Perl/Critic/Policy/Freenode/Wantarray.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::WarningsSwitch" : {
"file" : "lib/Perl/Critic/Policy/Freenode/WarningsSwitch.pm",
"version" : "0.033"
},
"Perl::Critic::Policy::Freenode::WhileDiamondDefaultAssignment" : {
"file" : "lib/Perl/Critic/Policy/Freenode/WhileDiamondDefaultAssignment.pm",
"version" : "0.033"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/Grinnz/Perl-Critic-Freenode/issues"
},
"homepage" : "https://github.com/Grinnz/Perl-Critic-Freenode",
"repository" : {
"type" : "git",
"url" : "https://github.com/Grinnz/Perl-Critic-Freenode.git",
"web" : "https://github.com/Grinnz/Perl-Critic-Freenode"
},
"x_IRC" : "irc://chat.freenode.net/#perl"
},
"version" : "0.033",
"x_contributors" : [
"Dan Book ",
"Dan Book ",
"Graham Knop ",
"Ryan Voots ",
"Tomasz Konojacki ",
"William Taylor "
],
"x_generated_by_perl" : "v5.32.0",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.25",
"x_spdx_expression" : "Artistic-2.0"
}
prereqs.yml 100644 001750 001750 1260 13770240140 17644 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 runtime:
requires:
perl: '5.010001'
Carp: 0
Exporter: 0
List::Util: '1.33'
parent: 0
Path::Tiny: '0.101'
Perl::Critic: '1.126'
Perl::Critic::Policy::Objects::ProhibitIndirectSyntax: '1.126'
Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils: '1.126'
Perl::Critic::Policy::ValuesAndExpressions::ProhibitArrayAssignAref: '90'
Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations: '1.126'
Perl::Critic::Policy::Variables::ProhibitLoopOnHash: '0.005'
Perl::Critic::Policy::Variables::RequireLexicalLoopIterators: '1.126'
PPI: '1.254'
Scalar::Util: 0
version: 0
develop:
suggests:
App::PPI::Dumper: 0
t 000755 001750 001750 0 13770240140 15544 5 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 policies.t 100644 001750 001750 136 13770240140 17660 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t use strict;
use warnings;
use Test::Perl::Critic::Policy 'all_policies_ok';
all_policies_ok;
CONTRIBUTING.md 100644 001750 001750 10555 13770240140 17720 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033 # HOW TO CONTRIBUTE
Thank you for considering contributing to this distribution. This file
contains instructions that will help you work with the source code.
The distribution is managed with [Dist::Zilla](https://metacpan.org/pod/Dist::Zilla).
This means that many of the usual files you might expect are not in the
repository, but are generated at release time. Some generated files are kept
in the repository as a convenience (e.g. Build.PL/Makefile.PL and META.json).
Generally, **you do not need Dist::Zilla to contribute patches**. You may need
Dist::Zilla to create a tarball. See below for guidance.
## Getting dependencies
If you have App::cpanminus 1.6 or later installed, you can use
[cpanm](https://metacpan.org/pod/cpanm) to satisfy dependencies like this:
$ cpanm --installdeps --with-develop .
You can also run this command (or any other cpanm command) without installing
App::cpanminus first, using the fatpacked `cpanm` script via curl or wget:
$ curl -L https://cpanmin.us | perl - --installdeps --with-develop .
$ wget -qO - https://cpanmin.us | perl - --installdeps --with-develop .
Otherwise, look for either a `cpanfile`, `prereqs.json`/`prereqs.yml`, or
`META.json` file for a list of dependencies to satisfy.
## Running tests
You can run tests directly using the `prove` tool:
$ prove -l
$ prove -lv t/some_test_file.t
For most of my distributions, `prove` is entirely sufficient for you to test
any patches you have. I use `prove` for 99% of my testing during development.
## Code style and tidying
Please try to match any existing coding style. If there is a `.perltidyrc`
file, please install Perl::Tidy and use perltidy before submitting patches.
## Installing and using Dist::Zilla
[Dist::Zilla](https://metacpan.org/pod/Dist::Zilla) is a very powerful
authoring tool, optimized for maintaining a large number of distributions with
a high degree of automation, but it has a large dependency chain, a bit of a
learning curve and requires a number of author-specific plugins.
To install it from CPAN, I recommend one of the following approaches for the
quickest installation:
# using CPAN.pm, but bypassing non-functional pod tests
$ cpan TAP::Harness::Restricted
$ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla
# using cpanm, bypassing *all* tests
$ cpanm -n Dist::Zilla
In either case, it's probably going to take about 10 minutes. Go for a walk,
go get a cup of your favorite beverage, take a bathroom break, or whatever.
When you get back, Dist::Zilla should be ready for you.
Then you need to install any plugins specific to this distribution:
$ dzil authordeps --missing | cpanm
You can use Dist::Zilla to install the distribution's dependencies if you
haven't already installed them with cpanm:
$ dzil listdeps --missing --develop | cpanm
You can instead combine these two steps into one command by installing
Dist::Zilla::App::Command::installdeps then running:
$ dzil installdeps
Once everything is installed, here are some dzil commands you might try:
$ dzil build
$ dzil test
$ dzil regenerate
You can learn more about Dist::Zilla at http://dzil.org/
## Other notes
This distribution maintains the generated `META.json` and either `Makefile.PL`
or `Build.PL` in the repository. This allows two things:
[Travis CI](https://travis-ci.org/) can build and test the distribution without
requiring Dist::Zilla, and the distribution can be installed directly from
Github or a local git repository using `cpanm` for testing (again, not
requiring Dist::Zilla).
$ cpanm git://github.com/Author/Distribution-Name.git
$ cd Distribution-Name; cpanm .
Contributions are preferred in the form of a Github pull request. See
[Using pull requests](https://help.github.com/articles/using-pull-requests/)
for further information. You can use the Github issue tracker to report issues
without an accompanying patch.
# CREDITS
This file was adapted from an initial `CONTRIBUTING.mkdn` file from David
Golden under the terms of the [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/), with inspiration from the
contributing documents from [Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING](https://metacpan.org/pod/Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING)
and [Dist::Zilla::PluginBundle::Author::ETHER](https://metacpan.org/pod/Dist::Zilla::PluginBundle::Author::ETHER).
Freenode 000755 001750 001750 0 13770240140 17273 5 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t Each.run 100644 001750 001750 352 13770240140 21001 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name UseEach
## failures 2
## cut
while (($key, $value) = each %hash) { ... }
while (($i, $elem) = each @array) { ... }
## name NoEach
## failures 0
## cut
foreach my $key (keys %hash) { ... }
foreach my $i (0..$#array) { ... }
00-report-prereqs.t 100644 001750 001750 13503 13770240140 21322 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t #!perl
use strict;
use warnings;
# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028
use Test::More tests => 1;
use Module::Metadata;
use File::Spec;
# from $version::LAX
my $lax_version_re =
qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
|
(?:\.[0-9]+) (?:_[0-9]+)?
) | (?:
v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
|
(?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
)
)/x;
# hide optional CPAN::Meta modules from prereq scanner
# and check if they are available
my $cpan_meta = "CPAN::Meta";
my $cpan_meta_pre = "CPAN::Meta::Prereqs";
my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic
# Verify requirements?
my $DO_VERIFY_PREREQS = 1;
sub _max {
my $max = shift;
$max = ( $_ > $max ) ? $_ : $max for @_;
return $max;
}
sub _merge_prereqs {
my ($collector, $prereqs) = @_;
# CPAN::Meta::Prereqs object
if (ref $collector eq $cpan_meta_pre) {
return $collector->with_merged_prereqs(
CPAN::Meta::Prereqs->new( $prereqs )
);
}
# Raw hashrefs
for my $phase ( keys %$prereqs ) {
for my $type ( keys %{ $prereqs->{$phase} } ) {
for my $module ( keys %{ $prereqs->{$phase}{$type} } ) {
$collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module};
}
}
}
return $collector;
}
my @include = qw(
PPI
);
my @exclude = qw(
);
# Add static prereqs to the included modules list
my $static_prereqs = do './t/00-report-prereqs.dd';
# Merge all prereqs (either with ::Prereqs or a hashref)
my $full_prereqs = _merge_prereqs(
( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
$static_prereqs
);
# Add dynamic prereqs to the included modules list (if we can)
my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
my $cpan_meta_error;
if ( $source && $HAS_CPAN_META
&& (my $meta = eval { CPAN::Meta->load_file($source) } )
) {
$full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
}
else {
$cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source)
$source = 'static metadata';
}
my @full_reports;
my @dep_errors;
my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
# Add static includes into a fake section
for my $mod (@include) {
$req_hash->{other}{modules}{$mod} = 0;
}
for my $phase ( qw(configure build test runtime develop other) ) {
next unless $req_hash->{$phase};
next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});
for my $type ( qw(requires recommends suggests conflicts modules) ) {
next unless $req_hash->{$phase}{$type};
my $title = ucfirst($phase).' '.ucfirst($type);
my @reports = [qw/Module Want Have/];
for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
next if $mod eq 'perl';
next if grep { $_ eq $mod } @exclude;
my $file = $mod;
$file =~ s{::}{/}g;
$file .= ".pm";
my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
my $want = $req_hash->{$phase}{$type}{$mod};
$want = "undef" unless defined $want;
$want = "any" if !$want && $want == 0;
my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
if ($prefix) {
my $have = Module::Metadata->new_from_file( File::Spec->catfile($prefix, $file) )->version;
$have = "undef" unless defined $have;
push @reports, [$mod, $want, $have];
if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
if ( $have !~ /\A$lax_version_re\z/ ) {
push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
}
elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
push @dep_errors, "$mod version '$have' is not in required range '$want'";
}
}
}
else {
push @reports, [$mod, $want, "missing"];
if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
push @dep_errors, "$mod is not installed ($req_string)";
}
}
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
else {
splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
}
push @full_reports, "\n";
}
}
}
if ( @full_reports ) {
diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
}
if ( $cpan_meta_error || @dep_errors ) {
diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n";
}
if ( $cpan_meta_error ) {
my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n";
}
if ( @dep_errors ) {
diag join("\n",
"\nThe following REQUIRED prerequisites were not satisfied:\n",
@dep_errors,
"\n"
);
}
pass('Reported prereqs');
# vim: ts=4 sts=4 sw=4 et:
author 000755 001750 001750 0 13770240140 17236 5 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/xt pod-syntax.t 100644 001750 001750 252 13770240140 21650 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/xt/author #!perl
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use strict; use warnings;
use Test::More;
use Test::Pod 1.41;
all_pod_files_ok();
00-report-prereqs.dd 100644 001750 001750 4457 13770240140 21436 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t do { my $x = {
'configure' => {
'requires' => {
'Module::Build::Tiny' => '0.034'
}
},
'develop' => {
'requires' => {
'Test::Pod' => '1.41'
},
'suggests' => {
'App::PPI::Dumper' => '0'
}
},
'runtime' => {
'requires' => {
'Carp' => '0',
'Exporter' => '0',
'List::Util' => '1.33',
'PPI' => '1.254',
'Path::Tiny' => '0.101',
'Perl::Critic' => '1.126',
'Perl::Critic::Policy::Objects::ProhibitIndirectSyntax' => '1.126',
'Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils' => '1.126',
'Perl::Critic::Policy::ValuesAndExpressions::ProhibitArrayAssignAref' => '90',
'Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations' => '1.126',
'Perl::Critic::Policy::Variables::ProhibitLoopOnHash' => '0.005',
'Perl::Critic::Policy::Variables::RequireLexicalLoopIterators' => '1.126',
'Scalar::Util' => '0',
'parent' => '0',
'perl' => '5.010001',
'version' => '0'
}
},
'test' => {
'recommends' => {
'CPAN::Meta' => '2.120900'
},
'requires' => {
'File::Spec' => '0',
'Module::Metadata' => '0',
'Test::More' => '0'
}
}
};
$x;
} ModPerl.run 100644 001750 001750 444 13770240140 21505 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name UseModPerl1
## failures 4
## cut
use Apache;
use Apache::Constants;
use Apache::Registry;
use Apache::Request;
## name UseModPerl2
## failures 4
## cut
use Apache2::Const;
use ModPerl::Const;
use ModPerl::Registry;
use Apache2::Request;
## name NoModPerl
## failures 0
## cut
1;
Threads.run 100644 001750 001750 142 13770240140 21530 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name UseThreads
## failures 1
## cut
use threads;
## name NoThreads
## failures 0
## cut
1;
DollarAB.run 100644 001750 001750 1611 13770240140 21600 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name OutsideSort
## failures 4
## cut
$a = 1;
$b = 2;
asdf { $a = 1; $b = 2; };
## name InsideSort
## failures 0
## cut
sort { $a = 1; $b = 2; } ();
## name MethodSort
## failures 0
## cut
$collection->sort(sub { $a = 1; $b = 2 });
## name HashKey
## failures 0
## cut
push @c, [ @row{sort { $a <=> $b } keys %row } ];
## name ApparentSigil
## failures 0
## cut
my $x = $b[1]||" ";
## name DereferenceBlock
## failures 0
## cut
sort { @{$a} <=> @{$b} } ();
sort { scalar(@{$a->{ids}}) <=> scalar(@{$b->{ids}}) } ();
## name InnerBlock
## failures 0
## cut
sort { {; $a } } ();
## name AllowedFunctions
## failures 0
## cut
sort { $a; $b } ();
reduce { $a; $b } ();
pairgrep { $a; $b } ();
pairfirst { $a; $b } ();
pairmap { $a; $b } ();
pairwise { $a; $b } ();
## name CustomFunctions
## failures 0
## parms { extra_pair_functions => 'foo bar' }
## cut
foo { $a; $b };
bar { $a; $b };
OpenArgs.run 100644 001750 001750 673 13770240140 21665 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name OpenOneArg
## failures 2
## cut
open FILE or die;
open my $fh;
## name OpenTwoArgs
## failures 2
## cut
open FILE, "<$filename" or die;
open my $fh, "<$filename";
## name OpenThreeArgs
## failures 0
## cut
open FILE, '<', $filename or die;
open my $fh, '<', $filename;
## name OpenFourArgs
## failures 0
## cut
open my $fh, '-|', 'ls', '-al';
## name OpenFork
## failures 0
## cut
open my $child, '-|';
open my $child, '|-';
Wantarray.run 100600 001750 001750 466 13770240140 22107 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name UseWantarray
## failures 1
## cut
return wantarray ? () : undef;
## name UseCoreWantArray
## failures 1
## cut
return CORE::wantarray ? () : undef;
## name UseCoreApostrapheWantArray
## failures 1
## cut
return CORE'wantarray ? () : undef;
## name NoWantarray
## failures 0
## cut
return undef;
LoopOnHash.run 100644 001750 001750 1430 13770240140 22171 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name ForeachHash
## failures 4
## cut
foreach my $foo (%hash) { ... }
for my $foo (%hash) { ... }
foo foreach %hash;
foo for %hash;
## name ForeachKeys
## failures 0
## cut
foreach my $foo (keys %hash) { ... }
for my $foo (keys %hash) { ... }
foo foreach keys %hash;
foo for keys %hash;
## name ForeachValues
## failures 0
## cut
foreach my $foo (values %hash) { ... }
for my $foo (values %hash) { ... }
foo foreach values %hash;
foo for values %hash;
## name ForeachCopyRef
## failures 0
## cut
foreach my $foo (@{[%hash]}) { ... }
for my $foo (@{[%hash]}) { ... }
foo foreach @{[%hash]};
foo for @{[%hash]};
## name ForeachCopyVar
## failures 0
## cut
foreach my $foo (my @d = %hash) { ... }
for my $foo (my @d = %hash) { ... }
foo foreach my @d = %hash;
foo for my @d = %hash;
Prototypes.run 100644 001750 001750 1441 13770240140 22351 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name WithPrototype
## failures 1
## cut
sub foo ($) { ... }
## name WithSignature
## failures 0
## cut
use feature 'signatures';
sub foo ($foo) { ... }
## name ExperimentalSignature
## failures 0
## cut
use experimental 'signatures';
sub foo ($foo) { ... }
## name MojoSignature
## failures 0
## cut
use Mojo::Base -base, -signatures;
sub foo ($foo) { ... }
## name MojoLiteSignature
## failures 0
## cut
use Mojolicious::Lite -signatures;
sub foo ($foo) { ... }
## name CustomSignature
## failures 0
## parms { signature_enablers => 'MyApp::Base' }
## cut
use MyApp::Base;
sub foo ($foo) { ... }
## name NoPrototype
## failures 0
## cut
sub foo { ... }
## name EmptyPrototype
## failures 0
## cut
sub foo () { ... }
## name SubPrototype
## failures 0
## cut
sub foo (&;@) { ... }
EmptyReturn.run 100644 001750 001750 1725 13770240140 22464 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name EmptyReturn
## failures 1
## cut
sub foo { return; return $foo; }
## name BareReturn
## failures 1
## cut
sub foo { return $foo; return }
## name ReturnEmptyList
## failures 0
## cut
sub foo { return (); return ($foo, $bar); }
## name ReturnScalar
## failures 0
## cut
sub foo { return undef; return $foo; }
## name ReturnList
## failures 0
## cut
sub foo { return 1, 2, 3; return $foo; }
## name ReturnModified
## failures 1
## cut
sub foo { return if bar(); return $foo; }
## name ReturnMidStatement
## failures 1
## cut
sub foo { bar() or return; return $foo; }
## name OnlyEmptyReturn
## failures 0
## cut
sub foo { return if bar(); return; }
## name ReturnInStructure
## failures 1
## cut
sub foo { return if bar(); if (1) { return $foo } }
## name OnlyEmptyReturnInStructure
## failures 0
## cut
sub foo { return if bar(); if (1) { return } }
## name ReturnInCode
## failures 0
## cut
sub foo { return if bar(); my $code = sub { return $foo }; }
Critic 000755 001750 001750 0 13770240140 20166 5 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl Freenode.pm 100644 001750 001750 10526 13770240140 22437 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic package Perl::Critic::Freenode;
use strict;
use warnings;
our $VERSION = '0.033';
1;
=head1 NAME
Perl::Critic::Freenode - Perl::Critic policies inspired by #perl on
freenode IRC
=head1 SYNOPSIS
$ perlcritic --theme freenode script.pl
$ perlcritic --theme freenode lib/
# .perlcriticrc
theme = freenode
severity = 1
=head1 DESCRIPTION
A set of L policies to enforce the practices generally
recommended by the denizens of #perl on L.
Because this policy "theme" is designed to be used with zero configuration on
the command line, some duplication will occur if it is used in combination with
core L policies.
=head1 AFFILIATION
This module has no functionality, but instead contains documentation for this
distribution and acts as a means of pulling other modules into a bundle. All of
the Policy modules contained herein will have an "AFFILIATION" section
announcing their participation in this grouping.
=head1 POLICIES
=over
=item L
Don't use C<&> to call subroutines
=item L
Don't assign an anonymous arrayref to an array
=item L
Don't use bareword filehandles other than built-ins
=item L
Don't declare variables conditionally
=item L
Don't end a subroutine with a conditional block
=item L
Avoid features that have been deprecated or removed from Perl
=item L
Various modules discouraged from use
=item L
Don't use C<$a> or C<$b> as variable names outside C
=item L
Don't use C to iterate through a hash
=item L
Don't use C with no arguments
=item L
Don't call methods indirectly
=item L
Don't use undeclared foreach loop iterators
=item L
Don't loop over hashes
=item L
Don't use C to write web applications
=item L
Don't use multidimensional array emulation
=item L
Always use the three-argument form of C
=item L
Don't use L without specifying a bool overload and enabling fallback
=item L
Module files should declare a package matching the filename
=item L
Don't use L without specifying an import list
=item L
Various modules with preferred alternatives
=item L
Don't use function prototypes
=item L
Always use L and L, or a module that imports these
=item L
Interpreter-based threads are officially discouraged
=item L
Don't write context-sensitive functions using C
=item L
Scripts should not use the C<-w> switch on the shebang line
=item L
Don't use C with implicit assignment to C<$_>
=back
=head1 CONFIGURATION AND ENVIRONMENT
All policies included are in the "freenode" theme. See the L
documentation for how to make use of this.
=head1 AUTHOR
Dan Book, C
=head1 CONTRIBUTORS
=over
=item Graham Knop (haarg)
=item H.Merijn Brand (Tux)
=item John SJ Anderson (genehack)
=item Matt S Trout (mst)
=item William Taylor (willt)
=back
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
POSIXImports.run 100644 001750 001750 437 13770240140 22425 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name DefaultImport
## failures 1
## cut
use POSIX;
## name DefaultImportWithVersion
## failures 1
## cut
use POSIX 1;
## name EmptyImport
## failures 0
## cut
use POSIX ();
## name ExplicitImport
## failures 0
## cut
use POSIX 'strftime';
use POSIX qw(strftime strcpy strchr);
StrictWarnings.run 100644 001750 001750 1601 13770240140 23140 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name HasStrictWarnings
## failures 0
## cut
use strict;
use warnings;
## name NoStrict
## failures 1
## cut
use warnings;
## name NoWarnings
## failures 1
## cut
use strict;
## name NoStrictWarnings
## failures 1
## cut
1;
## name Importer
## failures 0
## cut
use Moose;
## name IncompleteImporter
## failures 1
## cut
use common::sense;
## name VersionStrict1
## failures 0
## cut
use 5.012;
use warnings;
## name VersionStrict2
## failures 0
## cut
use v5.12.0;
use warnings;
## name VersionStrict3
## failures 0
## cut
use 5.12.0;
use warnings;
## name VersionStrict4
## failures 1
## cut
use 5.010001;
use warnings;
## name VersionStrict5
## failures 1
## cut
use v5.10.1;
use warnings;
## name VersionStrict6
## failures 1
## cut
use 5.10.1;
use warnings;
## name CustomImporter
## failures 0
## parms { extra_importers => 'MyApp::Base' }
## cut
use MyApp::Base;
WarningsSwitch.run 100644 001750 001750 761 13770240140 23117 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name HasSwitch
## failures 1
## cut
#!/usr/bin/perl -w
## name UppercaseSwitch
## failures 1
## cut
#!/usr/bin/perl -W
## name EmbeddedSwitch
## failures 1
## cut
#!/usr/bin/perl -w -T
## name BundledSwitch1
## failures 1
## cut
#!/usr/bin/perl -wT
## name BundledSwitch2
## failures 1
## cut
#!/usr/bin/perl -Tw
## name BundledSwitch3
## failures 1
## cut
#!/usr/bin/perl -TwT
## name NoSwitch
## failures 0
## cut
#!/usr/bin/perl -T
## name NoShebang
## failures 0
## cut
package Foo;
ArrayAssignAref.run 100644 001750 001750 553 13770240140 23165 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name AssignAref
## failures 2
## cut
@arr = [];
@arr = [1,2,3];
## name AssignList
## failures 0
## cut
@arr = ();
@arr = (1,2,3);
## name AssignArefInList
## failures 0
## cut
@arr = ([]);
@arr = ([1,2,3]);
## name AssignListOfAref
## failures 0
## cut
@arr = ([],[],[]);
## name AssignNonAref
## failures 0
## cut
@arr = 1;
@arr = {};
@arr = 1..10;
OverloadOptions.run 100644 001750 001750 1565 13770240140 23317 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name EmptyOverload
## failures 0
## cut
use overload;
use overload ();
use overload qw();
## name NoBoolOverload
## failures 2
## cut
use overload '""' => sub { $_[0]->name }, fallback => 1;
use overload ('""', sub { $_[0]->name }), qw(fallback 1);
## name NoFallback
## failures 2
## cut
use overload '""' => sub { $_[0]->name }, bool => sub {1};
use overload (q{""}, sub { $_[0]->name }, "bool", sub {1});
## name UndefFallback
## failures 2
## cut
use overload bool => sub {1}, fallback => undef;
use overload bool => sub {1}, 'fallback';
## name NoBoolOrFallback
## failures 2
## cut
use overload '""' => sub { $_[0]->name };
use overload ('""', sub { $_[0]->name });
## name BoolAndFallback
## failures 0
## cut
use overload '""' => sub { $_[0]->name }, bool => sub {1}, fallback => 1;
use overload (qq{""}, sub { $_[0]->name }, (q{bool}, sub {1})), qw(fallback 1);
AmpersandSubCalls.run 100644 001750 001750 426 13770240140 23506 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name AmpersandWithArgs
## failures 2
## cut
&foo(1,2,3);
&foo 1,2,3;
## name AmpersandNoArgs
## failures 2
## cut
&foo();
&foo;
## name SubRef
## failures 0
## cut
my $ref = \&foo;
## name AmpersandExemptions
## failures 0
## cut
goto &foo;
defined &foo;
exists &foo;
Freenode 000755 001750 001750 0 13770240140 21715 5 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic Utils.pm 100644 001750 001750 4406 13770240140 23517 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Freenode package Perl::Critic::Freenode::Utils;
use strict;
use warnings;
use Carp 'croak';
use Exporter 'import';
use Scalar::Util 'blessed';
our $VERSION = '0.033';
our @EXPORT_OK = qw(is_empty_return is_structural_block);
my %modifiers = map { ($_ => 1) } qw(if unless while until for foreach when);
my %compound = map { ($_ => 1) } qw(if unless while until for foreach given);
sub is_empty_return {
my $elem = shift;
croak 'is_empty_return must be called with a PPI::Token::Word return element'
unless blessed $elem and $elem->isa('PPI::Token::Word') and $elem eq 'return';
my $next = $elem->snext_sibling || return 1;
return 1 if $next->isa('PPI::Token::Structure') and $next eq ';';
return 1 if $next->isa('PPI::Token::Word') and exists $modifiers{$next};
return 0;
}
sub is_structural_block {
my $elem = shift;
croak 'is_structural_block must be called with a PPI::Structure::Block element'
unless blessed $elem and $elem->isa('PPI::Structure::Block');
if (my $parent = $elem->parent) {
if ($parent->isa('PPI::Statement::Compound') and my $first = $parent->schild(0)) {
return 1 if $first->isa('PPI::Token::Word') and exists $compound{$first};
}
}
# TODO: Allow bare blocks or blocks with labels
return 0;
}
1;
=head1 NAME
Perl::Critic::Freenode::Utils - Utility functions for the Freenode policy set
=head1 DESCRIPTION
This module contains utility functions for use in L
policies. All functions are exportable on demand.
=head1 FUNCTIONS
=head2 is_empty_return
my $bool = is_empty_return($elem);
Tests whether a L C element represents an empty
C statement. This function returns false for C.
=head2 is_structural_block
my $bool = is_structural_block($elem);
Tests whether a L element is structural, and does not
introduce a new calling context. This function currently only returns true for
blocks in compound statements such as C and C, but may be extended
to cover more cases in the future.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
DeprecatedFeatures.run 100644 001750 001750 5043 13770240140 23722 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name GoodFeatures
## failures 0
## cut
my $x : Foo = 1;
use UNIVERSAL ();
UNIVERSAL->can('foo');
use POSIX ();
for my $foo (qw(foo bar)) { ... }
1 for qw(foo bar);
do { ... };
do '...';
do $foo;
isalnum $foo;
isalpha $foo;
iscntrl $foo;
isdigit $foo;
isgraph $foo;
islower $foo;
isprint $foo;
ispunct $foo;
isspace $foo;
isupper $foo;
isxdigit $foo;
tmpnam $foo;
defined $foo;
defined $foo[0];
defined $foo{bar};
defined &foo;
$obj->defined(@foo);
foo ? bar ? 'foo' : 'bar' : 'baz';
foo ? bar ? foo : bar : baz;
$foo =~ m?foo?;
$foo =~ s?foo?bar?;
"\N{FOO BAR}";
`\N{FOO BAR}`;
qx(\N{FOO BAR});
qq{\N{FOO BAR}};
qr/\N{FOO BAR}/;
m'\N{FOO BAR}';
s{\N{FOO BAR}}{};
keys %hash;
keys %$href;
keys(%{$href});
keys %{$foo{bar}[5]};
keys $foo->{bar}[5]->%*;
keys $foo->{bar}[5]->%* > 4;
shift(@array);
shift @$aref;
shift @{$aref};
shift(@{$foo->{bar}[5]});
shift $foo->{bar}[5]->@*;
shift;
shift();
Foo->shift($foo);
require Foo::Bar;
use Foo::Bar;
no Foo::Bar;
require '::Foo::Bar.pm';
qr/\cT\\C/;
m/\cT\\C/;
chdir;
chdir();
chdir 'foo';
chdir(getcwd);
<< 'foo';
foo
<<'';
<import;
use UNIVERSAL;
use UNIVERSAL 'foo';
for my $foo qw(foo bar) { ... }
do foo(...);
do &foo(...);
do $foo(...);
POSIX::isalnum($foo);
POSIX::isalpha($foo);
POSIX::iscntrl($foo);
POSIX::isdigit($foo);
POSIX::isgraph($foo);
POSIX::islower($foo);
POSIX::isprint($foo);
POSIX::ispunct($foo);
POSIX::isspace($foo);
POSIX::isupper($foo);
POSIX::isxdigit($foo);
POSIX::tmpnam($foo);
defined @foo;
defined %foo;
defined(@foo);
defined(%foo);
$foo =~ ?foo?;
"\N{FOOÂ BAR}";
`\N{FOOÂ BAR}`;
qq{\N{FOOÂ BAR}};
qx(\N{FOOÂ BAR});
qr^\N{FOOÂ BAR}^;
m<\N{FOOÂ BAR}>;
s/\N{FOOÂ BAR}//;
each $ref;
keys($ref);
pop $foo->{bar};
push $foo{bar}[0];
shift($foo->[5]);
splice $foo, $bar, $baz;
unshift $ref, @bar;
values $ref;
require ::Foo::Bar;
use ::Foo::Bar;
no ::Foo::Bar;
qr/\C/;
m/\C/;
chdir '';
chdir(qq());
chdir undef();
<<;
(<<);
{<<}
<< . bar;
## name POSIXDeprecations
## failures 12
## cut
use POSIX;
isalnum $foo;
isalpha $foo;
iscntrl $foo;
isdigit $foo;
isgraph $foo;
islower $foo;
isprint $foo;
ispunct $foo;
isspace $foo;
isupper $foo;
isxdigit $foo;
tmpnam $foo;
## name POSIXDeprecationsImported
## failures 12
## cut
use POSIX qw(isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tmpnam);
isalnum $foo;
isalpha $foo;
iscntrl $foo;
isdigit $foo;
isgraph $foo;
islower $foo;
isprint $foo;
ispunct $foo;
isspace $foo;
isupper $foo;
isxdigit $foo;
tmpnam $foo;
DiscouragedModules.run 100644 001750 001750 1620 13770240140 23742 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name GoodModules
## failures 0
## cut
use lib::relative;
use Cpanel::JSON::XS;
use Dancer2;
use DBIx::Class;
use Dir::Self;
use Exception::Class;
use File::Slurp::Tiny;
use Future;
use Future::AsyncAwait;
use IO::Async::Loop;
use IO::Socket::IP;
use JSON::MaybeXS;
use JSON::PP;
use Mad::Mapper;
use Mojo::DOM;
use Mojo::IOLoop;
use Mojo::File;
use Mojo::JSON;
use Mojo::Template;
use Mojolicious;
use Moo;
use Moose;
use Path::Tiny;
use Plack;
use POE;
use Switch::Plain;
use Syntax::Keyword::Try;
use Template;
use Text::Xslate;
with 'Throwable';
use Try;
use Try::Tiny;
use Web::Simple;
use XML::LibXML;
use XML::TreeBuilder;
use XML::Twig;
## name BadModules
## failures 15
## cut
use Any::Moose;
use AnyEvent;
use Class::DBI;
use CGI;
use Coro;
use Error;
use File::Slurp;
use FindBin;
use HTML::Template;
use IO::Socket::INET6;
use JSON::Any;
use JSON::XS;
use Net::IRC;
use Switch;
use XML::Simple;
BarewordFilehandles.run 100644 001750 001750 6353 13770240140 24074 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name BarewordOpen
## failures 12
## cut
open FILE;
open FILE, "<$filename";
open FILE, '<', $filename;
open(FILE, '<', $filename);
open FH, '>', $some_file;
open FH, '>', $some_file or die;
open(FH, '>', $some_file);
open(FH, '>', $some_file) or die;
open FH, ">$some_file";
open FH, ">$some_file" or die;
open(FH, ">$some_file");
open(FH, ">$some_file") or die;
## name BarewordOpenBuiltin
## failures 0
## cut
open STDOUT;
open STDIN, "<$filename";
open(STDERR, '>', $filename);
open STDIN, '>', $some_file;
open STDIN, '>', $some_file or die;
open(STDIN, '>', $some_file);
open(STDIN, '>', $some_file) or die;
open STDIN, ">$some_file";
open STDIN, ">$some_file" or die;
open(STDIN, ">$some_file");
open(STDIN, ">$some_file") or die;
open STDOUT, '>', $some_file;
open STDOUT, '>', $some_file or die;
open(STDOUT, '>', $some_file);
open(STDOUT, '>', $some_file) or die;
open STDOUT, ">$some_file";
open STDOUT, ">$some_file" or die;
open(STDOUT, ">$some_file");
open(STDOUT, ">$some_file") or die;
open STDERR, '>', $some_file;
open STDERR, '>', $some_file or die;
open(STDERR, '>', $some_file);
open(STDERR, '>', $some_file) or die;
open STDERR, ">$some_file";
open STDERR, ">$some_file" or die;
open(STDERR, ">$some_file");
open(STDERR, ">$some_file") or die;
## name VariableOpen
## failures 0
## cut
open $fh, '>', $some_file;
open $fh, '>', $some_file or die;
open($fh, '>', $some_file);
open($fh, '>', $some_file) or die;
open my $fh, '>', $some_file;
open my $fh, '>', $some_file or die;
open(my $fh, '>', $some_file);
open(my $fh, '>', $some_file) or die;
open our $fh, '>', $some_file;
open our $fh, '>', $some_file or die;
open(our $fh, '>', $some_file);
open(our $fh, '>', $some_file) or die;
open local $foo{fh}, '>', $some_file;
open local $foo{fh}, '>', $some_file or die;
open(local $foo{fh}, '>', $some_file);
open(local $foo{fh}, '>', $some_file) or die;
open local $foo{fh}, ">$some_file";
open local $foo{fh}, ">$some_file" or die;
open(local $foo{fh}, ">$some_file");
open(local $foo{fh}, ">$some_file") or die;
open local *STDIN, '>', $some_file;
open local *STDIN, '>', $some_file or die;
open(local *STDIN, '>', $some_file);
open(local *STDIN, '>', $some_file) or die;
open local *STDIN, ">$some_file";
open local *STDIN, ">$some_file" or die;
open(local *STDIN, ">$some_file");
open(local *STDIN, ">$some_file") or die;
open local *STDOUT, '>', $some_file;
open local *STDOUT, '>', $some_file or die;
open(local *STDOUT, '>', $some_file);
open(local *STDOUT, '>', $some_file) or die;
open local *STDOUT, ">$some_file";
open local *STDOUT, ">$some_file" or die;
open(local *STDOUT, ">$some_file");
open(local *STDOUT, ">$some_file") or die;
open local *STDERR, '>', $some_file;
open local *STDERR, '>', $some_file or die;
open(local *STDERR, '>', $some_file);
open(local *STDERR, '>', $some_file) or die;
open local *STDERR, ">$some_file";
open local *STDERR, ">$some_file" or die;
open(local *STDERR, ">$some_file");
open(local *STDERR, ">$some_file") or die;
## name BarewordPipe
## failures 6
## cut
pipe READ, my $write;
pipe my $read, WRITE;
pipe READ, WRITE;
pipe(READ, WRITE);
## name BarewordPipeBuiltin
## failures 0
## cut
pipe DATA, my $write;
## name LexicalPipe
## failures 0
## cut
pipe my $read, my $write;
pipe(my $read, my $write);
PreferredAlternatives.run 100644 001750 001750 561 13770240140 24443 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name GoodModules
## failures 0
## cut
use Cpanel::JSON::XS;
use Const::Fast;
use Getopt::Long;
use Getopt::Long::Descriptive;
use JSON::MaybeXS;
use JSON::PP;
use List::SomeUtils;
use List::Util;
use List::UtilsBy;
use Moo;
use Moose;
use ReadonlyX;
## name BadModules
## failures 5
## cut
use Getopt::Std;
use JSON;
use List::MoreUtils;
use Mouse;
use Readonly;
IndirectObjectNotation.run 100644 001750 001750 421 13770240140 24542 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name IndirectCalls
## failures 4
## cut
my $foo = new Foo;
my $foo = new Foo @args;
my $bar = new $foo;
my $bar = new $foo @args;
## name DirectCalls
## failures 0
## cut
my $foo = Foo->new;
my $foo = Foo->new(@args);
my $bar = $foo->new;
my $bar = $foo->new(@args);
LexicalForeachIterator.run 100644 001750 001750 427 13770240140 24527 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name UndeclaredIterator
## failures 2
## cut
for $foo (@bar) {}
foreach $bar (@foo) {}
## name DeclaredIterator
## failures 0
## cut
for my $foo (@bar) {}
foreach my $bar (@foo) {}
## name NoIterator
## failures 0
## cut
for (@bar) {}
for ($foo = 0; $foo < 5; $foo++) {}
PackageMatchesFilename.run 100644 001750 001750 610 13770240140 24437 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name MatchesFilename
## failures 0
## filename path/to/My/Package.pm
## cut
package My::Package;
## name MatchesEndFilename
## failures 0
## filename path/to/My/Package.pm
## cut
package Package;
## name NoMatchingFilename
## failures 1
## filename path/to/My/Package.pm
## cut
package MyPackage;
## name NotModule
## failures 0
## filename path/to/My/File.t
## cut
package MyFile;
ConditionalDeclarations.run 100644 001750 001750 401 13770240140 24730 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name ConditionalDeclarations
## failures 3
## cut
my $foo = $bar if $baz;
my ($foo, $bar) = @baz unless $abc;
our $foo = $_ for @bar;
## name UnconditionalDeclarations
## failures 0
## cut
my $foo = $bar;
$foo = $bar if $baz;
our $bar = $baz ? 1 : 2;
Freenode 000755 001750 001750 0 13770240140 23154 5 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy Each.pm 100644 001750 001750 3720 13770240140 24514 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::Each;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'each() called';
use constant EXPL => 'The each function may cause undefined behavior when operating on the hash while iterating. Use a foreach loop over the hash\'s keys or values instead.';
sub supported_parameters { () }
sub default_severity { $SEVERITY_LOW }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Token::Word' }
sub violates {
my ($self, $elem) = @_;
return () unless $elem eq 'each' and is_function_call $elem;
return $self->violation(DESC, EXPL, $elem);
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::Each - Don't use each to iterate through a hash
=head1 DESCRIPTION
The C function relies on an iterator internal to a hash (or array),
which is the same iterator used by C and C. So deleting or
adding hash elements during iteration, or just calling C or C
on the hash, will cause undefined behavior and the code will likely break. This
could occur even by passing the hash to other functions which operate on the
hash. Instead, use a C loop iterating through the keys or values of
the hash.
while (my ($key, $value) = each %hash) { ... } # not ok
foreach my $key (keys %hash) { my $value = $hash{$key}; ... } # ok
foreach my $i (0..$#array) { my $elem = $array[$i]; ... } # ok
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy is not configurable except for the standard options.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L, L
ConditionalImplicitReturn.run 100644 001750 001750 766 13770240140 25310 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name ImplicitConditional
## failures 1
## cut
sub foo { if ($foo) { return 1 } }
## name ImplicitConditionalNoReturn
## failures 0
## cut
sub foo { return if bar(); if ($foo) { bar() } }
## name NotLastStatement
## failures 0
## cut
sub foo { if ($foo) { return 1 } return 0 }
## name ConditionalWithElsif
## failures 1
## cut
sub foo { if ($foo) { return 1 } elsif ($bar) { return 0 } }
## name ConditionalWithElse
## failures 0
## cut
sub foo { if ($foo) { return 1 } else { return 0 } }
ModPerl.pm 100644 001750 001750 4055 13770240140 25220 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::ModPerl;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'Using mod_perl';
use constant EXPL => 'mod_perl is not designed for writing Perl web applications. Try a Plack-based framework (Web::Simple, Dancer2, Catalyst) or Mojolicious for a modern approach.';
sub supported_parameters { () }
sub default_severity { $SEVERITY_HIGH }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Statement::Include' }
my %modules = (
'Apache' => 1,
'Apache::Constants' => 1,
'Apache::Registry' => 1,
'Apache::Request' => 1,
'Apache2::Const' => 1,
'Apache2::Request' => 1,
'ModPerl::Const' => 1,
'ModPerl::Registry' => 1,
);
sub violates {
my ($self, $elem) = @_;
return $self->violation(DESC, EXPL, $elem) if exists $modules{$elem->module//''};
return ();
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::ModPerl - Don't use mod_perl to write web
applications
=head1 DESCRIPTION
L is an embedded Perl interpreter for the
L web server. It allows you to dynamically
configure and mod Apache. It is not a generally good solution for writing web
applications. Frameworks using L (L, L,
L) and L are much more flexible, powerful, and stable.
A web application written in one of these frameworks can be deployed using a
Perl HTTP server such as L or L; by proxy
from Apache or nginx; or even run as if they were regular CGI scripts.
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy is not configurable except for the standard options.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
Threads.pm 100644 001750 001750 3525 13770240140 25251 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::Threads;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'Using interpreter threads';
use constant EXPL => 'Interpreter threads are discouraged, they are not lightweight and fast as other threads may be. Try an event loop, forks.pm, or Parallel::Prefork.';
sub supported_parameters { () }
sub default_severity { $SEVERITY_MEDIUM }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Statement::Include' }
sub violates {
my ($self, $elem) = @_;
return $self->violation(DESC, EXPL, $elem) if $elem->pragma eq 'threads';
return ();
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::Threads - Interpreter-based threads are
officially discouraged
=head1 DESCRIPTION
Perl interpreter L are officially discouraged. They were created to
emulate C in Windows environments, and are not fast or lightweight as
one may expect. Non-blocking code or I/O can be easily parallelized by using an
event loop such as L, L, or L. Blocking code is
usually better parallelized by forking, which on Unix-like systems is fast and
efficient. Modules such as L and L can make forking
easier to work with, as well as forking modules for event loops such as
L, L, or L.
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy is not configurable except for the standard options.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
DollarAB.pm 100644 001750 001750 5375 13770240140 25304 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::DollarAB;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'Using $a or $b outside sort()';
use constant EXPL => '$a and $b are special package variables for use in sort() and related functions. Declaring them as lexicals like "my $a" may break sort(). Use different variable names.';
sub supported_parameters {
(
{
name => 'extra_pair_functions',
description => 'Non-standard functions in which to allow $a and $b',
behavior => 'string list',
},
)
}
sub default_severity { $SEVERITY_HIGH }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Token::Symbol' }
my @sorters = qw(sort reduce pairgrep pairfirst pairmap pairwise);
sub violates {
my ($self, $elem) = @_;
return () unless $elem->symbol eq '$a' or $elem->symbol eq '$b';
my %sorters_hash = map { ($_ => 1) } @sorters, keys %{$self->{_extra_pair_functions}};
my $found = $self->_find_sorter($elem, \%sorters_hash);
return $self->violation(DESC, EXPL, $elem) unless $found;
return ();
}
sub _find_sorter {
my ($self, $elem, $sorters) = @_;
my $outer = $elem->parent;
$outer = $outer->parent until !$outer or $outer->isa('PPI::Structure::Block');
return '' unless $outer;
# Find function or method call (assumes block/sub is first argument)
my $function = $outer->previous_token;
$function = $function->previous_token until !$function
or ($function->isa('PPI::Token::Word') and $function =~ m/([^:]+)\z/ and exists $sorters->{$1});
return $self->_find_sorter($outer) unless $function;
return $function;
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::DollarAB - Don't use $a or $b as variable names
outside sort
=head1 DESCRIPTION
The special variables C<$a> and C<$b> are reserved for C and similar
functions which assign to them to iterate over pairs of values. These are
global variables, and declaring them as lexical variables with C to use
them outside this context can break usage of these functions. Use different
names for your variables.
my $a = 1; # not ok
my $abc = 1; # ok
sort { $a <=> $b } (3,2,1); # ok
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy can be configured to allow C<$a> and C<$b> in additional functions,
by putting an entry in a C<.perlcriticrc> file like this:
[Freenode::DollarAB]
extra_pair_functions = pairfoo pairbar
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
OpenArgs.pm 100644 001750 001750 4251 13770240140 25372 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::OpenArgs;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'open() called with less than 3 arguments';
use constant EXPL => 'The one- and two-argument forms of open() parse functionality from the filename, use the three-argument form instead.';
sub supported_parameters { () }
sub default_severity { $SEVERITY_MEDIUM }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Token::Word' }
sub violates {
my ($self, $elem) = @_;
return () unless $elem eq 'open' and is_function_call $elem;
my @args = parse_arg_list $elem;
if (@args < 3) {
return () if @args == 2 and $args[1][0]->isa('PPI::Token::Quote')
and $args[1][0]->string =~ /^(?:-\||\|-)\z/;
return $self->violation(DESC, EXPL, $elem);
}
return ();
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::OpenArgs - Always use the three-argument form
of open
=head1 DESCRIPTION
The C function may be called in a two-argument form where the filename
is parsed to determine the mode of opening, which may include piping input or
output. (In the one-argument form, this filename is retrieved from a global
variable, but the same magic is used.) This can lead to vulnerabilities if the
filename is retrieved from user input or could begin or end with a special
character. The three-argument form specifies the open mode as the second
argument, so it is always distinct from the filename.
open FILE; # not ok
open my $fh, "<$filename"; # not ok
open my $fh, '<', $filename; # ok
This policy is similar to the core policy
L, but additionally
prohibits one-argument opens.
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy is not configurable except for the standard options.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
Wantarray.pm 100600 001750 001750 4316 13770240140 25616 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::Wantarray;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'wantarray() called';
use constant EXPL => 'Context-sensitive functions lead to unexpected errors or vulnerabilities. Functions should explicitly return either a list or a scalar value.';
sub supported_parameters { () }
sub default_severity { $SEVERITY_LOW }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Token::Word' }
sub violates {
my ($self, $elem) = @_;
return () unless (($elem eq 'wantarray' or $elem->literal eq 'CORE::wantarray') and is_function_call $elem);
return $self->violation(DESC, EXPL, $elem);
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::Wantarray - Don't write context-sensitive
functions using wantarray
=head1 DESCRIPTION
Context-sensitive functions, while one way to write functions that DWIM (Do
What I Mean), tend to instead lead to unexpected behavior when the function is
accidentally used in a different context, especially if the function's behavior
changes significantly based on context. This also can lead to vulnerabilities
when a function is intended to be used as a scalar, but is used in a list, such
as a hash constructor or function parameter list. Instead, functions should be
explicitly documented to return either a scalar value or a list, so there is no
potential for confusion or vulnerability.
return wantarray ? ('a','b','c') : 3; # not ok
return CORE::wantarray ? ('a', 'b', 'c') : 3; # not ok
return ('a','b','c'); # ok
return 3; # ok
sub get_stuff {
return wantarray ? @things : \@things;
}
my $stuff = Stuff->new(stuff => get_stuff()); # oops! function will return a list!
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy is not configurable except for the standard options.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
WhileDiamondDefaultAssignment.run 100644 001750 001750 3245 13770240140 26067 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name DefaultAssignment
## failures 4
## cut
while (<$fh>) {}
while () {}
while (<>) {}
while (<<>>) {}
## name DefaultAssignmentModifier
## failures 4
## cut
1 while <$fh>;
1 while ;
1 while <>;
1 while <<>>;
## name DefaultAssignmentFor
## failures 4
## cut
for (;<$fh>;) {}
for (;;) {}
for (;<>;) {}
for (;<<>>;) {}
## name DefaultAssignmentReadline
## failures 8
## cut
while (readline $fh) {}
while (readline($fh)) {}
while (readline DATA) {}
while (readline(DATA)) {}
1 while readline $fh;
1 while readline($fh);
1 while readline DATA;
1 while readline(DATA);
## name DefaultAssignmentReaddir
## failures 8
## cut
while (readdir $dh) {}
while (readdir($dh)) {}
while (readdir DIR) {}
while (readdir(DIR)) {}
1 while readdir $dh;
1 while readdir($dh);
1 while readdir DIR;
1 while readdir(DIR);
## name DefaultAssignmentEach
## failures 4
## cut
while (each %hash) {}
while (each(%hash)) {}
1 while each %hash;
1 while each(%hash);
## name ExplicitAssignment
## failures 0
## cut
while (my $line = <$fh>) {}
for (;my $line = <$fh>;) {}
1 while $line = <$fh>;
while (my $line = ) {}
for (;my $line = ;) {}
1 while $line = ;
while (my $line = <>) {}
for (;my $line = <>;) {}
1 while $line = <>;
while (my $line = <<>>) {}
for (;my $line = <<>>;) {}
1 while $line = <<>>;
while (my $line = readline $fh) {}
while (my $line = readline($fh)) {}
1 while $line = readline $fh;
1 while $line = readline($fh);
while (my $dir = readdir $dh) {}
while (my $dir = readdir($dh)) {}
1 while $dir = readdir $dh;
1 while $dir = readdir($dh);
while (my $key = each %hash) {}
while (my $key = each(%hash)) {}
1 while $key = each %hash;
1 while $key = each(%hash);
LoopOnHash.pm 100644 001750 001750 3114 13770240140 25663 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::LoopOnHash;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy::Variables::ProhibitLoopOnHash';
our $VERSION = '0.033';
sub default_severity { $SEVERITY_HIGH }
sub default_themes { 'freenode' }
1;
=head1 NAME
Perl::Critic::Policy::Freenode::LoopOnHash - Don't loop over hashes
=head1 DESCRIPTION
It's possible to loop over a hash as if it was a list, which results in
alternating between the keys and values of the hash. Often, the intent was
instead to loop over either the keys or the values of the hash.
foreach my $foo (%hash) { ... } # not ok
action() for %hash; # not ok
foreach my $foo (keys %hash) { ... } # ok
action() for values %hash; # ok
If you intended to loop over alternating keys and values, you can make this
intent clear by first copying them to an array:
foreach my $key_or_value (@{[%hash]}) { ... }
foreach my $key_or_value (my @dummy = %hash) { ... }
This policy is a subclass of the policy
L, and performs the same
function but in the C theme.
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy is not configurable except for the standard options.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
Prototypes.pm 100644 001750 001750 6203 13770240140 26043 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::Prototypes;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'Using function prototypes';
use constant EXPL => 'Function prototypes (sub foo ($@) { ... }) will usually not do what you want. Omit the prototype, or use signatures instead.';
sub supported_parameters {
(
{
name => 'signature_enablers',
description => 'Non-standard modules to recognize as enabling signatures',
behavior => 'string list',
},
)
}
sub default_severity { $SEVERITY_MEDIUM }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Document' }
sub violates {
my ($self, $elem) = @_;
# Check if signatures are enabled
my $includes = $elem->find('PPI::Statement::Include') || [];
foreach my $include (@$includes) {
next unless $include->type eq 'use';
return () if $include->pragma eq 'feature' and $include =~ m/\bsignatures\b/;
return () if $include->pragma eq 'experimental' and $include =~ m/\bsignatures\b/;
return () if $include->module eq 'Mojo::Base' and $include =~ m/-signatures\b/;
return () if $include->module eq 'Mojolicious::Lite' and $include =~ m/-signatures\b/;
return () if exists $self->{_signature_enablers}{$include->module};
}
my $prototypes = $elem->find('PPI::Token::Prototype') || [];
my @violations;
foreach my $prototype (@$prototypes) {
# Empty prototypes and prototypes containing & can be useful
next if $prototype->prototype eq '' or $prototype->prototype =~ /&/;
push @violations, $self->violation(DESC, EXPL, $prototype);
}
return @violations;
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::Prototypes - Don't use function prototypes
=head1 DESCRIPTION
Function prototypes are primarily a hint to the Perl parser for parsing the
function's argument list. They are not a way to validate or count the arguments
passed to the function, and will cause confusion if used this way. Often, the
prototype can simply be left out, but see L for a more
modern method of declaring arguments.
sub foo ($$) { ... } # not ok
sub foo { ... } # ok
use feature 'signatures'; sub foo ($bar, $baz) { ... } # ok
use experimental 'signatures'; sub foo ($bar, $baz) { ... } # ok
This policy is similar to the core policy
L, but
additionally ignores files using the C feature, and allows empty
prototypes and prototypes containing C<&>, as these are often useful for
structural behavior.
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy can be configured to recognize additional modules as enabling the
C feature, by putting an entry in a C<.perlcriticrc> file like
this:
[Freenode::Prototypes]
signature_enablers = MyApp::Base
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
MultidimensionalArrayEmulation.run 100600 001750 001750 1315 13770240140 26343 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/t/Freenode ## name ScalarAccess
## failures 0
## cut
$foo{bar};
$foo{'bar'};
$$foo{ bar };
$foo{'bar,baz'};
$foo{bar(1,2)};
$foo{bar 1, 2};
## name Slices
## failures 0
## cut
@foo {'bar','baz'};
@{foo}{qw(bar baz)};
@{$foo{bar}}{a => 'b'};
@{@foo[0]}{'a','b'};
@$foo{'a','b'};
$foo->@{'a','b'};
%foo{'bar','baz'};
%{foo}{'bar','baz'};
%{$foo{bar}}{'a','b'};
%{@foo[0]}{'a','b'};
%$foo{'a','b'};
$foo->%{'a','b'};
## name MAE
## failures 10
## cut
$foo{'bar','baz'};
${foo} {qw(bar baz)};
$foo{bar}{a => 'b'};
${@foo[0]}{'a','b'};
$$foo {'a','b'};
{1,2}->{'bar','baz'};
foo->[2]{'bar','baz'};
$foo{bar (1),2};
$foo{1,bar 2};
$foo{bar, 2};
## name Nested
## failures 3
## cut
$foo->{ $bar->{'a','b'} => $baz->{qw(a b)} };
EmptyReturn.pm 100644 001750 001750 6770 13770240140 26162 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::EmptyReturn;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
use List::Util 'any';
use Perl::Critic::Freenode::Utils qw(is_empty_return is_structural_block);
our $VERSION = '0.033';
use constant DESC => 'return called with no arguments';
use constant EXPL => 'return with no arguments may return either undef or an empty list depending on context. This can be surprising for the same reason as other context-sensitive returns. Return undef or the empty list explicitly.';
sub supported_parameters { () }
sub default_severity { $SEVERITY_LOWEST }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Statement::Sub' }
sub violates {
my ($self, $elem) = @_;
my $block = $elem->block || return ();
my $returns = $block->find(sub {
my ($elem, $child) = @_;
# Don't search in blocks unless we know they are structural
if ($child->isa('PPI::Structure::Block')) {
return undef unless is_structural_block($child);
}
return 1 if $child->isa('PPI::Token::Word') and $child eq 'return';
return 0;
});
# Return a violation for each empty return, if any non-empty return is present
if ($returns and any { !is_empty_return($_) } @$returns) {
return map { $self->violation(DESC, EXPL, $_) } grep { is_empty_return($_) } @$returns;
}
return ();
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::EmptyReturn - Don't use return with no
arguments
=head1 DESCRIPTION
Context-sensitive functions, while one way to write functions that DWIM (Do
What I Mean), tend to instead lead to unexpected behavior when the function is
accidentally used in a different context, especially if the function's behavior
changes significantly based on context. This also can lead to vulnerabilities
when a function is intended to be used as a scalar, but is used in a list, such
as a hash constructor or function parameter list. C with no arguments
will return either C or an empty list depending on context. Instead,
return the appropriate value explicitly.
return; # not ok
return (); # ok
return undef; # ok
sub get_stuff {
return unless @things;
return join(' ', @things);
}
my %stuff = (
one => 1,
two => get_stuff(), # oops! function returns empty list if @things is empty
three => 3,
);
Empty returns are permitted by this policy if the subroutine contains no
explicit return values, indicating it is intended to be used in void context.
=head1 CAVEATS
This policy currently only checks return statements in named subroutines,
anonymous subroutines are not checked. Also, return statements within blocks,
other than compound statements like C and C, are not considered
when determining if a function is intended to be used in void context.
Any non-empty return will cause empty returns within the same subroutine to
report violations, even though in list context, C and C are
functionally equivalent. It is recommended to explicitly specify an empty list
return with C in a function that intends to return list context.
=head1 AFFILIATION
This policy is part of L.
=head1 CONFIGURATION
This policy is not configurable except for the standard options.
=head1 AUTHOR
Dan Book, C
=head1 COPYRIGHT AND LICENSE
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
=head1 SEE ALSO
L
POSIXImports.pm 100644 001750 001750 3700 13770240140 26132 0 ustar 00grinnz grinnz 000000 000000 Perl-Critic-Freenode-0.033/lib/Perl/Critic/Policy/Freenode package Perl::Critic::Policy::Freenode::POSIXImports;
use strict;
use warnings;
use Perl::Critic::Utils qw(:severities :classification :ppi);
use parent 'Perl::Critic::Policy';
our $VERSION = '0.033';
use constant DESC => 'Using POSIX.pm without an explicit import list';
use constant EXPL => 'Using the POSIX module without specifying an import list results in importing hundreds of symbols. Import the functions or constants you want explicitly, or prevent the import with ().';
sub supported_parameters { () }
sub default_severity { $SEVERITY_LOW }
sub default_themes { 'freenode' }
sub applies_to { 'PPI::Statement::Include' }
sub violates {
my ($self, $elem) = @_;
return $self->violation(DESC, EXPL, $elem) if ($elem->type // '') eq 'use'
and ($elem->module // '') eq 'POSIX' and !$elem->arguments;
return ();
}
1;
=head1 NAME
Perl::Critic::Policy::Freenode::POSIXImports - Don't use POSIX without
specifying an import list
=head1 DESCRIPTION
The L module imports hundreds of symbols (functions and constants) by
default for backwards compatibility reasons. To avoid this, and to assist in
finding where functions have been imported from, specify the symbols you want
to import explicitly in the C