Skip to content

Fea add action router#10

Open
cdesiles wants to merge 2 commits intoPrestaShopCorp:masterfrom
cdesiles:fea-add-action-router
Open

Fea add action router#10
cdesiles wants to merge 2 commits intoPrestaShopCorp:masterfrom
cdesiles:fea-add-action-router

Conversation

@cdesiles
Copy link
Copy Markdown

@cdesiles cdesiles commented Sep 30, 2022

Introduce a new agnostic way of linting php.
To test it out:

jobs:
  php-linter:
    name: PHP Syntax check
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php_version: ["7.1", "7.2", "7.3", "7.4", "8.0", "8.1"]
    steps:
      - name: Checkout
        uses: actions/checkout@v2.0.0
      - name: PHP syntax checker ${{ matrix.php_version }}
        uses: "jokesterfr/github-action-php-lint@fea-add-action-router"
        with:
          php-version: ${{ matrix.php_version }}

@cdesiles cdesiles force-pushed the fea-add-action-router branch from 953b2bc to 2e15ec9 Compare September 30, 2022 14:26
Comment thread action.yml
run: |
echo "Pulled docker image: $(docker pull --quiet php:${{ inputs.php-version }})"
docker run --rm --entrypoint /bin/sh php:${{ inputs.php-version }} -c "! (find . -type f -name \"*.php\" ${{ inputs.folder-to-exclude }} -exec php -l -n {} \; | grep -v \"No syntax errors detected\")"
echo "No syntax error detected"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a syntax error is found? will this message be displayed anyway?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, run will fail.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you're right we should try this case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git ls-files | grep -E '.*\.(php)' | xargs -n1 php -l -n | (! grep -v "No syntax errors" )

seems to provide exactly what's needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants