Accueil/Docs/Standards de codage/Atteignez la conformité aux directives Autosar C++ avec CppDepend

Atteignez la conformité aux directives Autosar C++ avec CppDepend

Atteignez la conformité aux directives Autosar C++ avec CppDepend

Vous avez du mal à maintenir la conformité Autosar C++ 2014 dans vos projets logiciels automobiles ? Ne cherchez plus. CppDepend est là pour rationaliser votre processus d'analyse de code et garantir le respect des directives strictes Autosar C++. Dans cet article, nous explorerons comment CppDepend automatise les vérifications de conformité, améliore la qualité du code et réduit le délai de mise sur le marché de vos logiciels automobiles. Dites adieu aux revues de code manuelles et adoptez la puissance de CppDepend pour atteindre une conformité Autosar C++ sans faille.

Pour découvrir les standards Autosar C++ 2014, vous pouvez imprimer Guidelines for the use of the C++14 language in critical and safety-related systems PDF par AUTOSAR.

Utiliser les règles AUTOSAR C++ 2014 dans CppDepend

Lorsque vous créez un nouveau projet CppDepend, une fenêtre contextuelle apparaît affichant tous les standards de codage que vous souhaitez inclure dans votre analyse. Pour inclure les standards de codage Autosar, cochez l'option Autosar C++ 2014.

