`A8-5-2`: Reports a violation even for correctly initialized variables as per the rule

オープン
#645 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp
領域
devtools

調査の方向性

ルール A8-5-2 を実装している CodeQL クエリから始め、報告された C++ の例を再現します。初期化の周囲の空白を検査するヒューリスティックを追跡し、a、ret、bbb などの波括弧で正しく初期化された変数が報告されなくなる一方で、実際の違反は引き続き検出されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

Difficulty-Low false positive/false negative Impact-Medium Standard-AUTOSAR user-report
Affected rules
  • A8-5-2
Description

This rule reports violation for the following code (which is correct as per the rule).

Example
void example_function() {
  const int32_t a {array[i]};
  int32_t ret {0};
  myclass01 bbb {6};
}

The reason seems to be the limitation mentioned in the query that CodeQL doesn't store this syntactic information about the form of initialization in the database. The heuristic implemented in the query to check for the violation doesn't work for the above code snippet because of the presence of a whitespace between the variable name and the initialization.

主要言語
CodeQL
スター
227
フォーク
82
平均マージ
6日 7時間
マージ済み PR(30日)
9

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/codeql-coding-standards のほかの issue

github/codeql-coding-standards の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。