bashsupport-pro icon indicating copy to clipboard operation
bashsupport-pro copied to clipboard

shellcheck source= directive is processed differently than shellcheck

Open jakub-bochenski opened this issue 5 months ago • 2 comments

Shellcheck resolves source directive relative to the working directory that it was executed, no relative to the file, e.g.

src/
  - sourcing.sh
  - source.sh

If you run shellcheck from project root it expects the sourcing.sh file to have

  # shellcheck source=src/source.sh

BashSupport-Pro resolves the directive relative to the file it's in, so it expects:

  # shellcheck source=../src/source.sh

So either the directive will fail for CLI shellcheck or for the plugin.

I think it's reasonable for the plugin to assume that shellcheck would be run from project root. An additional setting to override this might be useful.

$ shellcheck --version 
ShellCheck - shell script analysis tool
version: 0.9.0
license: GNU General Public License, version 3
website: https://www.shellcheck.net

jakub-bochenski avatar Aug 07 '25 13:08 jakub-bochenski