colis-anr/morbig

Feature Request: Multi-mode support, Bash support, Zsh support, Fish support

Opened this issue · 9 comments

Few contemporary scripts are written to conform to the POSIX standard. Many more are written to conform to bash, zsh, or fish. Of these, bash is particularly important. I'd like to see feature development to have multiple shells supported, but I'm not sure if I have the language skill level or project specific knowledge to work on these features. However, my own project requires such support and without it is basically dead.

Now needed to better support koalaman/shellcheck#3008

Morbig was initially written in the context of the CoLiS project that targeted Debian maintainer scripts, the huge majority of which are indeed written in POSIX Shell, mainly for performance reasons (dash is significantly faster than bash).

Of course, that doesn't mean that it shouldn't evolve beyond that, and it is fairly natural to want to consider classic Shell extensions — bash and zsh certainly are the most common ones (fish is also popular but is fundamentally quite different). The main two issues that I see with that are:

  1. that supporting several Shell variations involves either a lot of duplication, basically writing one version of Morbig per Shell variation, or having to separate from the POSIX standard.
  2. that we are talking about a considerable amount of work that none of us has on our hands; contributions are of course welcome, though.

I would like to hear from the experience of the shell-check developers, personally. There are many different possible outcomes depending on their experiences, and they do have much broader support of shells.

That would be very interesting indeed!

Related to #192, it appears that Shellcheck has much of the same infrastructure of Morbig. I believe a sane course of action could be to develop a version 2 using Shellcheck's infrastructure and then to extend features based on their already built out support for desired features.

If Morbig can be made extensible while also keeping the guarantee that it is as close to the POSIX standard as possible, that would be amazing. I do agree that drawing inspiration from Shellcheck would make sense. Still, lot of work!

I don't think that Morbig has been superseeded by ShellCheck. These two pieces of software do not serve the same purpose at all:

  • Morbig has been designed from the get-go to provide a static parser for POSIX Shell that could be as trustworthy as possible when it comes to respecting the standard. This was meant as a basis for static analysis tools.
  • ShellCheck, on the other hand, does not care that much about compatibility with the standard, and is more focused on wide Shell support and extensibility. Bugs in the grammar support are unimportant as long as the reports to the users are relevant.

In principle, it is possible to get the best of both worlds, but I don't think Morbig is anywhere near that (and this has never been our intent in the past, and there is no time or energy presently to tackle this) and the last times I followed ShellCheck it was also really not there yet either, and I doubt they would be interested in spending much work to support very particular grammatical peculiarities of the POSIX Shell.

It could be worth linking to ShellCheck in the README as a related tool though, indeed.