レポートの構造 Qodana によって生成されるレポートの構造は次のとおりです。
{
"version": "2.1.0",
"runs": [
{
"tool": {...},
"invocations": [...],
"language": "en-US",
"versionControlProvenance": [...],
"results": [...],
"automationDetails": {...},
"newlineSequences": [...],
"properties": {...}
}
]
}
各レポートは、単一の Qodana run
(英語) を含む runs
配列によって表されます。このオブジェクトには、次のような複数のネストされたオブジェクトが含まれています。
カスタム Qodana プロパティは次のとおりです。
プロパティ
説明
configProfile
インスペクションプロファイルがどのように発見されたか。empty
、starter
、recommended
、path
、single
、absent
、other
のいずれか。
deviceId
匿名統計に使用されるトラッキング ID。
tool
(英語) オブジェクトは、Qodana リンター 、バンドルされたプラグイン、利用可能なインスペクションを記述します。
{
"tool": {
"driver": {...},
"extensions": [...]
}
}
tool
オブジェクトには、次の 2 つのネストされたオブジェクトが含まれています。
ドライバーオブジェクト このオブジェクトには、呼び出された Qodana リンター に関する情報が含まれています。
{
"driver": {
"name": "QDPHP",
"fullName": "Qodana for PHP",
"version": "222.4190.104",
"rules": [],
"taxa": [
{
"id": "EditorConfig",
"name": "EditorConfig"
},
{
"id": "PHP",
"name": "PHP"
},
{
"id": "PHP/Php Inspections (EA Extended)",
"name": "Php Inspections (EA Extended)",
"relationships": [
{
"target": {
"id": "PHP",
"index": 1,
"toolComponent": {
"name": "QDPHP"
}
},
"kinds": [
"superset"
]
}
]
}
]
}
}
オブジェクトは次のフィールドで構成されます。
フィールド
説明
name
Qodana リンターの ID
fullName
Qodana リンターの正式名
version
Qodana リンターのバージョン
rules
reportingDescriptor
(英語) オブジェクトとして使用可能なインスペクションの説明
taxa
インスペクションのカテゴリ (カテゴリ間の関係を含む)
拡張オブジェクト extensions
配列の各要素は 1 つの IntelliJ IDEA プラグインに対応し、プラグインの名前とバージョン、プラグインによって提供されるインスペクションに関する情報を提供します。
{
"extensions": [
{
"name": "org.editorconfig.editorconfigjetbrains",
"version": "222.4190",
"rules": [
{
"id": "EditorConfigCharClassRedundancy",
"shortDescription": {
"text": "Unnecessary character class"
},
"fullDescription": {
"text": "Reports character classes that consist of a single character. Such classes can be simplified to a character, for example '[a]'→'a'.",
"markdown": "Reports character classes that consist of a single character. Such classes can be simplified to a character, for example `[a]`→`a`."
},
"defaultConfiguration": {
"enabled": true,
"level": "warning",
"parameters": {
"ideaSeverity": "WARNING",
"tags": [
"ideaSeverity"
]
}
},
"relationships": [
{
"target": {
"id": "EditorConfig",
"index": 0,
"toolComponent": {
"name": "QDPHP"
}
},
"kinds": [
"superset"
]
}
]
}
],
"language": "en-US",
"contents": [
"localizedData",
"nonLocalizedData"
]
}
]
}
このオブジェクトには次のフィールドが含まれます。
フィールド
説明
name
Qodana プラグインの ID
version
Qodana プラグインのバージョン
rules
プラグインによって提供されるインスペクション
プラグインの各インスペクションは、次のフィールドを持つ reportingDescriptor
(英語) によって記述されます。
フィールド
説明
id
インスペクション ID
shortDescription
インスペクションの簡単な説明
fullDescription
インスペクションの詳細説明
defaultConfiguration
reportingConfiguration
(英語) オブジェクトには、インスペクションに関する詳細情報 (重大度レベルやインスペクションが有効かどうかの説明など) が含まれます。
relationships
インスペクションと他のインスペクションの関係、詳細については taxa
を参照してください。
呼び出し invocations
配列には、Qodana invocation
(英語) を記述する 1 つの要素が含まれており、Qodana が正常に実行されたかどうかを示します。
{
"invocations": [
{
"exitCode": 0,
"toolExecutionNotifications": [
{
"message": {
"text": "Reporting from [\"Java annotator\"] 'sanity' inspections was suspended due to high problems count."
},
"level": "error"
}
],
"executionSuccessful": true
}
]
}
上記の例では、Qodana の実行は成功しました (exitCode
、executionSuccessful
)。(技術的に) 実行は成功したにもかかわらず、Qodana は、その正常なインスペクションがいくつかの問題 (message
、level=error
) を発見したと報告しました。「健全性」インスペクションが失敗した場合、これは通常、プロジェクト構成が壊れたことを意味します。
exitCode
に指定できる値は次のとおりです。
値
説明
0
実行成功
1
内部エラー
137
メモリ不足のため、Qodana の Docker コンテナーには少なくとも 6 GB の RAM が必要です
255
fail-threshold
プロパティ値を超えたため、正常に実行され終了しました。
invocations
オブジェクトの他のフィールドの説明は次のとおりです。
toolExecutionNotifications
フィールドには、Qodana の実行中に生成される通知 ( しきい値 に達したなど) が含まれます。
リンタープロセスが正常に終了すると、results
フォルダーにはレポートファイルが含まれ、プロセス終了コードはレポート内の exitCode
値と等しくなります。
プロセスが異常終了した場合、results
フォルダーにはレポートファイルが含まれる場合と含まれない場合があります。このような場合の一般的な終了コードは 137
(メモリ不足による SIGKILL) です。
バージョン制御来歴 versionControlProvenance
配列は、プロジェクトコードのチェックアウト元のバージョン管理システムを記述します。各バージョン管理システムは、 versionControlDetails
(英語) オブジェクトによって記述されます。プロジェクトがバージョン管理システムを使用していない場合、versionControlProvenance
全体が存在しません。
{
"versionControlProvenance": [
{
"repositoryUri": "https://github.com/example/example.git",
"revisionId": "6c034f977505b058c7cf764b3d9b1abd068a725e",
"branch": "master",
"properties": {
"repoUrl": "https://github.com/example/example.git",
"lastAuthorName": "Jane Doe",
"vcsType": "Git",
"lastAuthorEmail": "mail@example.com",
"tags": [
"repoUrl",
"lastAuthorEmail",
"lastAuthorName",
"vcsType"
]
}
}
]
}
各 versionControlDetails
オブジェクトには次のフィールドが含まれます。
フィールド
説明
repositoryUri
リポジトリのチェックアウト URL
revisionId
最新のコミットハッシュ
branch
リポジトリブランチ
properties
追加のプロパティについては、以下を参照してください
追加のプロパティはプロパティバッグ(英語) として保存され、最後のコミットの作成者に関する情報が含まれます。vcsType
プロパティの値は常に Git
です。
結果 results
配列は、インスペクション中に検出された問題を記述します。Qodana によって検出された各問題は、個別の result
(英語) オブジェクトによって記述されます。
{
"results": [
{
"ruleId": "InfiniteRecursion",
"kind": "fail",
"level": "warning",
"message": {
"text": "Method <code>visitTypeVariable()</code> recurses infinitely, and can only end by throwing an exception"
},
"locations": [
...
],
"partialFingerprints": {
"equalIndicator/v1": "ac5714b0b15b7e8c4311899afd1c2b44069865039f2a9d309dcab04eddd4681d"
},
"baselineState": "unchanged",
"properties": {
"ideaSeverity": "WARNING",
"tags": [
"ideaSeverity"
]
}
}
]
}
各 result
オブジェクトは次のフィールドで構成されます。
フィールド
説明
ruleId
一意のインスペクション ID (inspectionId
)
kind
常に fail
値を受け取ります
level
SARIF 重大度レベル
message
IntelliJ IDEA メッセージ文字列の形式で結果 / 問題の説明を含むネストされた text
フィールドを持つ message
(英語) オブジェクト
locations
location
(英語) オブジェクトの配列。 physicalLocation
オブジェクトと logicalLocations
オブジェクトで構成される単一の要素が常に含まれます
partialFingerprints
異なる実行間の結果を比較するためのハッシュが含まれます。ベースライン 機能によって使用されます
baselineState
リンターがベースラインモードで実行されたかどうかを示し、次の値を受け入れることができます。
new
は、問題が現在の実行でのみ検出され、ベースラインの実行では検出されなかったことを示します
absent
は、問題がベースライン実行でのみ検出され、現在の実行では検出されなかったことを示します
unchanged
は、現在の実行とベースライン実行の両方で問題が検出されたことを示します
properties
元の IntelliJ IDEA インスペクション重大度を値として持つ ideaSeverity
フィールドを含む propertyBag
位置オブジェクト 各 location
(英語) オブジェクトは、ファイル内の具体的な物理的な場所を記述し、高レベルの論理的な場所によって拡張されます。
{
"physicalLocation": {
"artifactLocation": {
"uri": "asm-util/src/main/java/org/objectweb/asm/util/CheckSignatureAdapter.java",
"uriBaseId": "SRCROOT"
},
"region": {
"startLine": 259,
"startColumn": 14,
"charLength": 17,
"snippet": {
"text": "visitTypeVariable"
},
"sourceLanguage": "JAVA"
},
"contextRegion": {
"startLine": 257,
"startColumn": 1,
"charOffset": 9764,
"charLength": 152,
"snippet": {
"text": "\n @Override\n public void visitTypeVariable(final String name) {\n visitTypeVariable(name);\n if (type != TYPE_SIGNATURE || state != State.EMPTY) {"
}
}
},
"logicalLocations": [
{
"fullyQualifiedName": "root.asm-util.main",
"kind": "module"
}
]
}
PhysicalLocation オブジェクト
{
"physicalLocation": {
"artifactLocation": {
"uri": "asm-util/src/main/java/org/objectweb/asm/util/CheckSignatureAdapter.java",
"uriBaseId": "SRCROOT"
},
"region": {
"startLine": 259,
"startColumn": 14,
"charLength": 17,
"snippet": {
"text": "visitTypeVariable"
},
"sourceLanguage": "JAVA"
},
"contextRegion": {
"startLine": 257,
"startColumn": 1,
"charOffset": 9764,
"charLength": 152,
"snippet": {
"text": "\n @Override\n public void visitTypeVariable(final String name) {\n visitTypeVariable(name);\n if (type != TYPE_SIGNATURE || state != State.EMPTY) {"
}
}
}
}
physicalLocation
オブジェクトには次のフィールドが含まれます。
フィールド
説明
artifactLocation
次のフィールドを含む artifactLocation
(英語) オブジェクト:
region
問題の場所とハイライトする必要があるスニペットに関する情報が含まれます。詳細については、以下のセクション を参照してください
contextRegion
region
フィールドのスニペットを囲むテキストに関する情報が含まれます。このフィールドは、ベースライン モードで問題を比較するために使用されます。
領域オブジェクト
{
"region": {
"startLine": 72,
"startColumn": 23,
"charOffset": 1852,
"charLength": 11,
"snippet": {
"text": "options.php"
},
"sourceLanguage": "HTML"
}
}
region
(英語) オブジェクトには次のフィールドが含まれます。
フィールド
説明
startLine
領域内の最初の文字の行番号。1 から始まる
startColumn
領域内の最初の文字の列番号。1 から始まり、UTF-16 コード単位で測定されます。
charOffset
ファイルの先頭と領域の先頭の間の UTF-16 コード単位の数
charLength
UTF-16 コード単位で測定された領域の長さ
snippet
指定された領域のテキストと等しい値を持つ text
フィールドを含む artifactContent
(英語) オブジェクト
sourceLanguage
インスペクションされたスニペットのプログラミング言語。Qodana のユーザーインターフェースでのハイライトに使用されます
logicalLocations オブジェクト
{
"logicalLocations": [
{
"fullyQualifiedName": "root.asm-util.main",
"kind": "module"
}
]
}
logicalLocations
オブジェクトには次のフィールドが含まれます。
フィールド
説明
kind
常に module
値を受け取ります
fullyQualifiedName
プロジェクトビルドシステムから取得したモジュール名
自動化の詳細 runAutomationDetails
(英語) オブジェクトは、 run
オブジェクトの詳細を提供します。
{
"automationDetails": {
"id": "project/qodana/2022-09-12",
"guid": "bc9770e3-0cf4-4e46-a8fd-455e5bf116a2",
"properties": {
"jobUrl": "https://build.example.org/job/12345678",
"tags": [
"jobUrl"
]
}
}
}
automationDetails
オブジェクトには次のフィールドが含まれます。
フィールド
説明
id
ユーザーが読み取り可能な文字列、レポートごとに一意
guid
機械可読な一意のレポート ID
properties
実行に関する追加情報 (Qodana の場合) には、レポートを生成した CI/CD ビルドの URL が含まれます。
改行シーケンス newlineSequences
(英語) 配列には一意の文字列が含まれており、各文字列は Qodana が実行中に改行として扱う文字シーケンスを指定します。
{
"newlineSequences": [
"\r\n",
"\n"
]
}
プロパティ インスペクションプロファイルで構成されたインスペクションに加えて、Qodana はプロジェクト構成の健全性チェックのためにいくつかの追加のインスペクションを実行します。これらの追加のインスペクションで問題が見つかった場合は、プロジェクトの構成が間違っている可能性があります。これらの追加のインスペクションの結果は、通常の result
オブジェクトと同じ形式で qodana.sanity.results
プロパティに記録されます。
{
"properties": {
"qodana.sanity.results": [
{
"ruleId": "JavaAnnotator",
"kind": "fail",
"level": "error",
"message": {
"text": "Variable 'points' might not have been initialized",
"markdown": "Variable 'points' might not have been initialized"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java",
"uriBaseId": "SRCROOT"
},
"region": {
"startLine": 52,
"startColumn": 41,
"charOffset": 1772,
"charLength": 6,
"snippet": {
"text": "points"
},
"sourceLanguage": "JAVA"
},
"contextRegion": {
"startLine": 50,
"startColumn": 1,
"charOffset": 1670,
"charLength": 180,
"snippet": {
"text": " ResultPoint[] cornerPoints = rectangleDetector.detect();\n\n ResultPoint[] points = detectSolid2(points);\n points[3] = correctTopRight(points);\n if (points[3] == null) {"
}
}
},
"logicalLocations": [
{
"fullyQualifiedName": "core",
"kind": "module"
}
]
}
],
"partialFingerprints": {
"equalIndicator/v1": "2bf8eae4ff0d22f23008fe342fb1cfc67aa4f6db9b276e16ba621c77e3fda618"
},
"properties": {
"ideaSeverity": "ERROR"
}
}
]
}
}