colis-anr / morbig

A static parser for POSIX Shell
Other
189 stars 8 forks source link

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

Open anadon opened 1 week ago

anadon commented 1 week ago

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.

anadon commented 5 days ago

Now needed to better support https://github.com/koalaman/shellcheck/issues/3008

Niols commented 5 days ago

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.
anadon commented 5 days ago

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.

Niols commented 5 days ago

That would be very interesting indeed!

anadon commented 3 days ago

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.