Adding doc
This commit is contained in:
@ -19,6 +19,18 @@ those can be specified with the `-property` / `-P` option on the command-line.
|
||||
|
||||
{% include note.html content="Suppressed violations are only reported, if the CLI parameter `-showsuppressed` is set." %}
|
||||
|
||||
## SARIF
|
||||
|
||||
"SARIF, the Static Analysis Results Interchange Format, is a standard, JSON-based format for the output of static
|
||||
analysis tools. It has been approved as an OASIS standard" - <https://docs.oasis-open.org/sarif/sarif/v2.0/sarif-v2.0.html>.
|
||||
|
||||
SARIF schema can be found here: <https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json>.
|
||||
|
||||
PMD holds an initial implementation version of SARIF rendering. This means SARIF allows for more complexity and the
|
||||
current implementation can be extended.
|
||||
|
||||
[Example](report-examples/pmd-report.sarif.json)
|
||||
|
||||
## codeclimate
|
||||
|
||||
Renderer for Code Climate JSON format.
|
||||
|
137
docs/report-examples/pmd-report.sarif.json
Normal file
137
docs/report-examples/pmd-report.sarif.json
Normal file
@ -0,0 +1,137 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "PMD",
|
||||
"version": "<pmd-version>",
|
||||
"informationUri": "https://pmd.github.io/pmd/",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ApexSharingViolations",
|
||||
"shortDescription": {
|
||||
"text": "Apex classes should declare a sharing model if DML or SOQL/SOSL is used"
|
||||
},
|
||||
"helpUri": "https://pmd.github.io/pmd/pmd_rules_apex_security.html#apexsharingviolations",
|
||||
"properties": {
|
||||
"ruleset": "Security",
|
||||
"priority": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ApexDoc",
|
||||
"shortDescription": {
|
||||
"text": "Missing ApexDoc comment"
|
||||
},
|
||||
"helpUri": "https://pmd.github.io/pmd/pmd_rules_apex_documentation.html#apexdoc",
|
||||
"properties": {
|
||||
"ruleset": "Documentation",
|
||||
"priority": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "ApexSharingViolations",
|
||||
"ruleIndex": 0,
|
||||
"message": {
|
||||
"text": "Apex classes should declare a sharing model if DML or SOQL/SOSL is used"
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/user/pmd/unhappy-soup/force-app/main/default/classes/ApexSOQLInjection.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 1,
|
||||
"endColumn": 30
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/user/pmd/unhappy-soup/force-app/main/default/classes/ApexSharingViolations.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 1,
|
||||
"endColumn": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ruleId": "ApexDoc",
|
||||
"ruleIndex": 1,
|
||||
"message": {
|
||||
"text": "Missing ApexDoc comment"
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/user/pmd/unhappy-soup/force-app/main/default/classes/ApexSOQLInjection.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 6,
|
||||
"endColumn": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/user/pmd/unhappy-soup/force-app/main/default/classes/ApexSOQLInjection.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 3,
|
||||
"startColumn": 17,
|
||||
"endLine": 5,
|
||||
"endColumn": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/user/pmd/unhappy-soup/force-app/main/default/classes/ApexSharingViolations.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 6,
|
||||
"endColumn": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/user/pmd/unhappy-soup/force-app/main/default/classes/ApexSharingViolations.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 3,
|
||||
"startColumn": 14,
|
||||
"endLine": 5,
|
||||
"endColumn": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
137
sarif-output-example.sarif.json
Normal file
137
sarif-output-example.sarif.json
Normal file
@ -0,0 +1,137 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
||||
"version": "2.1.0",
|
||||
"runs": [
|
||||
{
|
||||
"tool": {
|
||||
"driver": {
|
||||
"name": "PMD",
|
||||
"version": "6.31.0-SNAPSHOT",
|
||||
"informationUri": "https://pmd.github.io/pmd/",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ApexSharingViolations",
|
||||
"shortDescription": {
|
||||
"text": "Apex classes should declare a sharing model if DML or SOQL/SOSL is used"
|
||||
},
|
||||
"helpUri": "https://pmd.github.io/pmd/pmd_rules_apex_security.html#apexsharingviolations",
|
||||
"properties": {
|
||||
"ruleset": "Security",
|
||||
"priority": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ApexDoc",
|
||||
"shortDescription": {
|
||||
"text": "Missing ApexDoc comment"
|
||||
},
|
||||
"helpUri": "https://pmd.github.io/pmd/pmd_rules_apex_documentation.html#apexdoc",
|
||||
"properties": {
|
||||
"ruleset": "Documentation",
|
||||
"priority": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "ApexSharingViolations",
|
||||
"ruleIndex": 0,
|
||||
"message": {
|
||||
"text": "Apex classes should declare a sharing model if DML or SOQL/SOSL is used"
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/manuelmoyaferrer/devel/pmd-copado/unhappy-soup/force-app/main/default/classes/ApexSOQLInjection.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 1,
|
||||
"endColumn": 30
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/manuelmoyaferrer/devel/pmd-copado/unhappy-soup/force-app/main/default/classes/ApexSharingViolations.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 1,
|
||||
"endColumn": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ruleId": "ApexDoc",
|
||||
"ruleIndex": 1,
|
||||
"message": {
|
||||
"text": "Missing ApexDoc comment"
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/manuelmoyaferrer/devel/pmd-copado/unhappy-soup/force-app/main/default/classes/ApexSOQLInjection.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 6,
|
||||
"endColumn": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/manuelmoyaferrer/devel/pmd-copado/unhappy-soup/force-app/main/default/classes/ApexSOQLInjection.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 3,
|
||||
"startColumn": 17,
|
||||
"endLine": 5,
|
||||
"endColumn": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/manuelmoyaferrer/devel/pmd-copado/unhappy-soup/force-app/main/default/classes/ApexSharingViolations.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 1,
|
||||
"startColumn": 14,
|
||||
"endLine": 6,
|
||||
"endColumn": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
"uri": "/Users/manuelmoyaferrer/devel/pmd-copado/unhappy-soup/force-app/main/default/classes/ApexSharingViolations.cls"
|
||||
},
|
||||
"region": {
|
||||
"startLine": 3,
|
||||
"startColumn": 14,
|
||||
"endLine": 5,
|
||||
"endColumn": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user