Coverity Connect server has a feature that highlights problematic lines in the source code. This feature has been implemented in Visual Studio Code. By using the Language Server Protocol, it also works in editors like Atom, Vim, and Emacs that support the language server (though this hasn't been confirmed).
COVLint displays the analysis results of the source code by Coverity in Visual Studio Code. The results are read from a CSV file obtained by the cov_snap script. cov_snap is a script that fetches the annotations of the source code registered on the Coverity Connect server.
Dependency note:
- Snapshot CSVs can be generated with the sanitized
cov_snap_pubtoolkit. Install it (e.g.,pip install -e ../cov_snap_pub) and runcov_snap.pyto produce thesnapshot_id_*.csvfiles consumed by COVLint.- The
cov_snapscript itself importscovautolib_3(from thecovautolibpackage). Make surecovautolib_pubis installed (e.g.,pip install -e ../covautolib_pub) orPYTHONPATHis configured so thatcovautolib_3can be resolved.
There are two ways to install COVLint: from a VSIX package file or from the VSCode Extension Marketplace.
Load the snapshot CSV file obtained with cov_snap.
-
Move to the folder where the snapshot is saved from VSCode's explorer and right-click to select the snapshot (you don't need to display the contents of the file with a left click)

-
Press
Ctrl+Shift+pto open the command palette and selectCOVLint: open CSV file
-
Paste the path of the copied snapshot CSV file into the input box

-
Move the folder and select the source code you are developing

-
Lines with issues in the source code are underlined, so hover over them
This was based on Microsoft's https://github.com/Microsoft/vscode-extension-samples lsp-sample and an article by @Ikuyadeu titled Language Server Protocol Development Tutorial.
- 2023/09/15 keides2 v0.0.1 First edition
- 2023/09/16 keides2 v0.0.2 Image replacement
- 2023/09/17 keides2 v0.0.3 Extension Marketplace support
- 2023/09/20 keides2 v0.1.0 webpack
- 2023/10/07 keides2 V0.2.0 Removed the uppercase character detection function for 3 or more characters.
- 2023/10/10 keides2 v0.3.0 The color of the wavy line, the level of the diagnosis result, and the icon change depending on the impact level: "high," "medium," and "low."
- 2023/10/13 keides2 v0.3.1 Added constraints when reading CSV files (files whose format is not snapshot_id_xxxx.csv will not be read).
- 2023/10/18 keides2 v0.3.2 Outputs an error when the return value type of the input box is undefined. (does not display an error dialog) The input box disappears when you move the focus, so "keep the input box open even if the focus moves to another part of the editor or to another window" (a usability improvement)
- 2023/11/06 keides2 v0.3.3 Supports cases where CSV file values include commas.
- 2023/11/14 keides2 v0.4.0 Added indication items "local effect" and "explanation".
Coverity Connectサーバーの特長の一つである問題のある行に指摘が付いたソースコード画面をVisual Studio Code上に実現しました。Language Server Protocol(言語サーバー)を利用していますので、言語サーバーの機能があるAtom、VimやEmacsなどのエディターで動作します(と言われていますが未確認です)。
COVLintは、Coverityが解析したソースコードの指摘結果を Visual Studio Code に表示します。
指摘結果は、スクリプトcov_snapが取得したCSVファイルから読み込みます。
cov_snapは、Coverity Connect サーバーに登録されているソースコードの指摘内容を取得するスクリプトです。
COVLintは、VSIXパッケージファイルからインストールする方法と、VSCode拡張機能マーケットプレースからインストールする方法があります。
cov_snapで取得したスナップショットCSVファイルを読み込みます
依存関係:
- スナップショット CSV は公開リポジトリの
cov_snap_pubに含まれるcov_snap.pyで生成できます。pip install -e ../cov_snap_pubなどで導入し、cov_snap.pyを実行してsnapshot_id_*.csvを作成後に COVLint に読み込ませてください。cov_snapスクリプトはcovautolibパッケージのcovautolib_3に依存しています。事前にcovautolib_pubをインストール (pip install -e ../covautolib_pubなど) するか、PYTHONPATHを設定してcovautolib_3が解決できるようにしてください。
-
VSCodeのエクスプローラーからスナップショットを保存しているフォルダに移動し、読み込みむスナップショットを右クリックで選択します(左クリックでファイルの中身を表示する必要はありません)

-
Ctrl+Shift+pを押してコマンドパレットを開き、COVLint: open CSV fileを選択します
-
ソースコードの問題のある行に波線が入っているのでマウスオーバーします
Microsoftのhttps://github.com/Microsoft/vscode-extension-samplesにあるlsp-sampleや、@Ikuyadeu 氏の記事 Language Server Protocol開発チュートリアル を参考にしました。
- 2023/09/15 keides2 v0.0.1 初版
- 2023/09/16 keides2 v0.0.2 図の差し替え
- 2023/09/17 keides2 v0.0.3 拡張機能マーケットプレース対応
- 2023/09/20 keides2 v0.1.0 webpack 対応。英文追加
- 2023/10/07 keides2 v0.2.0 3文字以上の大文字検出をやめる
- 2023/10/10 keides2 v0.3.0 影響度「高」、「中」、「低」に対応し、波線の色と診断結果のレベルとアイコンを変える
- 2023/10/13 keides2 v0.3.1 CSVファイル読み込み時の制約を追加(書式が snapshot_id_xxxx.csv でないファイルを読み込まない)
- 2023/10/18 keides2 v0.3.2 入力ボックスの戻り値の型が、 undefined の時にエラーを出力する(エラーダイアログは出さない) フォーカスを移動すると入力ボックスが消えてしまうので、「フォーカスがエディタの他の部分や他のウィンドウに移動しても、入力ボックスを開いたままにする」(ユーザビリティ向上)
- 2023/11/06 keides2 v0.3.3 CSVファイルの値がコンマを含む場合に対応
- 2023/11/14 keides2 v0.4.0 指摘項目「ローカル効果」と「説明」を追加表示















