`A8-5-2`: Create query to cover `auto` case
@nicolaswill y travaille déjà.
Depuis le 12/7/2024.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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();
- Langage dominant
- CodeQL
- Étoiles
- 227
- Forks
- 82
- Merge moyen
- 6 j 7 h
- PR mergées (30 j)
- 9
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Ouvertefalse positive/false negative
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
github/codeql-coding-standards#1175 ·