github / github/codeql

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

Aperta
#15,028 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.