github / github/codeql

Improve `cpp/wrong-type-format-argument` by adding correct formatting specifier

未关闭
#15,028 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
CodeQL
星标
10.1k
派生
2.1k
平均合并
2 天 15 小时
30 天内合并 PR
141

描述

**Description of the issue**
Currently the `cpp/wrong-type-format-argument` diagnostic displays something like this

```
This argument should be of type 'int' but is of type 'unsigned long'.
```

It would be even more helpful if the diagnostic message would include the correct formatting specifier so it would look something like this:

```
This argument should be of type 'int' but is of type 'unsigned long'. Consider using '%ul' instead.
```

For reference [cppreference](https://en.cppreference.com/w/c/io/fprintf) has a great table about which specifier is needed for which type.

贡献指南

打开贡献指南

调研方向

Start by locating the implementation of the cpp/wrong-type-format-argument diagnostic; the issue does not name a file or test. Use the cppreference fprintf table to determine the expected specifier, then ensure the diagnostic message includes it for the reported type mismatch.

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
security
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。