vscode-shellcheck

授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 丁念
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

ShellCheck for Visual Studio Code

Integrates ShellCheck into VS Code, a linter for Shell scripts.

ci

Quick start

Extension GIF

Disclaimer

vscode-shellcheck (this "extension"), requires shellcheck (the awesome static analysis tool for shell scripts) to work.

Since v0.10.0, precompiled shellcheck binaries are bundled for these platforms:

  • Linux (x86_64)
  • macOS (x86_64)
  • Windows: precompiled 32bit binary will be used on both 32bit and 64bit Windows, please note that this requires you have WoW64 enabled, although it's not a problem for Desktop users.

Requirements

  1. Run Install Extension command from Command Palette.
  2. Search and choose shellcheck.

Options

There are various options that can be configured by making changes to your user or workspace preferences.

Default options are:

{
  "shellcheck.enable": true,
  "shellcheck.enableQuickFix": true,
  "shellcheck.run": "onType",
  "shellcheck.executablePath": "", // Priority: user defined > bundled shellcheck binary > "shellcheck"
  "shellcheck.exclude": [],
  "shellcheck.customArgs": [],
  "shellcheck.ignorePatterns": {
    "**/*.xonshrc": true,
    "**/*.xsh": true,
    "**/*.zsh": true,
    "**/*.zshrc": true,
    "**/zshrc": true,
    "**/*.zprofile": true,
    "**/zprofile": true,
    "**/*.zlogin": true,
    "**/zlogin": true,
    "**/*.zlogout": true,
    "**/zlogout": true,
    "**/*.zshenv": true,
    "**/zshenv": true,
    "**/*.zsh-theme": true
  },
  "shellcheck.ignoreFileSchemes": ["git", "gitfs"]
}

shellcheck.ignorePatterns

The shellcheck.ignorePatterns works exactly the same as search.exclude, read more about glob patterns here

For example:

{
  "shellcheck.ignorePatterns": {
    "**/*.zsh": true,
    "**/*.zsh*": true,
    "**/.git/*.sh": true,
    "**/folder/**/*.sh": true
  }
}

Fix all errors on save

The auto-fixable errors can be fixed automatically on save by using the following configuration:

{
  "editor.codeActionsOnSave": {
    "source.fixAll.shellcheck": true
  }
}

Alternatively, you can fix all errors on demand by running the command Fix All in the VS Code Command Palette.

Lint onType or onSave

By default the linter will lint as you type. Alternatively, set shellcheck.run to onSave if you want to lint only when the file is saved (works best if auto-save is on).

{
  "shellcheck.run": "onType" // also: "onSave"
}

Excluding Checks

By default all shellcheck checks are performed and reported on as necessary. To globally ignore certain checks in all files, add the "SC identifiers" to shellcheck.exclude. For example, to exclude SC1017:

{
  "shellcheck.exclude": ["1017"]
}

Using Docker version of shellcheck

In order to get it work, you need a "shim" script, and then, just remember, do not try to construct command line arguments for shellcheck yourself.

