Open vnadot opened 3 years ago
EPICS seems to already have a basic lexical analyzer structure going on (with yacc/lex) that is able to at provide (at least partially) a great starting point:
That being said, it'll require some additional work to mold the already existing tools to the desired state, but I'll try to look into it this week/weekend and come up with a basic viable linter based on that.
If anyone has any tips, ideas or ongoing work, I'd be glad to hear more!
I was able to create a little something since yesterday, which I hope is in line with the overall vision for the linter:
https://github.com/cnpem-iot/epics-linter
Currently, it only supports .db files, but I believe the output pattern is fairly easy to parse, following this pattern:
{error} at {line}:{column}
or {error} at {line}:{column} to {line:column}
. Here is an example:
record(ai, "test") {
field(DESC, "a way too long description name that does not fit in the maximum limit")
field(DTYP, "stream")
field(EGU, "$(EGU)")
[...]
}
Record description too long (maximum of 40) at 2:17 to 2:89
As for the amount of work required, it is all fairly simple and modular. Thanks to Lark, the grammar syntax was easily ported from the yacc/lex solution and it provides a fairly robust mechanism for detecting and describing syntax errors.
If there's another route that seems better, please let me know!
@vnadot Hello! I've received a notification for this project and I wanted to make sure that interest for a linter still existed. Github tends to not notify people in issues they're in sometimes, so I just wanted to check.
Hi @gfrn , yes it still exists ! However since several months I have no time to assign to vscode-epics. I hope to find some times in several monts but it is a bit crazy at work right now. Cheers, Victor
The idea would be to create basic linter for .db files to see if it required a lot of work. For starter, the extension could detect the following error: DESC field > 41 in EPICS 3.15.
Some links: