shirobrak / action-phpcs

Run phpcs with reviewdog
MIT License
6 stars 2 forks source link

parse error: Invalid numeric literal at line 1, column 6 #11

Closed adrianthedev closed 2 years ago

adrianthedev commented 3 years ago

I get this output parse error: Invalid numeric literal at line 1, column 6 when I run it with reporter: github-pr-review. I'm using it on a pretty much standard laravel app.

Thank you!

name: Reviewdog

on: [pull_request]

jobs:phpcs:
    name: runner / phpcs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install phpcs
        run: composer global require "squizlabs/php_codesniffer=*"
      - name: phpcs
        uses: shirobrak/action-phpcs@v1.0.0
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-review
          phpcs_flags: '--standard=phpcs.xml app/'

image

LucaPipolo commented 3 years ago

Having same problem here. 🤚🏼

adrianthedev commented 3 years ago

Any thoughts here? 👋

shirobrak commented 3 years ago

@adrianthedev

Sorry, I didn’t notice immediately, and thanks for using action-phpcs. I think it’s because parsing result of applying phpcs to your code failed, or phpcs itself could not be executed due to wrong writing of phpcs.xml. So, I would like you to check the work fine your phpcs.xml in your local environment. And if you’d like, please tell me your rules of phpcs and It helps to investigate the cause.

LucaPipolo commented 3 years ago

Hey @shirobrak, thanks for having a look a this.

I can confirm that my phpcs.xml file is working on my local environment. It's also working with another GitHub PHPCS action I finally had to switch to.

If this can be helpful, here you have my file:

<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">

    <description>The Coding standard for the WordPress Coding Standards itself.</description>

    <file>wp-content/themes/</file>

    <!-- Exclude WordPress Core files from being checked. -->
    <exclude-pattern>index.php</exclude-pattern>

    <exclude-pattern>.history/*</exclude-pattern>

    <!-- Exclude the Composer Vendor directory. -->
    <exclude-pattern>*/vendor/*</exclude-pattern>

    <!-- Exclude the Node Modules and dist directories. -->
    <exclude-pattern>*/node_modules/*</exclude-pattern>
    <exclude-pattern>*/dist/*</exclude-pattern>

    <!-- Exclude Javascript files. -->
    <exclude-pattern>*.js</exclude-pattern>

    <rule ref="WordPress">
        <exclude name="WordPress.WP.I18n.NonSingularStringLiteralDomain" />
        <exclude name="Squiz.PHP.CommentedOutCode.Found" />
    </rule>

    <!-- Exclude filename conventions for Visual Composer templates -->
    <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
        <exclude-pattern>*/vc_templates/*</exclude-pattern>
    </rule>

</ruleset>
shirobrak commented 2 years ago

@LucaPipolo @adrianthedev Sorry for my late response, and thank you for the phpcs.xml information. Checking, the cause was a lack of ruleset for checking WordPress Coding Style in Action's Running Environment. I added a ruleset and solved it. When I added a ruleset, I could confirm to check with WordPress Coding Style ruleset. I merged the fix in #13 , so it should have been resolved. Thank you for cooperation ! 👍