SublimeLinter / SublimeLinter-shellcheck

This linter plugin for SublimeLinter provides an interface to shellcheck.
MIT License
210 stars 20 forks source link

How to change settings so shellcheck is called with -x param? #21

Closed NiklasKunkel closed 6 years ago

NiklasKunkel commented 6 years ago

I have some code where I'm sourcing other files which returns with an [SC1091] How can I get SubelimeLinter-shellcheck to call shellcheck with the -x flag so I can enable following?

kaste commented 6 years ago

Hi!

You can set command line arguments using the args setting. See http://www.sublimelinter.com/en/stable/linter_settings.html#args

Aub-C commented 5 years ago

I received the following error when trying to add arguments to sublimelinter settings according to the documentation above. Can anyone provide better direction on this?

Additional properties are not allowed ('args' was unexpected) Invalid settings in 'Packages/User/SublimeLinter.sublime-settings': Additional properties are not allowed ('args' was unexpected)

kaste commented 5 years ago

args is setting that that belongs to a specific linter.

In the settings more like

# yaml bc it's easier to write
linters:
    shellcheck:
        args: [...]
Aub-C commented 5 years ago

@kaste

Are you able to be more specific on the configuration to add -x flag? I've been trying to get shellcheck -x to work with sublime text and SublimeLinter for a few months.

braver commented 5 years ago

@Aub-C what did you try, what did your setting look like?

d--j commented 4 years ago

For the sake of others – this is what works for me (Mac OS X):

// SublimeLinter Settings - User
{
    "linters": {
        "shellcheck": {
            "args": ["-x"],
            "working_dir": "$file_path"
        }
    }
}

You probably want to set working_dir to the dir of the file to check, not the project root (the default).

habere-et-dispertire commented 4 years ago

On MacOS, you can easily edit this file from within Sublime Text. I found restarting Sublime Text was not required. Add the -x option by editing and saving the settings file opened by the menu:

Sublime Text > Preferences > Package Settings > SublimeLinter > Settings