diff --git a/.automation/test/perl/perl_bad_1.pl b/.automation/test/perl/perl_bad_1.pl index 7b127b99..09add458 100644 --- a/.automation/test/perl/perl_bad_1.pl +++ b/.automation/test/perl/perl_bad_1.pl @@ -7,7 +7,6 @@ ############# # Load Libs # ############# -use strict; ################## #### GLOBALS: #### diff --git a/.automation/test/perl/reports/expected-PERL.tap b/.automation/test/perl/reports/expected-PERL.tap index 932c3621..e90e961d 100644 --- a/.automation/test/perl/reports/expected-PERL.tap +++ b/.automation/test/perl/reports/expected-PERL.tap @@ -2,6 +2,6 @@ TAP version 13 1..2 not ok 1 - perl_bad_1.pl --- - message: Global symbol "$here" requires explicit package name (did you forget to declare "my $here"?) at /tmp/lint/.automation/test/perl/perl_bad_1.pl line 37.\n/tmp/lint/.automation/test/perl/perl_bad_1.pl had compilation errors.\n + message: Code before strictures are enabled at line 14, column 1. See page 429 of PBP. (Severity 5)\n ... ok 2 - perl_good_1.pl diff --git a/.github/linters/.perlcriticrc b/.github/linters/.perlcriticrc new file mode 100644 index 00000000..ad6196a3 --- /dev/null +++ b/.github/linters/.perlcriticrc @@ -0,0 +1,2 @@ +severity = 1 +verbose = %f:%l:%c [%s %p] %m near '%r'\n \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3ebe7199..c9d057a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -65,7 +65,7 @@ RUN apk add --update --no-cache \ musl-dev \ npm nodejs-current \ openjdk8-jre \ - perl \ + perl perl-dev \ php7 php7-phar php7-json php7-mbstring php-xmlwriter \ php7-tokenizer php7-ctype php7-curl php7-dom php7-simplexml \ py3-setuptools \ @@ -101,6 +101,11 @@ ENV PATH="/node_modules/.bin:${PATH}" ############################## RUN bundle install +############################## +# Installs Perl dependencies # +############################## +RUN curl -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic + ############################## # Install Phive dependencies # ############################## diff --git a/README.md b/README.md index ab7c116d..bd7857b1 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | **Lua** | [luacheck](https://github.com/luarocks/luacheck) | | **Markdown** | [markdownlint](https://github.com/igorshubovych/markdownlint-cli#readme) | | **OpenAPI** | [spectral](https://github.com/stoplightio/spectral) | -| **Perl** | [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) | +| **Perl** | [perlcritic](https://metacpan.org/pod/Perl::Critic) | | **PHP** | [PHP built-in linter](https://www.php.net/) [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) [PHPStan](https://phpstan.org/n) [Psalm](https://psalm.dev/) | | **PowerShell** | [PSScriptAnalyzer](https://github.com/PowerShell/Psscriptanalyzer) | | **Protocol Buffers** | [protolint](https://github.com/yoheimuta/protolint) | @@ -71,7 +71,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | **Raku** | [raku](https://raku.org) | | **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) | | **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) | -| **SQL** | [sql-lint](https://github.com/joereynolds/sql-lint) | +| **SQL** | [sql-lint](https://github.com/joereynolds/sql-lint) | | **Terraform** | [tflint](https://github.com/terraform-linters/tflint) [terrascan](https://github.com/accurics/terrascan) | | **TypeScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | | **XML** | [LibXML](http://xmlsoft.org/) | diff --git a/TEMPLATES/.perlcriticrc b/TEMPLATES/.perlcriticrc new file mode 100644 index 00000000..ad6196a3 --- /dev/null +++ b/TEMPLATES/.perlcriticrc @@ -0,0 +1,2 @@ +severity = 1 +verbose = %f:%l:%c [%s %p] %m near '%r'\n \ No newline at end of file diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index c1d76476..42acb7f4 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -721,7 +721,7 @@ Here is more data ## Perl -- [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) +- `.github/linters/.perlcriticrc` ### Perl Config file diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 9dd5502c..a55c35c0 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -200,7 +200,8 @@ function BuildFileList() { ###################### # Get the PERL files # ###################### - elif [ "${FILE_TYPE}" == "pl" ]; then + elif [ "${FILE_TYPE}" == "pl" ] || [ "${FILE_TYPE}" == "pm" ] || + [ "${FILE_TYPE}" == "t" ]; then ################################ # Append the file to the array # ################################ diff --git a/lib/linter.sh b/lib/linter.sh index ec43f997..f178bb01 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1585,7 +1585,7 @@ if [ "${VALIDATE_PERL}" == "true" ]; then # Lint the perl files # ####################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "${FILE_ARRAY_PERL[@]}" + LintCodebase "PERL" "perl" "perlcritic" ".*\.\(pl\|pm\|t\)\$" "${FILE_ARRAY_PERL[@]}" fi ################ diff --git a/lib/worker.sh b/lib/worker.sh index 81d0a6eb..39c03db5 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -590,7 +590,7 @@ function RunTestCases() { TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "kotlin" TestCodebase "LUA" "lua" "luacheck" ".*\.\(lua\)\$" "lua" TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c ${MARKDOWN_LINTER_RULES}" ".*\.\(md\)\$" "markdown" - TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "perl" + TestCodebase "PERL" "perl" "perlcritic" ".*\.\(pl\|pm\|t\)\$" "perl" TestCodebase "PHP_BUILTIN" "php" "php -l" ".*\.\(php\)\$" "php" TestCodebase "PHP_PHPCS" "phpcs" "phpcs --standard=${PHP_PHPCS_LINTER_RULES}" ".*\.\(php\)\$" "php" TestCodebase "PHP_PHPSTAN" "phpstan" "phpstan analyse --no-progress --no-ansi -c ${PHP_PHPSTAN_LINTER_RULES}" ".*\.\(php\)\$" "php"