Après avoir analysé votre projet, naviguez vers la section Queries and Rules Explorer et sélectionnez les règles Autosar C++ 2014 dans le menu de gauche (surligné en rouge dans l'image ci-dessous). Cela affichera toutes les règles Autosar C++ 2014 associées à droite. En cliquant sur une règle, la requête CQLinq correspondante et le code source pertinent seront automatiquement générés. De plus, la section Metrics View fournit une visualisation de l'emplacement et de l'importance du problème.

Intégration des règles Autosar dans le rapport HTML

Pour inclure les règles Autosar dans le rapport HTML généré (disponible dans la DevOps Edition), faites simplement un clic droit sur le groupe Autosar C++ 2014 et sélectionnez "List Code Queries of this Group in a dedicated section in Report".

Constructions inutiles

Rule M0–1–1 : A project shall not contains unreachable code:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_unreachable" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M0–1–2 : A project shall not contain infeasible paths:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="knownConditionTrueFalse" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M0–1–3 : A project shall not contains unused variables:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_unused_variable" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M0–1–4 : A project shall not contain non-volatile POD variable having only one use:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="unreadVariable" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M0–1–5 : A project shall not contains unused typedef declarations:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_unused_local_typedef" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A0-1-1 : A project shall not contain instances of non-volatile variables being given values that are not subsequently used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="unreadVariable" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A0-1-2 : The value returned by a function having a non-voidreturn type that is not an overloaded operator shall always be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Misra" && issue.Type=="Rule0-1-7" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Règle M0-1-9 : Il ne doit pas y avoir de code mort :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_unreachable" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M0–1–11 : There shall be no unused parameters in non virtual functions:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues**
where issue.ToolName=="Clang" && issue.Type=="warn_unused_parameter"
&& issue.RelatedMethod!=null && issue.RelatedMethod.IsVirtual
select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M0-1-12 : There shall be no unused parameters (named or unnamed) in the set of parameters for a virtual function and all the functions that override it :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues**
where issue.ToolName=="Clang" && issue.Type=="warn_unused_parameter"
&& issue.RelatedMethod!=null && !issue.RelatedMethod.IsVirtual
select  new { issue,issue.FilePath,Line=issue.BeginLine}

Stockage

Rule M0–2–1 : An object shall not be assigned to an overlapping object:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="cppcoreguidelines-pro-type-union-access" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Arithmétique

Rule A0-4-2 : Type long double shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Misra" && issue.Type=="Rule0-1-7" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Conventions lexicales

Règle A2–5–1 : Les trigraphes ne doivent pas être utilisés :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="trigraph_ignored" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Règle A2-6-1 : Les digraphes ne doivent pas être utilisés :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_cxx98_compat_less_colon_colon" select
new { issue,issue.FilePath,Line=issue.BeginLine}

RuleA2-11-1 : Identifiers declared in a inner scope shall not hide an ientifier declared in out of dcope:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_decl_shadow" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M2-10-6 : If an identifier refers to a type, it shall not also refer to an object or a function in the same scope:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="err_redefinition_different_kind" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A2-14-1 : Only those escape sequences that are defined in ISO/IEC 14882:2003 shall be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="ext_unknown_escape" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M2-13-3 : A U suffix shall be applied to all octal or hexadecimal integer literals of unsigned type:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="Rule2-13-3" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M2-13-4 : Literal suffixes shall be upper case:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="Rule2-13-4" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A2-8-1 : The character \\ shall not occur as a last character of a C++ comment:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="ext_multi_line_line_comment" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A2-14-2 : String literals with different encoding prefixes shall not be concatenated:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="Rule2-13-4" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Règle A2-14-3 : Le type wchar\_t ne doit pas être utilisé :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="Rule2-13-4" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A2-11-2 : A “using” name shall be a unique identifier within a namespace:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="Rule2-13-4" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Concepts de base

Rule A3–1–1 : It shall be possible to include any header file in multiple translationunits without violating the one definition rule:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.NbLinesOfCode>**0**
&& m.SourceDecls.First().SourceFile.FileNameExtension.StartsWith("h")
select new { m,IncludeFile=m.SourceDecls.First().SourceFile.FilePathString }

Rule M3–1–2 : Functions shall not be declared at block scope:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule3-1-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A3–1–4 : When an array is declared, its size shall either be stated explicitly or defined implicitily by initialization:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule3-1-3"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A3–3–1 : Functions with extern linkage shall be declared in a header file:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule3-3-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M3–3–2 : If a function has internal linkage then all re-declarations shall include the static storage class specifier:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule3-3-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M3–4–1 : An identifier declared to be an object or type shall be defined in a block that minimizes its visibility:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="variableScope"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A3–9–2 : typedefs that indicate size and signedness should be used in place of the basic numerical types:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule3-9-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Conversions standard

Rule M4–5–1 : Expressions with type bool shall not be used as operands to built-in operators other than the assignment operator \=, the logical operators &&, ||, \!,== and \!=, the unary & operator, and the conditional operator :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule4-5-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A4–5–1 : Expressions with type enum shall not be used as operands to built-in operators other than the subscript operator \[ \], the assignment operator \=, the equality operators \== and \!=, the unary & operator, and the relational operators\<,\<=,\>,\>= :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule4-5-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M4–5–3 : Expressions with type (plain) char and wchar\_t shall not be used as operands to built-in operators other than the assignment operator \=, the equality operators \== and \!=, the unary & operator :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule4-5-3"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M4–10–2 : Literal zero (0) shall not be used as the null-pointer-constant:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule4-10-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A4-10-1 : Only nullptr literal shall be used as the null-pointer-constant:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule4-10-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Expressions

Rule A5–0–1 : The value of an expression shall be the same under any order of evaluation that the standard permits:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_unsequence_mod_use" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–0–4 : An implicit integral conversion shall not change the signedness of the underlying type:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_impcast_integer_sign" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–0–5 : There shall be no implicit floating-integral conversions:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_impcast_float_integer" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–0–6 : An implicit integral or floating-point conversion shall not reduce the size of the underlying type:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_impcast_integer_precision" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5-0-7 : There shall be no explicit floating-integral conversions of a cvalue expression:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="bugprone-integer-division" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–0–9 : An explicit integral conversion shall not change the signedness of the underlying type of a cvalue expression:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_impcast_integer_sign" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–0–15 : Array indexing shall be the only form of pointer arithmetic:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="cppcoreguidelines-pro-bounds-pointer-arithmetic" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–0–18 : \>, \>=, \<, \<= shall not be applied to objects of pointer type, except where they point to the same array:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="comparePointers" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A5-1-2 : Variables shall not be implicitly captured in a lambda expression:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="cppcoreguidelines-pro-bounds-pointer-arithmetic" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–2–2 : A pointer to a virtual base class shall only be cast to a pointer to a derived class by means of dynamic\_cast:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="err_static_downcast_via_virtual" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A5–2–2 : C-style casts(other than void casts) and functional notation casts (other than explicit constructor calls) shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_old_style_cast" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–2–6 : A cast shall not convert a pointer to a function to any other pointer type, including a pointer to function type:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_cxx98_compat_cast_fn_obj" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–3–3 : The unary & operator shall not be overloaded:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName== "operator&"
select m

Rule M5–3–4 : Evaluation of the operand to the sizeof operator shall not contain side effects:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_side_effects_unevaluated_context_sizeof" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–8–1 : The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left hand operand :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule5-8-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–14–1 : The right hand operand of a logical && or || operator shall not contain side effects:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule5-14-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5–18–1 : The comma operator shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule5-18-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Règle A5-2-1 : dynamic\_cast ne devrait pas être utilisé :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="cppcoreguidelines-pro-bounds-pointer-arithmetic" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A5-2-3 : A cast shall not remove any const or volatile qualification from the type of a pointer or reference:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="cppcoreguidelines-pro-bounds-pointer-arithmetic" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A5-2-4 : reinterpret\_cast shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="cppcoreguidelines-pro-bounds-pointer-arithmetic" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A5-2-5 : An array shall not be accessed beyond its range:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang-Tidy" && issue.Type=="cppcoreguidelines-pro-bounds-pointer-arithmetic" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M5-2-11 : The comma operator, && operator and the || operator shall not be overloaded:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName== "operator&"
select m

\>Rule A5-3-1 : Evaluation of the operand to the typeid operator shall not contain side effects:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_unsequence_mod_use" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Instructions

Rule M6–2–1 : Assignement operators shall not be used in sub-expressions:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-2-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–2–2 : Floating-point expressions shall not be directly or indirectly tested for equality or inequality:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_floatingpoint_eq" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–2–3 : Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment, provided that the first character following the null statement is a white-space character :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-2-3"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–3–1 : The statement forming the body of a switch, while, do...while or for statement shall be a compound statement:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-3-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–4–1 : An if(condition) construct shall be followed by a compound statement. The else keyword shall be followed by either a compound statement, or another if statement :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–4–2 : All if ... elseif constructs shall be terminated with an else clause:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6-4-3 : A switch statement shall be a well-formed switch statement:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="warn_jump_out_of_scope" || issue.Type=="Rule6-6-2" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–4–4 : A switch-label shall only be used when the most closely-enclosing compound statement is the body of a switch statement:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-4"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–4–5 : An unconditional throw or break statement shall terminate every non-empty switch-clause:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_unannotated_fallthrough" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–4–6 : The final clause of a switch statement shall be the default-clause:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-6"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–4–7 : The condition of a switch statement shall not have bool type:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_bool_switch_condition" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A6-4-1 : A switch statement shall have at least two case-clauses, distinct from the default label:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-8"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A6-5-2 : A for loop shall contain a single loop-counter which shall not have floatingpoint type:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-8"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–6–1 : Any label referenced by a goto statement shall be declared in the same block, or in a block enclosing the goto statement:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_jump_out_of_scope" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M6–6–2 : The goto statement shall jump to a label declared later in the same function body:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="Rule6-6-2" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 6–6–5 : A function shall have a single point of exit at the end of the function:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where  issue.Type=="Rule6-6-5" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A6-6-1 : The goto statement shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-8"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Déclarations

Rule A7-1-4 : The register keyword shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m

Rule M7-3-1 : The global namespace shall only contain main, namespace declarations and extern "C" declarations:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m

Rule M7–3–2 : The identifier main shall not be used for a function other than the global function main:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m

Rule M7–3–3 : There shall be no unnamed namespaces in header files:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule7-3-3"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M7–3–4 : using-directives shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule7-3-4"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M7–4–2 : Assembler instructions shall only be introduced using the asm declaration:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m

Rule M7–4–3 : Assembly language shall be encapsulated and isolated:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m

Rule A7–5–1 : A function shall not return a reference or a pointer to an automatic variable(including parameters), defined within the function :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="returnAddressOfAutoVariable" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M7–5–2 : The address of an object with automatic storage shall not be assigned to another object that may persist after the first object has ceased to exist :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="deadpointer" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A7-5-2 : Functions should not call themselves, either directly or indirectly:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="CppCheck" && issue.Type=="deadpointer" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A7-2-1 : An expression with enumunderlying type shall only have values corresponding to the enumerators of the enumeration:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m

Rule A7-1-6 : The typedef specifier shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m

Déclarateurs

Rule A8–4–1 : Functions shall not be defined using the ellipsis notation:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.IsVariadic
select m

Rule A8–4–2 : All exit paths from a function with non-void return type shall have an explicit return statement with an expression:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_maybe_falloff_nonvoid_function" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M8–4–4 : A function identifier shall either be used to call the function or it shall be preceded by &:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_duplicate_enum_values" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M8–5–1 : All variables shall have a defined value before they are used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_uninit_var" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M8–5–2 : Braces shall be used to indicate and match the structure in the non-zero initialization of arrays and structures:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_missing_braces" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule M8–5–3 : In an enumerator list, the \= construct shall not be used to explicitly initialize members other than the first, unless all items are explicitly initialized :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_duplicate_enum_values" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Classes

Règle M9–5–1 : Les unions ne doivent pas être utilisées :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule9-5-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule A10–1–1 : Classes should not be derived from virtual bases:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule10-1-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 10–3–2 : Each overriding virtual function shall be declared with the virtual keyword:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule10-3-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 11–0–1 : Member data in non-POD class types shall be private:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from f in **JustMyCode**.Fields where !f.ParentType.IsPOD && f.IsPublic
select f

Rule 12–1–1 : An object's dynamic type shall not be used from the body of its constructor or destructor:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where
&& (m.MethodsCalled.Where(vm=>vm.IsVirtual).Count()>**0** || m.IsUsing("Keywords.dynamic_cast".AllowNoMatch()))
select m

Rule 12–1–2 : All constructors that are callable with a single argument of fundamental type shall be declared explicit:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.IsConstructor && m.Params.Count()==**1** && m.Params.First().ParamType!=null
&& m.Params.First().ParamType.Name=="int" && !m.IsExplicitConstructor
select m

Rule 12–8–2 : The copy assignment operator shall be declared protected or private in an abstract class:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName== "operator=="
&& m.ParentType.IsAbstract && m.IsPublic
select m

Exceptions

Rule 15–0–2 : An exception object should not have pointer type:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule15-0-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 15–3–2 : There should be at least one exception handler to catch all otherwise unhandled exceptions:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from m in **JustMyCode**.Methods where m.IsEntryPoint
&& m.IsUsing("Keywords.generic_catch".AllowNoMatch()) select m

Rule 15–3–5 : A class type exception shall always be caught by reference:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="catchExceptionByValue"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 15–3–7 : Where multiple handlers are provided in a single try-catch statement or function-try-block, any ellipsis (catch-all) handler shall occur last :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_exception_caught_by_earlier_handler" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 15–5–1 : A class destructor shall not exit with an exception:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="exceptThrowInDestructor"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Préprocesseur

Règle 16–0–3 : \#undef ne doit pas être utilisé :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_undef_used" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 16–0–7 : Undefined macro identifiers shall not be used in \#if or \#elif preprocessor directives, except as operands to the defined operator :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_pp_undef_identifier" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 16–3–1 : There shall be at most one occurrence of the \# or \#\# operators in a single macro definition:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_pp_hashhash_used" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 16–3–2 : The \# and \#\# operators should not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_pp_hash_used" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Bibliothèque

Rule 17–0–1 : Reserved identifiers, macros and functions in the standard library shall not be defined, redefined or undefined:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="warn_reserved_id_macro" select
new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 17–0–5 : The setjmp macro and the longjmp function shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule17-0-5"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Règle 18–0–1 : La bibliothèque C ne doit pas être utilisée :

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-0-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 18–0–2 : The library functions atof, atoi and atol from library cstdlib shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-0-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 18–0–3 : The library functions abort, exit, getenv and system from library cstdlib shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-0-3"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 18–0–4 : The time handling functions of library shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-0-4"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 18–0–5 : The unbounded functions of library cstring shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-0-5"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 18–2–1 : The macro offsetof shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-2-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 18–4–1 : Dynamic heap memory allocation shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-4-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 18–7–1 : The signal handling facilities of csignal shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-7-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 19–3–1 : The error indicator errno shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule19-3-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Rule 27–0–1 : The stream input/output library shall not be used:

Ce standard de codage est calculé avec la requête suivante :

warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-4-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}

Essayez CppDepend aujourd'hui

Commencez votre essai gratuit de 14 jours avec accès complet à toutes les fonctionnalités de documentation. Sans carte bancaire.