-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Investigate an easy way to execute commandline tools #18
Comments
This will NO-OP when running inside hosted Danger |
OK, I"ve one back to this. I've found a good idea to base it on, VS Code's problem matchers It's support an arg like: {
// The problem is owned by the cpp language service.
"owner": "cpp",
// The file name for reported problems is relative to the opened folder.
"fileLocation": ["relative", "${workspaceRoot}"],
// The actual pattern to match problems in the output.
"pattern": {
// The regular expression. Example to match: helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’ [-Wimplicit-function-declaration]
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
// The first match group matches the file name which is relative.
"file": 1,
// The second match group matches the line on which the problem occurred.
"line": 2,
// The third match group matches the column at which the problem occurred.
"column": 3,
// The fourth match group matches the problem's severity. Can be ignored. Then all problems are captured as errors.
"severity": 4,
// The fifth match group matches the message.
"message": 5
}
} danger.run({
command: "eslint",
errorPatterns: [
{
regexp: "^([^\\s].*)$",
file: 1
},
{
regexp: "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
line: 1,
column: 2,
severity: 3,
message: 4,
code: 5,
loop: true
}
]
}) We may be able to take the code directly from vscode, don't think they separate it into modules much so it'd need a license attaching and bringing inline but it seems like the right abstraction. |
Just like VS Code, we can ship with some common JS ones, looking through extensions and vscode for examples. |
I've got roughly half way with integrating the VS Code matcher runner into DangerJS. It's 1400 LOC though, and our TSConfig is considerably more strict than the one on VS Code. So I think I may need to do a clean room re-implementation instead. |
Ah yeah, this is two things.
const output = child_process.execSync(`yarn why jest --json`)
// Comes as a series of little JSON messages
const usefulJSONContents = output.toString().split(`{"type":"activityEnd","data":{"id":0}}`).pop() as string
const asJSON = usefulJSONContents.split("}\n{").join("},{") which basically does what I wanted.
so, I guess this could probably be closed. |
I'm not to sold on the need for this now, you can use any node module - so let people do that. |
I'll want something that takes flow & ESLint's JSON output and allows us to show errors for that. In ruby this is as simple as
`echo "OK"`
I don't know what that should look like in JS, perhaps we'll need something like?
Given the prevalence of JSON output, we can optionally handle the transition from text for users too
The text was updated successfully, but these errors were encountered: