Shopify / theme-check

The Ultimate Shopify Theme Linter
Other
337 stars 95 forks source link

sort_by throws in json_printer when the path is not specified on a check. #560

Closed FiliSantillan closed 2 years ago

FiliSantillan commented 2 years ago

Setting Theme-Check, I realized that whenever I add the token. It throws me an error: Error: Unexpected end of JSON input..

If I remove the "token" option, everything works perfectly.

This is my theme-check.yml file:

name: Theme Check

on:
    pull_request:
        branches: live

jobs:
    theme-check:
        name: Theme Check
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - name: Theme Check
              uses: shopify/theme-check-action@v1
              with:
                  theme_root: "."
                  token: ${{ github.token }}

This is what the action returns:

Run shopify/theme-check-action@v1
  with:
    theme_root: .
    token: ***
/usr/bin/docker run --name a95e3fb7[2](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:2)2e8a6604018b[3](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:3)39a1bf[4](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:4)7ccc77c_14[5](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:5)fac --label 29a95e --workdir /github/workspace --rm -e INPUT_THEME_ROOT -e INPUT_TOKEN -e INPUT_FLAGS -e INPUT_VERSION -e INPUT_BASE -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/wedge/wedge":"/github/workspace" 29a95e:3fb[7](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:7)22e[8](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:8)a6604018b33[9](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:9)a1bf47ccc77c
Successfully installed ast-2.4.2
Successfully installed parser-3.1.1.0
Successfully installed liquid-5.2.0
Successfully installed theme-check-1.[10](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:10).1
4 gems installed
$ theme-check --version
1.10.1
$ theme-check -o json .
Checking . ...
/usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/json_printer.rb:28:in `sort_by': comparison of Pathname with nil failed (ArgumentError)
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/json_printer.rb:28:in `offenses_by_path'
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/json_printer.rb:[11](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:11):in `print'
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/cli.rb:221:in `print_with_format'
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/cli.rb:193:in `check'
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/cli.rb:[12](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:12)3:in `run!'
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/cli.rb:127:in `run'
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/lib/theme_check/cli.rb:[14](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:14)9:in `parse_and_run'
    from /usr/lib/ruby/gems/3.0.0/gems/theme-check-1.10.1/exe/theme-check:6:in `<top (required)>'
    from /github/home/bin/theme-check:25:in `load'
    from /github/home/bin/theme-check:25:in `<main>'
Creating GitHub check...
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /index.js:69:27
    at async /index.js:67:[20](https://github.com/Iceberg9/wedge/runs/5434652096?check_suite_focus=true#step:4:20)
Error: Unexpected end of JSON input
charlespwd commented 2 years ago

Oh darn. That's a theme-check bug with the json printer. I'll get that fixed ASAP. Thanks for the report!

charlespwd commented 2 years ago

Should be fixed now :)