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

Fails to report errors with custom errorformat #667

Open
mrchief opened this issue Jul 12, 2020 · 2 comments
Open

Fails to report errors with custom errorformat #667

mrchief opened this issue Jul 12, 2020 · 2 comments
Labels

Comments

@mrchief
Copy link

mrchief commented Jul 12, 2020

Running reviewdog with jsonlint: ./node_modules/.bin/jsonlint -q -c $i | ./reviewdog -efm="%f: line %l, col %c, %m" -name="json lint" -reporter=github-check -fail-on-error

2020/07/12 06:03:26 [json lint] reported: https://github.com/mrchief/test-super-linter/runs/862206024 (conclusion=success)
2020/07/12 06:03:27 [json lint] reported: https://github.com/mrchief/test-super-linter/runs/862206064 (conclusion=success)
2020/07/12 06:03:28 [json lint] reported: https://github.com/mrchief/test-super-linter/runs/862206093 (conclusion=success)
2020/07/12 06:03:29 [json lint] reported: https://github.com/mrchief/test-super-linter/runs/862206105 (conclusion=success)
test/bad.json: line 1, col 1, found: 'INVALID' - expected: 'STRING', '}'.
2020/07/12 06:03:30 [json lint] reported: https://github.com/mrchief/test-super-linter/runs/862206112 (conclusion=success)
test/bad2.json: line 1, col 6, found: 'INVALID' - expected: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['.
2020/07/12 06:03:31 [json lint] reported: https://github.com/mrchief/test-super-linter/runs/862206124 (conclusion=success)

No errors reported
image

Errorformat playground tells me my format is correct.

I checked with latest as well as nightly build but no luck.

Same issue happens with markdownlint

Run npx -q markdownlint-cli -c .rules/.markdownlint.json -p .rules/.markdownlintignore test/bad.md test/bad2.md \
  npx -q markdownlint-cli -c .rules/.markdownlint.json -p .rules/.markdownlintignore test/bad.md test/bad2.md \
    | ./reviewdog -efm="%f:%l:%c %m" -efm="%f:%l %m" -name="markdown lint" -reporter=github-check -fail-on-error
  shell: /bin/bash -e {0}
  env:
    REVIEWDOG_GITHUB_API_TOKEN: ***
test/bad.md:1 MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "## Introduction"]
test/bad.md:6 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4]
test/bad.md:6:1 MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: "####  Instructions"]
test/bad.md:6:18 MD047/single-trailing-newline Files should end with a single newline character
test/bad2.md:1 MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "## Introduction"]
test/bad2.md:6 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4]
test/bad2.md:6:1 MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: "####  Instructions"]
test/bad2.md:6:18 MD047/single-trailing-newline Files should end with a single newline character
2020/07/12 06:03:36 [markdown lint] reported: https://github.com/mrchief/test-super-linter/runs/862206621 (conclusion=success)

Errorformat playground

image

I had similar issue with docker lint but that got fixed with -fail-on-error

./hadolint $i | ./reviewdog -efm="%f:%l:%c %m" -name="docker lint" -reporter=github-check -fail-on-error

image

I'm using pylama and yamllint - both with custom formats and they seem to work just fine, even without -fail-on-error. So I'm not sure what's going on.

image

image

Here's my Github Actions script if that helps:

      - name: Install Reviewdog
        run: wget -nv -O - https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh | sh -s -- -b .

      - name: Lint JSON Files
        if: always() && endsWith(steps.group_files.outputs.jsonFiles, '.json"]')
        run: |
          yarn add jsonlint
          jsonFiles=${{ join(fromJSON(steps.group_files.outputs.jsonFiles), ',') }}
          for i in ${jsonFiles//,/ }
          do
            ./node_modules/.bin/jsonlint -q -c $i | ./reviewdog -efm="%f: line %l, col %c, %m" -name="json lint" -reporter=github-check -fail-on-error
          done

      - name: Lint Markdown Files
        if: always() && endsWith(steps.group_files.outputs.markdowns, '.md"]')
        run: |
          npx -q markdownlint-cli -c .rules/.markdownlint.json -p .rules/.markdownlintignore ${{ join(fromJSON(steps.group_files.outputs.markdowns), ' ') }} \
            | ./reviewdog -efm="%f:%l:%c %m" -efm="%f:%l %m" -name="markdown lint" -reporter=github-check -fail-on-error
@haya14busa
Copy link
Member

haya14busa commented Jul 13, 2020

I'm guessing jsonlint and markdownlint output results to stderr instead of stdout, so the results are not piped to reviwedog. Can you confirm?

@pbnj
Copy link

pbnj commented Jul 20, 2021

Yes.

$ markdownlint README.md
README.md:70 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
README.md:71 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 3]
README.md:72 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 4]
README.md:73 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 5]
README.md:74 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 6]
README.md:75 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 7]
README.md:76 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 8]
README.md:77 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 9]
README.md:78 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 10]

$ echo $?
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants