GithubHelp home page GithubHelp logo

cov_lint's Introduction

COVLint (in English)

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).

  • Coverity Connect Source Code Screen issue_Cov

  • COVLint Source Code Screen issue_VSC

  • COVLint Source Code Screen (Multiple Highlights) issue_vSC_3cids

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.

Procedure

1. Installing the COVLint Extension

There are two ways to install COVLint: from a VSIX package file or from the VSCode Extension Marketplace.

  • Select extensions from the activity bar activity_extension

1.1 Installation from VSIX Package File

  • From the three-dot menu, select "Install from VSIX" install_from_vsix

  • Install the file covlint-X.Y.Z.vsix vsix_dialog

  • Installation is complete vsix_installed

  • COVLint Extension covlint_extension

1.2 Installation from VSCode Extension Marketplace

  • Enter covlint in the search box and click "Install" 1_6_install_from_extension

  • Installation is complete 1_7_install_completed

2. Loading the CSV File

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) 1_select_csvfile

  • From the menu, select "Copy Path" 2_copy_path

  • Press Ctrl + Shift + p to open the command palette and select COVLint: open CSV file 3_command_palette

  • Paste the path of the copied snapshot CSV file into the input box 4_input_csvfilepath

  • Message when no input is made no_csvfile

  • Message when loading is successful 5_file_opened

  • If loading fails, please retry file_doesnt_exist

3. Displaying Annotations

  • Move the folder and select the source code you are developing 6_targetfile_open

  • Lines with issues in the source code are underlined, so hover over them

    • Annotations will be displayed in a popup
    • A list of annotations will be displayed in the problem panel
    • Clicking on an issue will jump to the corresponding line 7_hover

Notes

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".

COVLint (in Japanese)

Coverity Connectサーバーの特長の一つである問題のある行に指摘が付いたソースコード画面をVisual Studio Code上に実現しました。Language Server Protocol(言語サーバー)を利用していますので、言語サーバーの機能があるAtomVimEmacsなどのエディターで動作します(と言われていますが未確認です)。

  • Coverity Connect ソースコード画面 issue_Cov

  • COVLint ソースコード画面 issue_VSC

  • COVLint ソースコード画面(指摘を複数表示) issue_vSC_3cids

COVLintは、Coverityが解析したソースコードの指摘結果を Visual Studio Code に表示します。 指摘結果は、スクリプトcov_snapが取得したCSVファイルから読み込みます。 cov_snapは、Coverity Connect サーバーに登録されているソースコードの指摘内容を取得するスクリプトです。

実施手順

1. COVLint拡張機能のインストール

COVLintは、VSIXパッケージファイルからインストールする方法と、VSCode拡張機能マーケットプレースからインストールする方法があります。

  • アクティビティーバーから拡張機能を選択します activity_extension

1.1 VSIXパッケージファイルからのインストール

  • 3点メニューから「VSIXからインストール」を選択します install_from_vsix

  • ファイル「covlint-X.Y.Z.vsix」をインストールします vsix_dialog

  • インストール完了です vsix_installed

  • 拡張機能 COVLint covlint_extension

1.2 VSCode拡張機能マーケットプレースからのインストール

  • 検索窓にcovlintを入力し、「インストール」を押下げます 1_6_install_from_extension

  • インストール完了です 1_7_install_completed

2. CSVファイルの読み込み

cov_snapで取得したスナップショットCSVファイルを読み込みます

  • VSCodeのエクスプローラーからスナップショットを保存しているフォルダに移動し、読み込みむスナップショットを右クリックで選択します(左クリックでファイルの中身を表示する必要はありません) 1_select_csvfile

  • メニューから「パスのコピー」を選択します 2_copy_path

  • Ctrl + Shift + pを押してコマンドパレットを開き、COVLint: open CSV fileを選択します 3_command_palette

  • 入力ボックスにコピーしたスナップショットCSVファイルのパスを貼り付けます 4_input_csvfilepath

  • 何も入力しなかったときのメッセージです no_csvfile

  • 読み込みに成功したときのメッセージです 5_file_opened

  • 読み込みに失敗したときはリトライしてください file_doesnt_exist

3. 指摘の表示

  • フォルダを移動して開発中のソースコードを選択します 6_targetfile_open

  • ソースコードの問題のある行に波線が入っているのでマウスオーバーします

    • 指摘がポップアップ表示されます
    • 問題パネルに指摘の一覧が表示されます
    • 問題を左クリックすると該当行にジャンプします 7_hover

備考

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 指摘項目「ローカル効果」と「説明」を追加表示

cov_lint's People

Contributors

keides2 avatar peccu avatar dk-shimatani avatar

Watchers

 avatar

Forkers

peccu

cov_lint's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.