Closed Psycojoker closed 3 years ago
Thanks to link me this project. I will take a look.
Well I just gave it a try and it is far from being miraculous compared to shlex ...
Neither of those seem to be designed to handle parsing (large?) bash files ... I had to supress commented and empty line myself for it to accept running on it, and now I am facing an AssertionError right in the middle of the code's lib with no clue what's wrong ...
Line-by-line parsing is not happy either if it encounters an if (which is meant to be closed on another line)
So, nope...
Meh, that sucks x(
The code still quite active if you are motivated (while I'm expecting you to have no time for that) to report a bug. It's used by https://www.explainshell.com/ so I would have expect it to be quite robust but meh.
Well yea those bugs are already reported (and there are even PR) since 2015~2016 ... https://github.com/idank/bashlex/issues
Closing because meh, the current package_linter pretty much works, there's a few issues about multiline stuff but that's not really important ... moving to another parser would imply quite a lot of refactoring I think, without so much gain
The current work is done using simple guess that triggers false positive. We should uses a real bash parser instead to be sure that we don't have false positives, something like this one: https://github.com/idank/bashlex