Skip to content

shellcheck source= directive is processed differently than shellcheck #203

@jakub-bochenski

Description

@jakub-bochenski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions