简体   繁体   English

所有没有扩展名的文件的shellcheck vscode“shellcheck.ignorePatterns”

[英]shellcheck vscode “shellcheck.ignorePatterns” for all files with no extension

I am using the shellcheck vscode extension and I would like shellcheck to ignore files everywhere that do not have a file extension.我正在使用 shellcheck vscode 扩展,我希望 shellcheck 忽略所有没有文件扩展名的文件。 I have tried many different glob patterns and nothing works.我尝试了许多不同的 glob 模式,但没有任何效果。

The closest I got was:我得到的最接近的是:

  "shellcheck.ignorePatterns": {
      "*[!(.)]/**": true
  }

But it really wasn't close.但它真的不是很接近。

Does anyone know the magic sauce?有人知道魔法酱吗?

It seems that an extensionless file cannot be globbed.似乎无法对无扩展名文件进行通配。

I ended up not using the vscode shellcheck extension and used an inclusive approach with shellcheck on the command line, offloading the task of what to include to find .我最终没有使用 vscode shellcheck 扩展,而是在命令行上使用了shellcheck的包容性方法,卸载了要包含find的任务。

All my scripts that needed to be linted were .sh files so this worked:我所有需要检查的脚本都是.sh文件,所以这行得通:

find . -type d \( -name node_modules -o -name vendor -o -path /tmp \) -prune -false -o -name '*.sh' -exec shellcheck {} \;

I would have liked to keep the bash linting in vscode but I had to settle for the above solution due to the limitation of globs/vscode.我本来希望在 vscode 中保留 bash linting,但由于 glob/vscode 的限制,我不得不接受上述解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM