From acbb5ea45c4b1bf84085f69576524847facdd879 Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Mon, 12 Feb 2024 09:23:18 -0700 Subject: [PATCH] Initial structure --- .gitattributes | 5 ++ .github/workflows/linux.yml | 82 +++++++++++++++++++ .github/workflows/static.yml | 30 +++++++ .gitignore | 5 ++ Changes | 6 ++ author.yml | 16 ++++ dist.ini | 24 ++++++ .../Tools/PerlCritic/Role/Progressive.pm | 11 +++ perlcriticrc | 61 ++++++++++++++ t/test2_tools_perlcritic_role_progressive.t | 8 ++ xt/author/critic.t | 16 ++++ 11 files changed, 264 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/static.yml create mode 100644 .gitignore create mode 100644 Changes create mode 100644 author.yml create mode 100644 dist.ini create mode 100644 lib/Test2/Tools/PerlCritic/Role/Progressive.pm create mode 100644 perlcriticrc create mode 100644 t/test2_tools_perlcritic_role_progressive.t create mode 100644 xt/author/critic.t diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..54b1cad --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +*.pm linguist-language=Perl +*.t linguist-language=Perl +*.h linguist-language=C + + diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..4d84fdb --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,82 @@ +name: linux + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + perl: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + cip_tag: + - "5.37" + - "5.36" + - "5.34" + - "5.32" + - "5.30" + - "5.28" + - "5.26" + - "5.24" + - "5.22" + - "5.20" + - "5.18" + - "5.16" + - "5.14" + - "5.12" + - "5.10" + - "5.8" + + env: + CIP_TAG: ${{ matrix.cip_tag }} + + steps: + - uses: actions/checkout@v2 + + - name: Bootstrap CIP + run: | + curl -L https://raw.githubusercontent.com/uperl/cip/main/bin/github-bootstrap | bash + + - name: Cache-Key + id: cache-key + run: | + echo -n '::set-output name=key::' + cip cache-key + + - name: Cache CPAN modules + uses: actions/cache@v2 + with: + path: ~/.cip + key: ${{ runner.os }}-build-${{ steps.cache-key.outputs.key }} + restore-keys: | + ${{ runner.os }}-build-${{ steps.cache-key.outputs.key }} + + - name: Start-Container + run: | + cip start + + - name: Diagnostics + run: | + cip diag + + - name: Install-Dependencies + run: | + cip install + + - name: Build + Test + run: | + cip script + + - name: CPAN log + if: ${{ failure() }} + run: | + cip exec bash -c 'cat $HOME/.cpanm/latest-build/build.log' + + diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..7f72b51 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,30 @@ +name: static + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + perl: + + runs-on: ubuntu-latest + + env: + CIP_TAG: static + + steps: + - uses: actions/checkout@v2 + + - name: Bootstrap CIP + run: | + curl -L https://raw.githubusercontent.com/uperl/cip/main/bin/github-bootstrap | bash + + - name: Build + Test + run: | + cip script + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e9c2f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +Test2-Tools-PerlCritic-Role-Progressive-* +/.build/ +*.swp + + diff --git a/Changes b/Changes new file mode 100644 index 0000000..a6bd89c --- /dev/null +++ b/Changes @@ -0,0 +1,6 @@ +Revision history for {{$dist->name}} + +{{$NEXT}} + - initial version + + diff --git a/author.yml b/author.yml new file mode 100644 index 0000000..40420cc --- /dev/null +++ b/author.yml @@ -0,0 +1,16 @@ +--- +pod_spelling_system: + skip: 0 + # list of words that are spelled correctly + # (regardless of what spell check thinks) + # or stuff that I like to spell incorrectly + # intentionally + stopwords: [] + +pod_coverage: + skip: 0 + # format is "Class#method" or "Class",regex allowed + # for either Class or method. + private: [] + + diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..b35e8f4 --- /dev/null +++ b/dist.ini @@ -0,0 +1,24 @@ +name = Test2-Tools-PerlCritic-Role-Progressive +author = Graham Ollis +license = Perl_5 +copyright_holder = Graham Ollis +copyright_year = 2024 +version = 0.01 + +[@Author::Plicease] +:version = 2.75 +release_tests = 1 +installer = Author::Plicease::MakeMaker +github_user = uperl +default_branch = main +test2_v0 = 1 +workflow = static +workflow = linux +version_plugin = PkgVersion::Block + +[Author::Plicease::Core] + +[Author::Plicease::Upload] +cpan = 0 + + diff --git a/lib/Test2/Tools/PerlCritic/Role/Progressive.pm b/lib/Test2/Tools/PerlCritic/Role/Progressive.pm new file mode 100644 index 0000000..8405063 --- /dev/null +++ b/lib/Test2/Tools/PerlCritic/Role/Progressive.pm @@ -0,0 +1,11 @@ +use warnings; +use 5.020; +use experimental qw( postderef signatures ); + +package Test2::Tools::PerlCritic::Role::Progressive { + + # ABSTRACT: Role to progressively critique Perl code +} + +1; + diff --git a/perlcriticrc b/perlcriticrc new file mode 100644 index 0000000..65a5c53 --- /dev/null +++ b/perlcriticrc @@ -0,0 +1,61 @@ +severity = 1 +only = 1 + +[Community::ArrayAssignAref] +[Community::BarewordFilehandles] +[Community::ConditionalDeclarations] +[Community::ConditionalImplicitReturn] +[Community::DeprecatedFeatures] +[Community::DiscouragedModules] +[Community::DollarAB] +[Community::Each] +[Community::EmptyReturn] +[Community::IndirectObjectNotation] +[Community::LexicalForeachIterator] +[Community::LoopOnHash] +[Community::ModPerl] +[Community::OpenArgs] +[Community::OverloadOptions] +[Community::POSIXImports] +[Community::PackageMatchesFilename] +[Community::PreferredAlternatives] +[Community::StrictWarnings] +extra_importers = Test2::V0 +[Community::Threads] +[Community::Wantarray] +[Community::WarningsSwitch] +[Community::WhileDiamondDefaultAssignment] + +[BuiltinFunctions::ProhibitBooleanGrep] +[BuiltinFunctions::ProhibitStringyEval] +[BuiltinFunctions::ProhibitStringySplit] +[BuiltinFunctions::ProhibitVoidGrep] +[BuiltinFunctions::ProhibitVoidMap] +[ClassHierarchies::ProhibitExplicitISA] +[ClassHierarchies::ProhibitOneArgBless] +[CodeLayout::ProhibitHardTabs] +allow_leading_tabs = 0 +[CodeLayout::ProhibitTrailingWhitespace] +[CodeLayout::RequireConsistentNewlines] +[ControlStructures::ProhibitLabelsWithSpecialBlockNames] +[ControlStructures::ProhibitMutatingListFunctions] +[ControlStructures::ProhibitUnreachableCode] +[InputOutput::ProhibitBarewordFileHandles] +[InputOutput::ProhibitJoinedReadline] +[InputOutput::ProhibitTwoArgOpen] +[Miscellanea::ProhibitFormats] +[Miscellanea::ProhibitUselessNoCritic] +[Modules::ProhibitConditionalUseStatements] +;[Modules::RequireEndWithOne] +[Modules::RequireNoMatchVarsWithUseEnglish] +[Objects::ProhibitIndirectSyntax] +[RegularExpressions::ProhibitUselessTopic] +[Subroutines::ProhibitNestedSubs] +[ValuesAndExpressions::ProhibitLeadingZeros] +[ValuesAndExpressions::ProhibitMixedBooleanOperators] +[ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator] +[ValuesAndExpressions::RequireUpperCaseHeredocTerminator] +[Variables::ProhibitPerl4PackageNames] +[Variables::ProhibitUnusedVariables] + + diff --git a/t/test2_tools_perlcritic_role_progressive.t b/t/test2_tools_perlcritic_role_progressive.t new file mode 100644 index 0000000..04c6216 --- /dev/null +++ b/t/test2_tools_perlcritic_role_progressive.t @@ -0,0 +1,8 @@ +use Test2::V0 -no_srand => 1; +use Test2::Tools::PerlCritic::Role::Progressive; + +ok 1, 'todo'; + +done_testing; + + diff --git a/xt/author/critic.t b/xt/author/critic.t new file mode 100644 index 0000000..bd1f95a --- /dev/null +++ b/xt/author/critic.t @@ -0,0 +1,16 @@ +use Test2::Require::Module 'Test2::Tools::PerlCritic'; +use Test2::Require::Module 'Perl::Critic'; +use Test2::Require::Module 'Perl::Critic::Community'; +use Test2::V0; +use Perl::Critic; +use Test2::Tools::PerlCritic; + +my $critic = Perl::Critic->new( + -profile => 'perlcriticrc', +); + +perl_critic_ok ['lib','t'], $critic; + +done_testing; + +