coala provides a unified interface for linting and fixing code with a single configuration file named .coafile using coala-bears. Using command-line tool, the coala output reults can be collected in a JSON file.
I was looking a way to find out how can I convert these JSON results to LSP output format? or any another way I can get LSP output over my project files whenever i run coala tool over it?
Have tried to gone through documentation but couldn't gathered much information about what I'm looking for.
Need help over this!
The best thing I can think of is writing a language server that reads the .coafile and converts it to LSP JSON as specified here: https://microsoft.github.io/language-server-protocol/specification.
Is there any such implementation or an example of such conversions that can help me?
@KVGarg It sounds to me like you would have to do the following based on the JSON output:
affected_code.message.severity.affected_code to identify the relevant Location of the file.This is how I would start anyway. Does that help?
{
"results": {
"cli": [
{
"additional_info": "Your source code contains trailing whitespaces. Those usually have no meaning. Please consider removing them.",
"affected_code": [
{
"end": {
"column": null,
"file": "/app/src/main.c",
"line": 1
},
"file": "/app/src/main.c",
"start": {
"column": null,
"file": "/app/src/main.c",
"line": 1
}
}
],
"aspect": "NoneType",
"confidence": 100,
"debug_msg": "",
"diffs": {
"/app/src/main.c": "--- \n+++ \n@@ -1,4 +1,4 @@\n-#include <stdio.h> \n+#include <stdio.h>\n \n int main(void) {\n printf(\"Welcome to coala. Keep following the tutorial, you are doing a great job so far!\\n\");\n"
},
"id": 179057403958711993733277794052454578827,
"message": "Line contains following spacing inconsistencies:\n- Trailing whitespaces.",
"message_arguments": {},
"message_base": "Line contains following spacing inconsistencies:\n- Trailing whitespaces.",
"origin": "SpaceConsistencyBear",
"severity": 1
}
]
}
Does that help?
@dbaeumer @rcjsuen Thnx for such great help. It actually gave me a clear path on how to achieve my goal. Thank U so much :+1: :innocent:
You are welcome.
I will close the issue then.
Most helpful comment
@KVGarg It sounds to me like you would have to do the following based on the JSON output:
affected_code.message.severity.affected_codeto identify the relevantLocationof the file.This is how I would start anyway. Does that help?