CppDepend で AUTOSAR C++ ガイドライン コンプライアンスを達成
CppDepend で AUTOSAR C++ ガイドライン コンプライアンスを達成
自動車ソフトウェアプロジェクトで Autosar C++ 2014 コンプライアンスの維持に苦労していませんか?もう探す必要はありません。CppDepend が、コード分析プロセスを合理化し、厳格な Autosar C++ ガイドラインへの準拠を確実にします。この記事では、CppDepend がコンプライアンスチェックを自動化し、コード品質を向上させ、自動車ソフトウェアの市場投入までの時間を短縮する方法を探ります。手動のコードレビューに別れを告げ、CppDepend の力を活用してシームレスな Autosar C++ コンプライアンスを実現しましょう。
AUTOSAR C++ 2014 標準について学ぶには、次を印刷できます Guidelines for the use of the C++14 language in critical and safety-related systems PDF AUTOSARによる。
CppDependでのAUTOSAR C++ 2014ルールの使用
新しい CppDepend プロジェクトを作成すると、分析に含めたいすべてのコーディング標準を表示するポップアップが表示されます。Autosar コーディング標準を含めるには、Autosar C++ 2014 オプションをチェックします。
プロジェクトを分析した後、Queries and Rules Explorer セクションに移動し、左側のメニューから Autosar C++ 2014 Rules を選択します(下の画像で赤く強調表示)。これにより、関連するすべての Autosar C++ 2014 ルールが右側に表示されます。ルールをクリックすると、対応する CQLinq クエリと関連するソースコードが自動的に生成されます。さらに、Metrics View セクションでは、問題の場所と重要性のビジュアライゼーションが提供されます。
AUTOSAR ルールの HTML レポートへの組み込み
生成された HTML レポート(DevOps Edition で利用可能)に Autosar ルールを含めるには、Autosar C++ 2014 グループを右クリックして「List Code Queries of this Group in a dedicated section in Report」を選択するだけです。
AUTOSAR C++ 2014ルール一覧
不要な構文
Rule M0–1–1: A project shall not contains unreachable code:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Misra" && issue.Type=="Rule0-1-7" select
new { issue,issue.FilePath,Line=issue.BeginLine}ルールM0-1-9: デッドコードがあってはならない:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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–2–1: An object shall not be assigned to an overlapping object:
このコーディング標準は次のクエリで計算されます:
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}算術
Rule A0-4-2: Type long double shall not be used:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Misra" && issue.Type=="Rule0-1-7" select
new { issue,issue.FilePath,Line=issue.BeginLine}字句規則
ルールA2–5–1: トライグラフは使用してはならない:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.ToolName=="Clang" && issue.Type=="trigraph_ignored" select
new { issue,issue.FilePath,Line=issue.BeginLine}ルールA2-6-1: ダイグラフは使用してはならない:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule2-13-4" select
new { issue,issue.FilePath,Line=issue.BeginLine}ルールA2-14-3: 型wchar\_tは使用してはならない:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule2-13-4" select
new { issue,issue.FilePath,Line=issue.BeginLine}基本概念
Rule A3–1–1: It shall be possible to include any header file in multiple translationunits without violating the one definition rule:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule3-9-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}標準変換
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:
このコーディング標準は次のクエリで計算されます:
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\<,\<=,\>,\>=:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule4-10-2"
select new { issue,issue.FilePath,Line=issue.BeginLine}式
Rule A5–0–1:The value of an expression shall be the same under any order of evaluation that the standard permits:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName== "operator&"
select mRule M5–3–4: Evaluation of the operand to the sizeof operator shall not contain side effects:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule5-18-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}ルールA5-2-1: dynamic\_castは使用すべきでない:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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 M6–2–1: Assignement operators shall not be used in sub-expressions:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule6-4-8"
select new { issue,issue.FilePath,Line=issue.BeginLine}宣言
Rule A7-1-4: The register keyword shall not be used:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select mRule M7-3-1: The global namespace shall only contain main, namespace declarations and extern "C" declarations:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select mRule M7–3–2: The identifier main shall not be used for a function other than the global function main:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select mRule M7–3–3: There shall be no unnamed namespaces in header files:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select mRule M7–4–3: Assembly language shall be encapsulated and isolated:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select mRule A7–5–1: A function shall not return a reference or a pointer to an automatic variable(including parameters), defined within the function:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select mRule A7-1-6: The typedef specifier shall not be used:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName=="main" && m.ParentNamespace.Name!=""
select m宣言子
Rule A8–4–1: Functions shall not be defined using the ellipsis notation:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.IsVariadic
select mRule A8–4–2: All exit paths from a function with non-void return type shall have an explicit return statement with an expression:
このコーディング標準は次のクエリで計算されます:
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 &:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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}クラス
ルールM9–5–1: 共用体は使用してはならない:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from f in **JustMyCode**.Fields where !f.ParentType.IsPOD && f.IsPublic
select fRule 12–1–1: An object's dynamic type shall not be used from the body of its constructor or destructor:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where
&& (m.MethodsCalled.Where(vm=>vm.IsVirtual).Count()>**0** || m.IsUsing("Keywords.dynamic_cast".AllowNoMatch()))
select mRule 12–1–2: All constructors that are callable with a single argument of fundamental type shall be declared explicit:
このコーディング標準は次のクエリで計算されます:
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 mRule 12–8–2: The copy assignment operator shall be declared protected or private in an abstract class:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.SimpleName== "operator=="
&& m.ParentType.IsAbstract && m.IsPublic
select m例外
Rule 15–0–2: An exception object should not have pointer type:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from m in **JustMyCode**.Methods where m.IsEntryPoint
&& m.IsUsing("Keywords.generic_catch".AllowNoMatch()) select mRule 15–3–5: A class type exception shall always be caught by reference:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="exceptThrowInDestructor"
select new { issue,issue.FilePath,Line=issue.BeginLine}プリプロセッサ
ルール16–0–3: \#undefは使用してはならない:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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}ライブラリ
Rule 17–0–1: Reserved identifiers, macros and functions in the standard library shall not be defined, redefined or undefined:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule17-0-5"
select new { issue,issue.FilePath,Line=issue.BeginLine}ルール18–0–1: Cライブラリは使用してはならない:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
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:
このコーディング標準は次のクエリで計算されます:
warnif **count** > **0**
from issue in **ImportedIssues** where issue.Type=="Rule18-4-1"
select new { issue,issue.FilePath,Line=issue.BeginLine}