json['message'] = message
json['line'] = line if line && line>=1
json['priority'] = Sonar::RulePriority.to_s(failure_level).upcase
- json['falsePositive']=true if false_positive?
+ json['switchedOff']=true if switched_off?
if created_at
json['createdAt'] = format_datetime(created_at)
end
:qualifier => snapshot.project.qualifier,
:language => snapshot.project.language
}
- json['review']=review.id if review
+ json['review']=review.id.to_i if review
json
end
xml.message(message)
xml.line(line) if line && line>=1
xml.priority(Sonar::RulePriority.to_s(failure_level))
- xml.falsePositive(true) if false_positive?
+ xml.switchedOff(true) if switched_off?
if created_at
xml.createdAt(format_datetime(created_at))
end
xml.qualifier(snapshot.project.qualifier)
xml.language(snapshot.project.language)
end
- xml.review(review.id) if review
+ xml.review(review.id.to_i) if review
end
end
private String resourceScope = null;
private String resourceQualifier = null;
private Date createdAt = null;
- private boolean falsePositive;
+ private boolean switchedOff;
private Long reviewId = null;
public String getMessage() {
/**
* @since 2.8
*/
- public Violation setFalsePositive(Boolean b) {
- this.falsePositive = (b != null && b);
+ public Violation setSwitchedOff(Boolean b) {
+ this.switchedOff = (b != null && b);
return this;
}
/**
* @since 2.8
*/
- public boolean isFalsePositive() {
- return falsePositive;
+ public boolean isSwitchedOff() {
+ return switchedOff;
}
public Long getReviewId() {
violation.setLine(utils.getInteger(json, "line"));
violation.setSeverity(utils.getString(json, "priority"));
violation.setCreatedAt(utils.getDateTime(json, "createdAt"));
- violation.setFalsePositive(utils.getBoolean(json, "falsePositive"));
+ violation.setSwitchedOff(utils.getBoolean(json, "switchedOff"));
violation.setReviewId(utils.getLong(json, "review"));
Object rule = utils.getField(json, "rule");
assertThat(violation.getResourceName(), is("TraceableResourceLimitingPool"));
assertThat(violation.getResourceQualifier(), is("CLA"));
assertThat(violation.getResourceScope(), is("FIL"));
- assertThat(violation.isFalsePositive(), is(false));
+ assertThat(violation.isSwitchedOff(), is(false));
assertThat(violation.getReviewId(), nullValue());
}
}
@Test
- public void testFalsePositive() {
+ public void testSwitchedOff() {
Violation violation = new ViolationUnmarshaller().toModel(loadFile("/violations/false-positive.json"));
- assertThat(violation.isFalsePositive(), is(true));
+ assertThat(violation.isSwitchedOff(), is(true));
assertThat(violation.getReviewId(), is(123L));
}
[
- {"message":"throw java.lang.Exception","falsePositive": true, "review": 123, "priority":"MAJOR","rule":{"key":"pmd:SignatureDeclareThrowsException","name":"Signature Declare Throws Exception","category":"Maintainability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}}
+ {"message":"throw java.lang.Exception","switchedOff": true, "review": 123, "priority":"MAJOR","rule":{"key":"pmd:SignatureDeclareThrowsException","name":"Signature Declare Throws Exception","category":"Maintainability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}}
]
\ No newline at end of file