`A20-8-5`-`A20-8-6`: Cannot create a smart pointer with `nullptr` value
まだ誰も着手していません。
評価
調査の方向性
まず、ルール A20-8-5 と A20-8-6 の実装とテストを見つけ、次に unique_ptr と shared_ptr の nullptr の例で問題を再現します。これらの初期化をルールがどのように分類するかを確認します。nullptr の初期化で検出されなくなり、示されている make_unique と make_shared の要件が引き続きテストでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Affected rules
A20-8-5:cpp/autosar/make-unique-not-used-to-construct-object-owned-by-unique-ptr
Rule A20-8-5 (required, implementation, automated)
std::make_unique shall be used to construct objects owned by
std::unique_ptr.
A20-8-6:cpp/autosar/make-shared-not-used-to-construct-object-owned-by-shared-ptr
Rule A20-8-6 (required, implementation, automated)
std::make_shared shall be used to construct objects owned by
std::shared_ptr.
Description
A20-8-5 triggers when initializing an unique_ptr to nullptr.
A20-8-6 triggers when initializing an shared_ptr to nullptr.
Initializing a smart pointer with a nullptr value can be however necessary in some specific cases.
Example
std::unique_ptr<bool> uniquePtr{nullptr}; // Triggers A20-8-5
std::shared_ptr<bool> sharedPtr{nullptr}; // Triggers A20-8-6
- 主要言語
- CodeQL
- スター
- 227
- フォーク
- 82
- 平均マージ
- 6日 7時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql-coding-standards のほかの issue
-
false positive/false negative Stardard-MISRA-C++
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph オープンfalse positive/false negative
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
github/codeql-coding-standards#1175 ·
github/codeql-coding-standards の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
use-agent-os/agent-os#3314 ·
-
agentic-workflows
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
githubnext/rig#534 ·
-
documentation low-priority templates
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
jesseray718/openroot#87 ·
-
factory-active factory-automatic task-bug-reproduction-cannot-reproduce task-identify-harness-labels-done task-identify-issue-type-done
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ReedClanton/NixOS#41 ·