Here is a simple "shim" script to get start with (See discussion: #24):

#!/bin/bash

exec docker run --rm -i -v "$PWD:/mnt:ro" koalaman/shellcheck:v0.7.0 "$@"

Acknowledgements

This extension is based on @hoovercj's Haskell Linter.

Contributors

LICENSE

This extension is licensed under the MIT license.

Bundled shellcheck binaries are licensed under GPLv3.

  • 首先明确一点,win10由于无法安装powershell3.0或以上版本,由于这个是安装后面东西的前提。所以用win10的就不用看了。(根据风逝紫玄的回复,他的win10就有powershell5.0,估计是我的win10版本问题) 1. 升级powershell 检查powershell版本,打开powershell,输入命令:$PSVersionTable,看psVersion版本。一般没安装

  • bash环境需要安装的插件 插件名称 说明 Remote Development 远程开发【必装】 ShellCheck SHELL静态分析工具,可以帮助我们快速识别语法问题 shell-format Shell脚本自动格式化 AutoComplate shell Shell自动完成插件 Shell Syntax 实时识别语法错误,并提示修复方法 Shell Banner Comments 生成S

  • VSCode 编写 Shell 脚本 用到的插件: shellman: 语法提示 shell-format: 格式化 shellcheck: 语法错误检查 Remote-WSL(可选): 远程打开WSL(子系统) 上的目录, 运行 shell shellman 直接从应用市场安装即可 shell-format 前提: shell-format依赖于 shfmt shell-format会调用本地的

  • VScode 配置 本文采用知识共享署名 4.0 国际许可协议进行许可,转载时请注明原文链接,图片在使用时请保留全部内容,可适当缩放并在引用处附上图片所在的文章链接。 资料 vs code 快捷键 将下一个查找匹配项添加到选择 VS 插件 Markdown TOC Markdown Preview Enhanced Markdown All in One GitLens Code Spell Ch

  • 简介 shellcheck 是一款实用的 shell脚本静态检查工具。 首先,可以帮助你提前发现并修复简单的语法错误,节约时间。每次都需要运行才发现写错了一个小地方,确实非常浪费时间。 其次,可以针对你当前不够完善不够健壮的写法,提供建议,帮助你提前绕开一些坑,避免等问题真的发生了才去调试处理。 在其介绍中,目标是针对所有用户的,从初学者到高手,都用得上 指出并澄清典型的初学者的语法问题,那通常会

  • 通过 Vitess 自带的 docker-compose 在本地拉起 Vitess 环境倒是很方便,但是调试起来很痛苦,本地编译的vtgate可以跑起来,连接到 compose 运行的 consul,但因为 vttablet 注册到counsul的地址是容器内的hostname,宿主机运行的vtgate会连接不上。同理,调试vttablet会更痛苦。于是尝试在服务器linux上local运行(参照

  • 在linux系统中,大家可以很轻松的开发、调试shell脚本。但是,对于不熟悉linux系统 的小白或者想在Windows下开发shell脚本的人来说,这就有点不友好了。本篇文章就 教大家,在Windows上打造一个Shell IDE。 一、基础环境搭建 本次的主角是Visual Studio Code和Git,如果已经安装过可以跳过本节。 1.1 安装Visual Studio Code(VSc

 相关资料
  • Visual Studio Code - Open Source ("Code - OSS") The Repository This repository ("Code - OSS") is where we (Microsoft) develop the Visual Studio Code product together with the community. Not only do we

  • ES6 创建 tsconfig.json tsc --init { "compilerOptions": { "module": "commonjs", /* 用来指定要使用的模块标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "target": "es6" /* targe

  • Visual Studio Code 扩展 Beautify:Beautify code in place for VS Code ESLint:Integrates ESLint into VS Code Material Theme:Maybe the best theme on VS Code vscode-icons:Icons for Visual Studio Code Emmet:

  • VSCode Neovim 是将 Neovim 集成到 VSCode 的插件,该插件将 Neovim 实例完全嵌入到 VSCode,而非半成品的 VIM 模拟。此外 VSCode 原生功能被用于插入模式和编辑器命令。 主要特性 通过使用 Neovim 作为后端,几乎完全集成了功能完整的 VIM 支持自定义init.vim和许多 VIM 插件 “一等公民”支持且无延迟的插入模式,让 VSCode 做

  • rls-vscode 是 Rust 官方为 Visual Studio Code 提供的 Rust 语言服务器前端参考实现,它支持: 代码补全 jump to definition、peek definition、find all references 与 symbol search 类型和文档悬停提示 代码格式化 重构 错误纠正并应用建议 snippets 构建任务 值得一提的是 snippet

  • vscode-drawio 是一个 VS Code 扩展,它可以在 VS Code 上集成图表工具 Draw.io。 特性: 在 Draw.io 编辑器或者 XML 文件编辑 .drawio 和 .dio 文件。 编辑嵌入许多 Draw.io 图表的 .drawio.svg 文件。 创建简单。 .drawio.svg 是有效的 .svg 文件。 默认情况下使用 Draw.io 的离线版本。 可以配