vscode-shellcheck icon indicating copy to clipboard operation
vscode-shellcheck copied to clipboard

disable shellcheck for files with no extension?

Open apolopena opened this issue 3 years ago • 7 comments

Is this even possible?

apolopena avatar Apr 05 '21 22:04 apolopena

It's probably doable through

image

felipecrs avatar Apr 05 '21 23:04 felipecrs

According to this answer, something like the following should work:

"shellcheck.ignorePatterns": {
  "[!.]": true,
  "[!.][!.]": true,
  "[!.][!.][!.]": true,
  "[!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true
}

felipecrs avatar Apr 05 '21 23:04 felipecrs

Make sense. I had this type of glob hack in my vscode settings for another purpose. I have all my scripts I need to run shellcheck on in a hidden folder so I wont be able to use this.

I decided to use shellcheck from the command line with an inclusive approach, offloading to find the responsibility of what files to run. So like this:

alias lint-starter-scripts='find "$(pwd)/.gp" -type d \( -name node_modules -o -name vendor \) -prune -false -o -name "*.sh" -exec shellcheck -x -P "$(pwd)/.gp" {} \;'

apolopena avatar Apr 06 '21 19:04 apolopena

Got it. I'll think about it and if this could be solved in another way. The best thing would be VS Code's globbing to support such scenarios.

felipecrs avatar Apr 07 '21 17:04 felipecrs

PS: I could not think of anything yet.

felipecrs avatar Jun 04 '22 15:06 felipecrs

According to this answer, something like the following should work:

"shellcheck.ignorePatterns": {
  "[!.]": true,
  "[!.][!.]": true,
  "[!.][!.][!.]": true,
  "[!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true,
  "[!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.][!.]": true
}

просто охуеть! no comments

s3rgeym avatar Aug 04 '23 15:08 s3rgeym

I believe this is a limitation of vscode's glob parser, not the extension's.

felipecrs avatar Aug 04 '23 16:08 felipecrs