Skip to content

Commit d87ba9e

Browse files
committed
[PLUTO-1411] Add pmd test
1 parent a73af89 commit d87ba9e

File tree

1 file changed

+44
-51
lines changed

1 file changed

+44
-51
lines changed
+44-51
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,110 @@
11
{
22
"version": "2.1.0",
3-
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
3+
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
44
"runs": [
55
{
66
"tool": {
77
"driver": {
88
"name": "PMD",
99
"version": "6.55.0",
10+
"informationUri": "https://pmd.github.io/pmd/",
1011
"rules": [
1112
{
1213
"id": "UnusedPrivateField",
13-
"name": "UnusedPrivateField",
1414
"shortDescription": {
15-
"text": "Unused private field"
15+
"text": "Avoid unused private fields such as 'unusedField'."
1616
},
1717
"fullDescription": {
18-
"text": "Detects when a private field is declared and/or assigned a value, but never used."
18+
"text": "\nDetects when a private field is declared and/or assigned a value, but not used.\n\nSince PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the\nenclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking\nor e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis.\nPreviously these frameworks where explicitly allowed by listing their annotations in the property\n\"ignoredAnnotations\", but that turned out to be prone of false positive for any not explicitly considered framework.\n "
1919
},
20-
"helpUri": "https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedprivatefield"
20+
"helpUri": "https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#unusedprivatefield",
21+
"help": {
22+
"text": "\nDetects when a private field is declared and/or assigned a value, but not used.\n\nSince PMD 6.50.0 private fields are ignored, if the fields are annotated with any annotation or the\nenclosing class has any annotation. Annotations often enable a framework (such as dependency injection, mocking\nor e.g. Lombok) which use the fields by reflection or other means. This usage can't be detected by static code analysis.\nPreviously these frameworks where explicitly allowed by listing their annotations in the property\n\"ignoredAnnotations\", but that turned out to be prone of false positive for any not explicitly considered framework.\n "
23+
},
24+
"properties": {
25+
"ruleset": "Best Practices",
26+
"priority": 3,
27+
"tags": [
28+
"Best Practices"
29+
]
30+
}
2131
},
2232
{
2333
"id": "UnconditionalIfStatement",
24-
"name": "UnconditionalIfStatement",
2534
"shortDescription": {
26-
"text": "Unconditional if statement"
35+
"text": "Do not use if statements that are always true or always false"
2736
},
2837
"fullDescription": {
29-
"text": "Do not use 'if' statements that are always true or always false."
38+
"text": "\nDo not use \"if\" statements whose conditionals are always true or always false.\n "
3039
},
31-
"helpUri": "https://pmd.github.io/pmd-6.55.0/pmd_rules_java_errorprone.html#unconditionalifstatement"
32-
},
33-
{
34-
"id": "NullPointerException",
35-
"name": "NullPointerException",
36-
"shortDescription": {
37-
"text": "Null pointer exception"
40+
"helpUri": "https://pmd.github.io/pmd-6.55.0/pmd_rules_java_errorprone.html#unconditionalifstatement",
41+
"help": {
42+
"text": "\nDo not use \"if\" statements whose conditionals are always true or always false.\n "
3843
},
39-
"fullDescription": {
40-
"text": "Code can throw a NullPointerException."
41-
},
42-
"helpUri": "https://pmd.github.io/pmd-6.55.0/pmd_rules_java_errorprone.html#nullpointerexception"
44+
"properties": {
45+
"ruleset": "Error Prone",
46+
"priority": 3,
47+
"tags": [
48+
"Error Prone"
49+
]
50+
}
4351
}
4452
]
4553
}
4654
},
4755
"results": [
4856
{
4957
"ruleId": "UnusedPrivateField",
50-
"level": "warning",
58+
"ruleIndex": 0,
5159
"message": {
52-
"text": "The private field 'unusedField' is assigned but never used"
60+
"text": "Avoid unused private fields such as 'unusedField'."
5361
},
5462
"locations": [
5563
{
5664
"physicalLocation": {
5765
"artifactLocation": {
58-
"uri": "file:///Test.java"
66+
"uri": "/Users/yasmin/IdeaProjects/codacy-cli-v2/plugins/tools/pmd/test/src/Test.java"
5967
},
6068
"region": {
6169
"startLine": 2,
62-
"startColumn": 5,
70+
"startColumn": 20,
6371
"endLine": 2,
64-
"endColumn": 25
72+
"endColumn": 30
6573
}
6674
}
6775
}
6876
]
6977
},
7078
{
7179
"ruleId": "UnconditionalIfStatement",
72-
"level": "warning",
80+
"ruleIndex": 1,
7381
"message": {
74-
"text": "Do not use 'if' statements that are always true"
82+
"text": "Do not use if statements that are always true or always false"
7583
},
7684
"locations": [
7785
{
7886
"physicalLocation": {
7987
"artifactLocation": {
80-
"uri": "file:///Test.java"
88+
"uri": "/Users/yasmin/IdeaProjects/codacy-cli-v2/plugins/tools/pmd/test/src/Test.java"
8189
},
8290
"region": {
8391
"startLine": 5,
84-
"startColumn": 9,
92+
"startColumn": 13,
8593
"endLine": 5,
86-
"endColumn": 15
94+
"endColumn": 16
8795
}
8896
}
8997
}
9098
]
91-
},
99+
}
100+
],
101+
"invocations": [
92102
{
93-
"ruleId": "NullPointerException",
94-
"level": "warning",
95-
"message": {
96-
"text": "Potential null pointer dereference of str"
97-
},
98-
"locations": [
99-
{
100-
"physicalLocation": {
101-
"artifactLocation": {
102-
"uri": "file:///Test.java"
103-
},
104-
"region": {
105-
"startLine": 10,
106-
"startColumn": 9,
107-
"endLine": 10,
108-
"endColumn": 25
109-
}
110-
}
111-
}
112-
]
103+
"executionSuccessful": true,
104+
"toolConfigurationNotifications": [],
105+
"toolExecutionNotifications": []
113106
}
114107
]
115108
}
116109
]
117-
}
110+
}

0 commit comments

Comments
 (0)