github / github/codeql

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

Offen
#15,028 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.