diff --git a/.github/workflows/ci-on-pull_request.yml b/.github/workflows/ci-on-pull_request.yml index 415130fcb15..416598105f3 100644 --- a/.github/workflows/ci-on-pull_request.yml +++ b/.github/workflows/ci-on-pull_request.yml @@ -8,12 +8,13 @@ jobs: secrets: inherit with: gh_event: ${{ github.event_name }} - #phan: - # uses: ./.github/workflows/phan.yml - # secrets: inherit - # needs: [pre-commit] - # with: - # gh_event: ${{ github.event_name }} + phan: + # if: false # Uncommenting this line disables phan + uses: ./.github/workflows/phan.yml + secrets: inherit + needs: [pre-commit] + with: + gh_event: ${{ github.event_name }} phpstan: uses: ./.github/workflows/phpstan.yml secrets: inherit diff --git a/.github/workflows/phan.yml b/.github/workflows/phan.yml index 37f6dfcc4d3..04b424feb39 100644 --- a/.github/workflows/phan.yml +++ b/.github/workflows/phan.yml @@ -49,18 +49,44 @@ jobs: with: php-version: 8.2 coverage: none # disable xdebug, pcov - tools: phan:5.5.2 + tools: cs2pr,phan:5.5.2 + - name: Run Phan analysis - if: "! cancelled() && steps.changed-php.outputs.any_changed == 'true'" + # Proceed when: + # - the action is not cancelled + # AND + # - the branch is an integration branch (no merge), or, + # - the merge from branch contains 'phan_full', or, + # - there are changes in PHP files. + # Note: --output-mode=github does not provide file:line, so using checkstyle and cs2pr + if: ${{ ! cancelled() && (github.ref_name == 'develop' || github.ref_name == 'refs/heads/develop' || endsWith(github.ref_name, '.0') || contains(github.head_ref, 'phan_full') || steps.changed-php.outputs.any_changed == 'true') }} env: ALL_CHANGED_FILES: ${{ steps.changed-php.outputs.all_changed_files }} # shellcheck disable=2086 + FILE_CHANGE_LIST: /tmp/phan-changed.lst run: | # shellcheck disable=2086 - > /tmp/phpstan-files.txt - for f in $ALL_CHANGED_FILES; do echo "$f" >> /tmp/phan-files.txt; done - cat /tmp/phan-files.txt - echo phan --file-list /tmp/phan-files.txt $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=github - #echo phan $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=github - phan --file-list /tmp/phan-files.txt $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=github + if [ "${{ github.ref_name }}" == "develop" ] || [[ "${{ github.ref_name }}" == *.0 ]]|| [[ "${{ github.head_ref }}" == *"phan_full"* ]] ; then + echo phan $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=checkstyle -o _phan.xml + phan $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=checkstyle -o _phan.xml + else + > $FILE_CHANGED_LIST + for f in $ALL_CHANGED_FILES; do echo "$f" >> $FILE_CHANGED_LIST; done + cat $FILE_CHANGED_LIST + echo phan --file-list $FILE_CHANGED_LIST $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=checkstyle -o _phan.xml + phan --file-list $FILE_CHANGED_LIST $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=checkstyle -o _phan.xml + fi + + - name: Add results to PR as Github notices + if: ${{ always() }} + run: | + cs2pr --prepend-filename --prepend-source --notices-as-warnings _phan.xml + + - name: Provide phan log as artifact + uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: phan-srcrt + path: ${{ github.workspace }}/_phan.xml + retention-days: 2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 68a1ab347f3..a4dc9af9b98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,10 +65,11 @@ repos: - id: gitleaks # Check github actions - #- repo: https://github.com/rhysd/actionlint - # rev: v1.7.8 - # hooks: - # - id: actionlint + - repo: https://github.com/rhysd/actionlint + rev: v1.7.10 + hooks: + - id: actionlint + stages: [manual] # To run: pre-commit run -a --hook-stage=manual actionlint # Beautify shell scripts - repo: https://github.com/lovesegfault/beautysh.git diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 2a10a0b078d..14d2dfab3a5 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -8,7 +8,7 @@ * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021 Waƫl Almoman * Copyright (C) 2022 Udo Tamm - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by