Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finer grained control over shell dialect features #1341

Open
vapier opened this issue Sep 20, 2018 · 2 comments
Open

finer grained control over shell dialect features #1341

vapier opened this issue Sep 20, 2018 · 2 comments

Comments

@vapier
Copy link
Contributor

vapier commented Sep 20, 2018

today shellcheck has one big knob to control dialect: the -s option. we'd like to run shellcheck against scripts and say it's the POSIX dialect but with support for local. our options today are not optimal:

  • use --shell=dash, but then silently allow dashisms
  • use --shell=bash, but then silently allow bashisms
  • use --shell=sh -e SC2039, but then silently allow all undefined things

it looks like dialect details are sprinkled through out the code base:

  • ] ++ if not isDash then ["local"] else []
  • whenShell [Bash, Dash] $ do -- Ksh allows it, Sh doesn't support local

if the dialect details were split out into a data structure (a dict/map), and all the code checked that data structure, it'd be easy to expose those to the command line as people could set specific dialect features directly.

on the other hand, if we consider local a common enough thing, adding a one-off knob for it would be OK too :).

@vapier
Copy link
Contributor Author

vapier commented Sep 21, 2018

@yetamrra another use case that would be covered by this is defining dialects for projects. for example, linting Gentoo ebuild/eclass files follow a particular set of rules that we'd like to be able to enforce.

@koalaman
Copy link
Owner

koalaman commented Dec 2, 2018

SC2039 should really have had a separate error code per issue, that way you could just have ignored that particular one.

Kangie pushed a commit to Kangie/shellcheck that referenced this issue Feb 27, 2023
part of POSIX shell.

See https://crbug.com/891826 for discussion and
koalaman#1341
for an upstream proposal to fix this more completely.

BUG=chromium:891826
TEST=None

Change-Id: Ie46e296fd85d4d919c0076d9206cc804aa1b79e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants