Skip to content

Commit

Permalink
New feature : PHP linters with support of SARIF output format (#3551)
Browse files Browse the repository at this point in the history
* patch part 1/3 for PHP_PHPLINT and SARIF support (see feature request #3515)

* patch part 2/3 for PHP_PHPCS and SARIF support (see feature request #3515)

* patch part 3/3 for PHP_PHPSTAN and SARIF support (see feature request #3515)

* fix cspell linter dict about unknown word 'codesniffer'

* update changelog related to feature #3515

* update after running bash build.py

* [MegaLinter] Apply linters fixes

---------

Co-authored-by: Nicolas Vuillamy <nicolas.vuillamy@gmail.com>
Co-authored-by: llaville <llaville@users.noreply.github.com>
  • Loading branch information
3 people authored May 13, 2024
1 parent 52c1d5e commit 086f6f6
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 27 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
"Cres",
"Csrf",
"C\u00e9dric",
"codesniffer",
"DARTANALYZER",
"DEVSKIM",
"DIRC",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- Linters
- `API_SPECTRAL` was added as replacement for `OPENAPI_SPECTRAL` (deprecated), supporting AsyncAPI and OpenAPI by default. Uses Spectral's standard config file name `.spectral.yaml` instead of `.openapirc.yml` with a default config with rulesets for AsyncAPI and OpenAPI enabled. Fixes [#3387](https://github.com/oxsecurity/megalinter/issues/3387)
- Disable SQL_TSQLLINT until security issues are solved. Related to <https://github.com/tsqllint/tsqllint/issues/333>
- PHP linters (PHP_PHPCS, PHP_PHPLINT, PHP_PHPSTAN) add support to SARIF report output format with help of <https://github.com/llaville/sarif-php-sdk>

- Reporters

Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest

FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform
FROM ghcr.io/assignuser/chktex-alpine:latest as chktex
FROM ghcr.io/phpstan/phpstan:latest-php8.3 as phpstan
FROM yoheimuta/protolint:latest as protolint
FROM golang:alpine as dustilock
RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0
Expand Down Expand Up @@ -112,6 +111,7 @@ RUN apk add --no-cache \
php83-curl \
php83-dom \
php83-opcache \
php83-openssl \
php83-common \
php83-simplexml \
dpkg \
Expand Down Expand Up @@ -311,6 +311,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \
#############################################################################################

#COPY__START
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
# shellcheck is a dependency for actionlint

Expand All @@ -323,7 +324,6 @@ COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checke
COPY --link --from=revive /usr/bin/revive /usr/bin/revive
COPY --link --from=kubeconform /kubeconform /usr/bin/
COPY --link --from=chktex /usr/bin/chktex /usr/bin/
COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/
COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock
COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/
Expand Down Expand Up @@ -467,6 +467,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110

# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"

# POWERSHELL installation
RUN curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-7.4.2-linux-musl-x64.tar.gz -o /tmp/powershell.tar.gz \
Expand Down Expand Up @@ -630,12 +632,11 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P


# phpcs installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpcs -g --trust-gpg-keys 31C7E470E2138192,95DE904AB800754A11D80B605E6DDE998AB73B8E
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require squizlabs/php_codesniffer bartlett/sarif-php-sdk


# phpstan installation
# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require phpstan/phpstan bartlett/sarif-php-sdk

# psalm installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
Expand Down
4 changes: 4 additions & 0 deletions TEMPLATES/phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
parameters:
level: 0

services:
errorFormatter.sarif:
class: Bartlett\Sarif\Converter\PhpStanConverter
11 changes: 6 additions & 5 deletions flavors/cupcake/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FROM golang:1-alpine as revive
RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest

FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform
FROM ghcr.io/phpstan/phpstan:latest-php8.3 as phpstan
FROM zricethezav/gitleaks:v8.18.2 as gitleaks
FROM checkmarx/kics:alpine as kics
FROM trufflesecurity/trufflehog:latest as trufflehog
Expand Down Expand Up @@ -96,6 +95,7 @@ RUN apk add --no-cache \
php83-curl \
php83-dom \
php83-opcache \
php83-openssl \
php83-common \
php83-simplexml \
dpkg \
Expand Down Expand Up @@ -277,6 +277,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \
#############################################################################################

#COPY__START
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
# shellcheck is a dependency for actionlint

Expand All @@ -288,7 +289,6 @@ COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint
COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker
COPY --link --from=revive /usr/bin/revive /usr/bin/revive
COPY --link --from=kubeconform /kubeconform /usr/bin/
COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/
COPY --link --from=kics /app/bin/kics /usr/bin/kics
COPY --from=kics /app/bin/assets /usr/bin/assets
Expand Down Expand Up @@ -374,6 +374,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110

# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"

# actionlint installation
# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
Expand Down Expand Up @@ -457,12 +459,11 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P


# phpcs installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpcs -g --trust-gpg-keys 31C7E470E2138192,95DE904AB800754A11D80B605E6DDE998AB73B8E
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require squizlabs/php_codesniffer bartlett/sarif-php-sdk


# phpstan installation
# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require phpstan/phpstan bartlett/sarif-php-sdk

# psalm installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
Expand Down
11 changes: 6 additions & 5 deletions flavors/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ FROM mvdan/shfmt:latest-alpine as shfmt
FROM hadolint/hadolint:v2.12.0-alpine as hadolint
FROM mstruebing/editorconfig-checker:$VERSION_EDITORCONFIG_CHECKER as editorconfig-checker
FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform
FROM ghcr.io/phpstan/phpstan:latest-php8.3 as phpstan
FROM yoheimuta/protolint:latest as protolint
FROM zricethezav/gitleaks:v8.18.2 as gitleaks
FROM trufflesecurity/trufflehog:latest as trufflehog
Expand Down Expand Up @@ -84,6 +83,7 @@ RUN apk add --no-cache \
php83-curl \
php83-dom \
php83-opcache \
php83-openssl \
php83-common \
php83-simplexml \
dpkg \
Expand Down Expand Up @@ -227,6 +227,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \
#############################################################################################

#COPY__START
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
# shellcheck is a dependency for actionlint

Expand All @@ -237,7 +238,6 @@ COPY --link --from=shfmt /bin/shfmt /usr/bin/
COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint
COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker
COPY --link --from=kubeconform /kubeconform /usr/bin/
COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/
COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/
COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/
Expand Down Expand Up @@ -269,6 +269,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110

# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"

# actionlint installation
# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
Expand Down Expand Up @@ -320,12 +322,11 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel


# phpcs installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpcs -g --trust-gpg-keys 31C7E470E2138192,95DE904AB800754A11D80B605E6DDE998AB73B8E
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require squizlabs/php_codesniffer bartlett/sarif-php-sdk


# phpstan installation
# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require phpstan/phpstan bartlett/sarif-php-sdk

# psalm installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
Expand Down
7 changes: 5 additions & 2 deletions linters/php_phpcs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ RUN apk add --no-cache \
php83-curl \
php83-dom \
php83-opcache \
php83-openssl \
php83-common \
php83-simplexml \
dpkg \
Expand Down Expand Up @@ -136,7 +137,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \
#############################################################################################

#COPY__START

COPY --from=composer/composer:2-bin /composer /usr/bin/composer
#COPY__END

#############################################################################################
Expand All @@ -159,9 +160,11 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110

# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"

# phpcs installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpcs -g --trust-gpg-keys 31C7E470E2138192,95DE904AB800754A11D80B605E6DDE998AB73B8E
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require squizlabs/php_codesniffer bartlett/sarif-php-sdk


#OTHER__END
Expand Down
5 changes: 4 additions & 1 deletion linters/php_phplint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ RUN apk add --no-cache \
php83-curl \
php83-dom \
php83-opcache \
php83-openssl \
php83-common \
php83-simplexml \
dpkg \
Expand Down Expand Up @@ -136,7 +137,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \
#############################################################################################

#COPY__START

COPY --from=composer/composer:2-bin /composer /usr/bin/composer
#COPY__END

#############################################################################################
Expand All @@ -159,6 +160,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110

# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"

# phplint installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g
Expand Down
10 changes: 6 additions & 4 deletions linters/php_phpstan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#FROM__START
FROM ghcr.io/phpstan/phpstan:latest-php8.3 as phpstan

#FROM__END

##################
Expand Down Expand Up @@ -67,6 +67,7 @@ RUN apk add --no-cache \
php83-curl \
php83-dom \
php83-opcache \
php83-openssl \
php83-common \
php83-simplexml \
dpkg \
Expand Down Expand Up @@ -136,7 +137,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \
#############################################################################################

#COPY__START
COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
#COPY__END

#############################################################################################
Expand All @@ -159,10 +160,11 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110

# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"

# phpstan installation
# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require phpstan/phpstan bartlett/sarif-php-sdk

#OTHER__END

Expand Down
5 changes: 4 additions & 1 deletion linters/php_psalm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ RUN apk add --no-cache \
php83-curl \
php83-dom \
php83-opcache \
php83-openssl \
php83-common \
php83-simplexml \
dpkg \
Expand Down Expand Up @@ -136,7 +137,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \
#############################################################################################

#COPY__START

COPY --from=composer/composer:2-bin /composer /usr/bin/composer
#COPY__END

#############################################################################################
Expand All @@ -159,6 +160,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110

# Managed with COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"

# psalm installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
Expand Down
18 changes: 14 additions & 4 deletions megalinter/descriptors/php.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ install:
- php83-curl
- php83-dom
- php83-opcache
- php83-openssl
- php83-common
- php83-simplexml
- dpkg
Expand All @@ -36,10 +37,13 @@ install:
&& mv phive.phar /usr/local/bin/phive \
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php83 110
- COPY --from=composer/composer:2-bin /composer /usr/bin/composer
- ENV PATH="/root/.composer/vendor/bin:${PATH}"
linters:
# PHPCS
- linter_name: phpcs
name: PHP_PHPCS
can_output_sarif: true
linter_url: https://github.com/PHPCSStandards/PHP_CodeSniffer
linter_repo: https://github.com/PHPCSStandards/PHP_CodeSniffer
linter_rules_configuration_url: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file
Expand All @@ -49,6 +53,8 @@ linters:
config_file_name: phpcs.xml
cli_lint_mode: list_of_files
cli_config_arg_name: "--standard="
cli_sarif_args:
- "--report=\\Bartlett\\Sarif\\Converter\\PhpCsConverter"
cli_lint_errors_count: regex_number
cli_lint_errors_regex: "FOUND ([0-9]+) ERRORS"
examples:
Expand All @@ -58,7 +64,7 @@ linters:
install:
dockerfile:
- |
RUN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpcs -g --trust-gpg-keys 31C7E470E2138192,95DE904AB800754A11D80B605E6DDE998AB73B8E
RUN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require squizlabs/php_codesniffer bartlett/sarif-php-sdk
ide:
atom:
- name: linter-phpcs
Expand All @@ -79,6 +85,7 @@ linters:
# PHP Stan
- linter_name: phpstan
name: PHP_PHPSTAN
can_output_sarif: true
linter_url: https://phpstan.org/
linter_repo: https://github.com/phpstan/phpstan
linter_image_url: https://i.imgur.com/WaRKPlC.png
Expand All @@ -92,6 +99,8 @@ linters:
- "--no-ansi"
- "--memory-limit"
- "1G"
cli_sarif_args:
- "--error-format=sarif"
cli_lint_errors_count: regex_number
cli_lint_errors_regex: "Found ([0-9]+) error"
examples:
Expand All @@ -101,9 +110,7 @@ linters:
- "phpstan analyse --no-progress --no-ansi mydir1/ mydir2/ myfile.php"
install:
dockerfile:
- FROM ghcr.io/phpstan/phpstan:latest-php8.3 as phpstan
- COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
- RUN chmod +x /usr/bin/phpstan
- RUN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && composer global require phpstan/phpstan bartlett/sarif-php-sdk
idea:
- name: PHPStan / Psalm / Generics
url: https://plugins.jetbrains.com/plugin/12754-phpstan--psalm--generics
Expand Down Expand Up @@ -149,10 +156,13 @@ linters:
url: https://marketplace.visualstudio.com/items?itemName=getpsalm.psalm-vscode-plugin
# PHPLint
- linter_name: phplint
can_output_sarif: true
linter_url: https://github.com/overtrue/phplint
linter_repo: https://github.com/overtrue/phplint
config_file_name: .phplint.yml
cli_lint_mode: list_of_files
cli_sarif_args:
- "--log-sarif={{SARIF_OUTPUT_FILE}}"
examples:
- "phplint myfile.php"
- "phplint mydir"
Expand Down

0 comments on commit 086f6f6

Please sign in to comment.