reviewdog / errorformat Goto Github PK
View Code? Open in Web Editor NEWVim's quickfix errorformat implementation in Go
Home Page: https://reviewdog.github.io/errorformat-playground/
License: MIT License
Vim's quickfix errorformat implementation in Go
Home Page: https://reviewdog.github.io/errorformat-playground/
License: MIT License
Sorry, if this is not the right place to ask questions about how the formatting should be done in general ๐โโ๏ธ
I am trying to setup reviewdog for jest (in github actions). I want reviewdog to tell me about failed tests.
This is e.g. a output when a test has failed:
PASS src/store/media/api/__tests__/api.test.ts
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks.
Summary of all failing tests
FAIL src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts
โ Test suite failed to run
Cannot find module '../../../../../jobs/memory/upload/job' from 'src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts'
41 | // Mocking our components that depend on reduxStore and are causing issues.
42 | jest.mock("src/__dev__/AccountSetup", () => ({}));
> 43 | jest.mock("src/jobs/memory/upload/job", () => ({}));
| ^
44 | jest.mock("src/store/reduxStore", () => ({}));
45 |
46 | it("should remove pending creation when room gets updated with last message", () => {
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
at Object.<anonymous> (src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts:43:6)
Test Suites: 1 failed, 5 skipped, 144 passed, 145 of 150 total
Tests: 9 skipped, 302 passed, 311 total
Snapshots: 138 passed, 138 total
Time: 56.5 s
Ran all test suites.
This is the efm pattern I got, which works nicely:
%-G%[%^ ]%.%#
%E%.%#โ %m
%Z%.%#at %.%# (%f:%l:%c)
%C%.%#
%-G%.%#
However, for the failed test above it reports as file:
node_modules/jest-resolve/build/index.js:306:11
This is not correct, the error originates from:
src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts:43:6
There are two at
lines at the end:
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
at Object.<anonymous> (src/store/conversation/matrix/middlewares/__tests__/roomDeletePendingCreationOnLastMessage.test.ts:43:6)
How can I tell the errorformat to take the last at
match?
Thanks in advance!
I run a linter that produces a report file containing
docs/platform/training/index.md:32:73:Google.We:Try to avoid using first-person plural like 'we'.
The Google:We
is the identifier for which lint rule was violated.
The underlying quickfix implementation in vim only supports:
%n error number (finds a number)
%m error message (finds a string)
but many tools produce an error code like that which is alphanumeric and can't be parsed with %n
.
In the SARIF output I'd like to use ruleId
to capture this field, so the message doesn't get the code jammed in it.
https://github.com/microsoft/sarif-tutorials/blob/main/docs/3-Beyond-basics.md#related-locations
shows a sample of how this may be reported.
Hi,
First of all thank you for your application that looks very promising.
I wanted to test the playground, but most of the examples are broken, probably due to git.io links not really working anymore.
Working links
Not working links:
Invalid character in header content [\"location\"]
)After #82 has been merged I'm planning to add support for the black formatter. This would allow us to create a reviedog action which shows the files that would be formatted when black would run.
https://github.com/alecthomas/gometalinter already normalizes the output for most Go static check tools, so the hard work is mostly done. I would also hope that the output ([govet]
below) would show the subtool used rather than always [gometalinter]
, but that's a minor point.
Currently, the regex explicitly only allows escaped spaces in filenames.
Line 413 in e024dee
But some tools like flake8 print the output with unescaped file names, even if the input was escaped.
Currently, there is no way to match those filenames.
example
cat foo\ bar/a.py | flake8 --stdin-display-name foo\ bar/a.py -
foo bar/a.py:1:80: E501 line too long (144 > 79 characters)
Not really sure if there is a good solution for this
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/workflows/code-scanning.yml
actions/checkout v4
actions/setup-go v5
github/codeql-action v3
.github/workflows/reviewdog.yml
actions/checkout v4
reviewdog/action-golangci-lint v2
.github/workflows/tests.yml
actions/setup-go v5
actions/checkout v4
codecov/codecov-action v4
actions/setup-go v5
actions/checkout v4
go.mod
go 1.13
github.com/haya14busa/go-checkstyle v0.0.0-20170303121022-5e9d09f51fa1@5e9d09f51fa1
github.com/haya14busa/go-sarif v0.0.0-20210102043135-e2c5fed2fa3d@e2c5fed2fa3d
fmts/testdata/resources/javascript/package.json
fmts/testdata/resources/scala/build.sbt
scala 2.13.12
fmts/testdata/resources/scala/project/plugins.sbt
org.scalastyle:scalastyle-sbt-plugin 1.0.0
Given this error log:
FAILURE: Schema [/github/workspace/schemas/meta-info/jsonschema/1-0-0] contains following errors:
1. error: "objecta" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
level: "error"
domain: "syntax"
schema: {"loadingURI":"#","pointer":""}
keyword: "type"
found: "objecta"
valid: ["array","boolean","integer","null","number","object","string"]
2. Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]
FAILURE: Schema [/github/workspace/schemas/view_info/jsonschema/1-0-0] contains following errors:
1. Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]
FAILURE: Schema [/github/workspace/schemas/page_info/jsonschema/1-0-0] contains following errors:
1. error: "String" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
level: "error"
domain: "syntax"
schema: {"loadingURI":"#","pointer":"/properties/page_access"}
keyword: "type"
found: "String"
valid: ["array","boolean","integer","null","number","object","string"]
2. Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]
FAILURE: Schema [/github/workspace/schemas/user_info/jsonschema/1-0-0] contains following errors:
1. Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]
TOTAL: 0 Schemas were successfully validated
TOTAL: 4 invalid Schemas were encountered
TOTAL: 6 errors were encountered
and errorformat string
%EFAILURE:\ Schema\ [%-P%f]%.%#,%#.\ %m,%C%.%#,%-G%.%#
the playground can parse errors correctly
[
{
"filename": "/github/workspace/schemas/meta-info/jsonschema/1-0-0",
"lnum": 0,
"col": 0,
"vcol": false,
"nr": 0,
"pattern": "",
"text": "error: \"objecta\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])",
"type": 0,
"valid": true,
"lines": [
"1. error: \"objecta\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])"
]
},
{
"filename": "/github/workspace/schemas/meta-info/jsonschema/1-0-0",
"lnum": 0,
"col": 0,
"vcol": false,
"nr": 0,
"pattern": "",
"text": "Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]",
"type": 0,
"valid": true,
"lines": [
"2. Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]"
]
},
{
"filename": "/github/workspace/schemas/view_info/jsonschema/1-0-0",
"lnum": 0,
"col": 0,
"vcol": false,
"nr": 0,
"pattern": "",
"text": "Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]",
"type": 0,
"valid": true,
"lines": [
"1. Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]"
]
},
{
"filename": "/github/workspace/schemas/page_info/jsonschema/1-0-0",
"lnum": 0,
"col": 0,
"vcol": false,
"nr": 0,
"pattern": "",
"text": "error: \"String\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])",
"type": 0,
"valid": true,
"lines": [
"1. error: \"String\" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])"
]
},
{
"filename": "/github/workspace/schemas/page_info/jsonschema/1-0-0",
"lnum": 0,
"col": 0,
"vcol": false,
"nr": 0,
"pattern": "",
"text": "Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]",
"type": 0,
"valid": true,
"lines": [
"2. Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]"
]
},
{
"filename": "/github/workspace/schemas/user_info/jsonschema/1-0-0",
"lnum": 0,
"col": 0,
"vcol": false,
"nr": 0,
"pattern": "",
"text": "Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]",
"type": 0,
"valid": true,
"lines": [
"1. Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]"
]
}
]
But the CLI tool
cat err.log | errorformat '%EFAILURE:\ Schema\ [%-P%f]%.%#,%#.\ %m,%C%.%#,%-G%.%#'
doesn't output the filename
properly:
|| FAILURE: Schema [/github/workspace/schemas/meta-info/jsonschema/1-0-0] contains following errors:
|| 1. error: "objecta" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
|| level: "error"
|| domain: "syntax"
|| schema: {"loadingURI":"#","pointer":""}
|| keyword: "type"
|| found: "objecta"
|| valid: ["array","boolean","integer","null","number","object","string"]
||
|| 2. Error: JSON Schema [iglu:root/meta-info/jsonschema/1-0-0] doesn't conform path [schemas/meta-info/jsonschema/1-0-0]
|| FAILURE: Schema [/github/workspace/schemas/view_info/jsonschema/1-0-0] contains following errors:
|| 1. Error: JSON Schema [iglu:root/view_info/jsonschema/1-0-0] doesn't conform path [schemas/view_info/jsonschema/1-0-0]
|| FAILURE: Schema [/github/workspace/schemas/page_info/jsonschema/1-0-0] contains following errors:
|| 1. error: "String" is not a valid primitive type (valid values are: [array, boolean, integer, null, number, object, string])
|| level: "error"
|| domain: "syntax"
|| schema: {"loadingURI":"#","pointer":"/properties/page_access"}
|| keyword: "type"
|| found: "String"
|| valid: ["array","boolean","integer","null","number","object","string"]
||
|| 2. Error: JSON Schema [iglu:root/page_info/jsonschema/1-0-0] doesn't conform path [schemas/page_info/jsonschema/1-0-0]
|| FAILURE: Schema [/github/workspace/schemas/user_info/jsonschema/1-0-0] contains following errors:
|| 1. Error: JSON Schema [iglu:root/user_info/jsonschema/1-0-0] doesn't conform path [schemas/user_info/jsonschema/1-0-0]
|| TOTAL: 0 Schemas were successfully validated
|| TOTAL: 4 invalid Schemas were encountered
|| TOTAL: 6 errors were encountered
README says ...but it doesn't support Vim regex.
but I see this too
efm, _ := errorformat.NewErrorformat([]string{`%f:%l:%c: %m`, `%-G%.%#`})
which is using a regex pattern %.%#
.
Not a vim user and up until yesterday, I had no idea what an errorformat was. So I'm not sure what's going on here.
The ultimate issue is that reviewdog is not reporting any findings despite errors so I'm trying to debug that.
If I run tsc
using yarn without silent option, I will get the following output.
yarn run v1.22.10
$ /Users/odan/source/github.com/odan-sandbox/reviewdog-later-strict-example/node_modules/.bin/tsc --project tsconfig.strict.json --noEmit
src/app.ts(1,29): error TS7006: Parameter 'x' implicitly has an 'any' type.
src/app.ts(5,30): error TS7006: Parameter 'x' implicitly has an 'any' type.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Analyzing this with typescript's Errorformat will fail to parse it.
ref: https://reviewdog.github.io/errorformat-playground/?efms=%25E%25f+%25%23%28%25l%2C%25c%29%3A+error+TS%25n%3A+%25m&text=yarn+run+v1.22.10%0A%24+%2FUsers%2Fodan%2Fsource%2Fgithub.com%2Fodan-sandbox%2Freviewdog-later-strict-example%2Fnode_modules%2F.bin%2Ftsc+--project+tsconfig.strict.json+--noEmit%0Asrc%2Fapp.ts%281%2C29%29%3A+error+TS7006%3A+Parameter+%27x%27+implicitly+has+an+%27any%27+type.%0Asrc%2Fapp.ts%285%2C30%29%3A+error+TS7006%3A+Parameter+%27x%27+implicitly+has+an+%27any%27+type.%0Ainfo+Visit+https%3A%2F%2Fyarnpkg.com%2Fen%2Fdocs%2Fcli%2Frun+for+documentation+about+this+command.%0A
If yarn's silent option is enabled, only error messages will be printed and the parsing will succeed.
src/app.ts(1,29): error TS7006: Parameter 'x' implicitly has an 'any' type.
src/app.ts(5,30): error TS7006: Parameter 'x' implicitly has an 'any' type.
This problem does not occur on npx.
Currently the test for golang v1.8 is failing due to installing golint.
# golang.org/x/tools/go/internal/gcimporter
../../../golang.org/x/tools/go/internal/gcimporter/bexport.go:212: obj.IsAlias undefined (type *types.TypeName has no field or method IsAlias)
The command "go get github.com/golang/lint/golint" failed and exited with 2 during .
Already Go 1.12 released, Go 1.8 is no longer supported by the Go team.
https://golang.org/doc/devel/release.html#policy
And golint has same support policy as golang. golang/lint@470b6b0
I think that it is better to support only the latest version and 2 former versions.
How to reproduce
package errorformat_test
import (
"testing"
"github.com/reviewdog/errorformat"
)
func TestPanic(t *testing.T) {
_, err := errorformat.NewEfm("%")
if err == nil {
t.Fatal("should return error")
}
}
--- FAIL: TestPanic (0.00s)
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1
goroutine 33 [running]:
testing.tRunner.func1.1(0x5406c0, 0xc000154020)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1072 +0x30d
testing.tRunner.func1(0xc000102480)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1075 +0x41a
panic(0x5406c0, 0xc000154020)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/runtime/panic.go:969 +0x1b9
github.com/reviewdog/errorformat.NewEfm.func1(...)
/home/heijo/ghq/github.com/reviewdog/errorformat/errorformat.go:435
github.com/reviewdog/errorformat.NewEfm(0x54feb1, 0x1, 0xc00005e770, 0x47e246, 0x60281766)
/home/heijo/ghq/github.com/reviewdog/errorformat/errorformat.go:442 +0x93f
github.com/reviewdog/errorformat_test.TestPanic(0xc000102480)
/home/heijo/ghq/github.com/reviewdog/errorformat/panic_test.go:10 +0x3a
testing.tRunner(0xc000102480, 0x55b548)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1123 +0xef
created by testing.(*T).Run
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1168 +0x2b3
exit status 2
FAIL github.com/reviewdog/errorformat 0.004s
Hi. Many CLI tools output highlighted, colorized text. Special ANSI-codes are used in this cases. For example ruby linter fasterer output:
fasterer | cat -A
^[[0;31;49mtestdata/examples.rb:3^[[0m Array#shuffle.first is slower than Array#sample.$
where ^[[0;31;49m ... ^[[0m
- red-color ANSI-codes.
I tried to handle this ANSI-codes via efm masks, but i didn't cope with it. May be is there solution for escaping ANSI-codes?
According to documentation %o
and %>
are valid items in errorformat string:
%o module name (finds a string)
%> for next line start with current pattern again efm-%>
But this application does not support this items
We recently noticed that reviewdog was no longer capturing output from remark-lint, here is a comparison:
I tracked down the issue and it is because the output of remark lint was adjusted last year in vfile/vfile-reporter@f987b52 (and you can see the changes in the documentation here remarkjs/remark@6a43da8#diff-1152eab75d1ca2f7af44b54d8655b0cc01168ea48f5f9de4b346acc526eefb28L155-L160). Most of the whitespace changes is not a big deal but removing the two spaces between warning (or error) and the message causes a failure to match the format. Here is an example of the just that change:
resources/markdown/README.md
- 25:3 warning Incorrect list-item indent: add 2 spaces list-item-indent remark-lint
+ 25:3 warning Incorrect list-item indent: add 2 spaces list-item-indent remark-lint
I believe the format in https://github.com/reviewdog/errorformat/blob/master/fmts/markdown.go#L10-L11 needs to drop the extra space to match the changes. I will try to share a pull request to make that change.
format is written in https://pypi.python.org/pypi/pep8
Hello,
Is it possible for reviewdog
to directly consume a JSON array of errorformat.Entry
?
Thanks.
Hey there, is there support for multiline notes with %N
? When I try this in the playground, I get the error E376: Invalid %N in format string prefix
It would be nice if reviewdog supported pmd. It has very similar report format as checkstyle, so it should not be too hard.
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.