Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`A8-5-2`: Create query to cover `auto` case

Aperta
#463 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@nicolaswill ci sta già lavorando.

Dal 12/7/2024.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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

The rule A8-5-2 (use braced initialization) conflicts with rule A8-5-3 (A variable of type auto shall not be initialized using {} or ={} braced-initialization). This is because C++14 will deduce auto x2{10}; as std::initializer_list, which is usually not what the developer intended. This behaviour is changed in C++17, and in practice many compilers also address it in C++14 mode.

In order to use auto in a codebase and remain compliant to AUTOSAR a deviation is required either on A8-5-3, to allow braced initialization for auto variables where the compiler supports this, or for A8-5-2, to permit the use of = initialization with auto.

In the latter case we want to be able to deviate only on those cases which are declared as auto. To facilitate that we will split the rule between the auto and not auto. Currently, our query only supports the "non-auto" case.

Example
auto v = init();
Lingua principale
CodeQL
Stelle
227
Fork
82
Merge medio
6g 7h
PR unite (30g)
9

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/codeql-coding-standards

Tutte le issue di github/codeql-coding-standards

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.