Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade PHPLint to v9 #2638

Merged
merged 2 commits into from
May 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .automation/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def generate_documentation():
+ "and **ready to use out of the box**, as a GitHub action or any CI system "
+ "**highly configurable** and **free for all uses**.\n\n"
+ "[**Upgrade to MegaLinter v7 !**]"
+ "https://github.com/oxsecurity/megalinter/issues/2608" #TODOV7: Replace link
+ "https://github.com/oxsecurity/megalinter/issues/2608" # TODOV7: Replace link
)
# Update README.md file
replace_in_file(
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ RUN apk add --update --no-cache \
php81-curl \
php81-dom \
php81-simplexml \
composer \
dpkg \
py3-pyflakes \
nodejs \
Expand Down Expand Up @@ -464,7 +463,6 @@ 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/php81 110

ENV PATH="/root/.composer/vendor/bin:$PATH"

# POWERSHELL installation
RUN --mount=type=secret,id=GITHUB_TOKEN mkdir -p ${PWSH_DIRECTORY} \
Expand Down Expand Up @@ -636,11 +634,11 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI


# phplint installation
RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \
&& composer global config bin-dir --absolute \
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


# powershell installation
&& pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \
RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \

# powershell_formatter installation
# Next line commented because already managed by another linter
Expand Down
8 changes: 3 additions & 5 deletions flavors/cupcake/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ RUN apk add --update --no-cache \
php81-curl \
php81-dom \
php81-simplexml \
composer \
dpkg \
py3-pyflakes \
nodejs \
Expand Down Expand Up @@ -355,7 +354,6 @@ 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/php81 110

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 @@ -447,14 +445,14 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI


# phplint installation
RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \
&& composer global config bin-dir --absolute \
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


# gitleaks installation
# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/

# trivy installation
&& wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \
RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \

# tflint installation
# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/
Expand Down
8 changes: 3 additions & 5 deletions flavors/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ RUN apk add --update --no-cache \
php81-curl \
php81-dom \
php81-simplexml \
composer \
dpkg \
py3-pyflakes \
nodejs \
Expand Down Expand Up @@ -253,7 +252,6 @@ 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/php81 110

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 @@ -305,8 +303,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI


# phplint installation
RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \
&& composer global config bin-dir --absolute \
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


# protolint installation
# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/
Expand All @@ -315,7 +313,7 @@ RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \
# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/

# trivy installation
&& wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin


# vale installation
Expand Down
2 changes: 0 additions & 2 deletions linters/php_phpcs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ RUN apk add --update --no-cache \
php81-curl \
php81-dom \
php81-simplexml \
composer \
dpkg \
&& git config --global core.autocrlf true
#APK__END
Expand Down Expand Up @@ -150,7 +149,6 @@ 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/php81 110

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
Expand Down
5 changes: 1 addition & 4 deletions linters/php_phplint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ RUN apk add --update --no-cache \
php81-curl \
php81-dom \
php81-simplexml \
composer \
dpkg \
&& git config --global core.autocrlf true
#APK__END
Expand Down Expand Up @@ -150,11 +149,9 @@ 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/php81 110

ENV PATH="/root/.composer/vendor/bin:$PATH"

# phplint installation
RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \
&& composer global config bin-dir --absolute
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


#OTHER__END
Expand Down
2 changes: 0 additions & 2 deletions linters/php_phpstan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ RUN apk add --update --no-cache \
php81-curl \
php81-dom \
php81-simplexml \
composer \
dpkg \
&& git config --global core.autocrlf true
#APK__END
Expand Down Expand Up @@ -150,7 +149,6 @@ 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/php81 110

ENV PATH="/root/.composer/vendor/bin:$PATH"

# phpstan installation
# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
Expand Down
2 changes: 0 additions & 2 deletions linters/php_psalm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ RUN apk add --update --no-cache \
php81-curl \
php81-dom \
php81-simplexml \
composer \
dpkg \
&& git config --global core.autocrlf true
#APK__END
Expand Down Expand Up @@ -150,7 +149,6 @@ 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/php81 110

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
5 changes: 1 addition & 4 deletions megalinter/descriptors/php.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ install:
- php81-curl
- php81-dom
- php81-simplexml
- composer
- dpkg
dockerfile:
- |
Expand All @@ -35,7 +34,6 @@ install:
&& mv phive.phar /usr/local/bin/phive \
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php81 110
- ENV PATH="/root/.composer/vendor/bin:$PATH"
linters:
# PHPCS
- linter_name: phpcs
Expand Down Expand Up @@ -157,5 +155,4 @@ linters:
install:
dockerfile:
- |
RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \
&& composer global config bin-dir --absolute
RUN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g
4 changes: 3 additions & 1 deletion megalinter/utils_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def build_markdown_summary(reporter_self, action_run_url):
)
for suggestion in reporter_self.master.flavor_suggestions:
build_version = config.get(None, "BUILD_VERSION", DEFAULT_RELEASE)
action_version = DEFAULT_RELEASE if len(build_version) > 20 else build_version
action_version = (
DEFAULT_RELEASE if len(build_version) > 20 else build_version
)
action_path = (
f"{ML_REPO}/flavors/{suggestion['flavor']}@{action_version}"
)
Expand Down