PerlCritic basic implementation

This commit is contained in:
Tudor Marghidanu 2020-08-07 14:58:40 +02:00
parent 4f070b62d7
commit 523b14a2df
8 changed files with 17 additions and 7 deletions

2
.github/linters/.perlcriticrc vendored Normal file
View file

@ -0,0 +1,2 @@
severity = 1
verbose = %f:%l:%c [%s %p] %m near '%r'\n

View file

@ -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 #
##############################

View file

@ -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/) |

2
TEMPLATES/.perlcriticrc Normal file
View file

@ -0,0 +1,2 @@
severity = 1
verbose = %f:%l:%c [%s %p] %m near '%r'\n

View file

@ -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

View file

@ -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 #
################################

View file

@ -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
################

View file

@ -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"