From 5bfd55625c8a62cf308d388784497db52b6e0b78 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 12 Dec 2011 10:43:33 +0100 Subject: [PATCH] SONAR-2973 replace RULE_FAILURES_OVERRIDDEN_SEVERITY by REVIEWS.MANUAL_SEVERITY (boolean) --- .../CloseReviewsDecoratorTest/fixture.xml | 34 +++-- .../shouldCloseResolvedManualViolations.xml | 15 ++- ...ewWithoutCorrespondingViolation-result.xml | 120 ++++++++++-------- ...lvedReviewWithNonFixedViolation-result.xml | 120 ++++++++++-------- .../UpdateReviewsDecoratorTest/fixture.xml | 80 ++++++------ .../shouldUpdateReviews-result.xml | 76 +++++------ .../shared.xml | 4 +- ...rmanentIdFromReferenceViolation-result.xml | 6 +- .../shouldSaveViolations-result.xml | 10 +- .../PurgeUtilsTest/purgeSnapshots-result.xml | 8 +- .../api/PurgeUtilsTest/purgeSnapshots.xml | 8 +- .../purgeDeletedResources-result.xml | 8 +- .../purgeDeletedResources.xml | 8 +- .../purgeDeprecatedLast-result.xml | 8 +- .../purgeDeprecatedLast.xml | 8 +- .../purgeEntities-result.xml | 16 +-- .../PurgeEntitiesTest/purgeEntities.xml | 16 +-- .../purgeOrphanReviews-result.xml | 26 ++-- .../purgeOrphanReviews.xml | 46 +++---- .../purgeUnprocessed-result.xml | 16 +-- .../PurgeUnprocessedTest/purgeUnprocessed.xml | 16 +-- ...dNotEnableSnapshotWhenNotLatest-result.xml | 12 +- .../shouldNotEnableSnapshotWhenNotLatest.xml | 12 +- .../org/sonar/persistence/model/Review.java | 10 ++ .../sonar/persistence/model/ReviewMapper.java | 4 + .../sonar/persistence/model/ReviewMapper.xml | 14 ++ .../org/sonar/persistence/schema-derby.ddl | 6 +- .../persistence/dao/ReviewDaoTest/shared.xml | 81 ++++++------ .../api/database/model/RuleFailureModel.java | 12 -- .../webapp/WEB-INF/app/models/rule_failure.rb | 58 +++++---- ... => 234_add_manual_severity_to_reviews.rb} | 4 +- 31 files changed, 461 insertions(+), 401 deletions(-) rename sonar-server/src/main/webapp/WEB-INF/db/migrate/{234_add_overridden_severity_to_rule_failures.rb => 234_add_manual_severity_to_reviews.rb} (85%) diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/fixture.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/fixture.xml index 0e5a5c21d3d..80e649a8312 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/fixture.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/fixture.xml @@ -24,31 +24,31 @@ id="1" permanent_id="1" snapshot_id="11" - rule_id="1" failure_level="1" overridden_severity="[null]"/> + rule_id="1" failure_level="1"/> + rule_id="1" failure_level="1"/> + rule_id="1" failure_level="1"/> + rule_id="1" failure_level="1"/> + rule_id="1" failure_level="1"/> @@ -22,7 +22,7 @@ snapshot_id="22" rule_id="2" failure_level="4" - overridden_severity="[null]"/> + /> + /> + manual_violation="true" + manual_severity="false"/> \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldCloseReviewWithoutCorrespondingViolation-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldCloseReviewWithoutCorrespondingViolation-result.xml index ff2961fdd66..d70fd3292dd 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldCloseReviewWithoutCorrespondingViolation-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldCloseReviewWithoutCorrespondingViolation-result.xml @@ -1,68 +1,76 @@ + id="1" + status="OPEN" + rule_failure_permanent_id="1" + resource_id="555" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="2" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="3" + status="OPEN" + rule_failure_permanent_id="3" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="4" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="5" + status="REOPENED" + rule_failure_permanent_id="3" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="6" + status="RESOLVED" + rule_failure_permanent_id="3" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="FIXED" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="7" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="8" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="FIXED" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldReopenResolvedReviewWithNonFixedViolation-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldReopenResolvedReviewWithNonFixedViolation-result.xml index d31d65c35ec..d36f1d7de19 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldReopenResolvedReviewWithNonFixedViolation-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/CloseReviewsDecoratorTest/shouldReopenResolvedReviewWithNonFixedViolation-result.xml @@ -1,68 +1,76 @@ + id="1" + status="OPEN" + rule_failure_permanent_id="1" + resource_id="555" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="2" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="3" + status="OPEN" + rule_failure_permanent_id="3" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="4" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="5" + status="REOPENED" + rule_failure_permanent_id="3" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="6" + status="REOPENED" + rule_failure_permanent_id="3" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="7" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="8" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + created_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="FIXED" severity="[null]" resource_line="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/fixture.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/fixture.xml index 26f917e26fb..62e91386059 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/fixture.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/fixture.xml @@ -1,45 +1,49 @@ + id="1" + status="OPEN" + rule_failure_permanent_id="1" + resource_id="1" + title="message OLD" + resource_line="0" + resolution="[null]" + created_at="[null]" + updated_at="[null]" + project_id="[null]" + severity="[null]" + user_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="2" + status="OPEN" + rule_failure_permanent_id="2" + resource_id="1" + title="message 2" + resource_line="2" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="3" + status="OPEN" + rule_failure_permanent_id="3" + resource_id="1" + title="message 3" + resource_line="0" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="4" + status="OPEN" + rule_failure_permanent_id="4" + resource_id="1" + title="message OLD" + resource_line="4" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/shouldUpdateReviews-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/shouldUpdateReviews-result.xml index 186ef803194..83dd96b6121 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/shouldUpdateReviews-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/UpdateReviewsDecoratorTest/shouldUpdateReviews-result.xml @@ -1,44 +1,48 @@ + id="1" + status="OPEN" + rule_failure_permanent_id="1" + resource_id="1" + title="message 1" + resource_line="1" + created_at="[null]" user_id="[null]" assignee_id="[null]" resolution="[null]" severity="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="2" + status="OPEN" + rule_failure_permanent_id="2" + resource_id="1" + title="message 2" + resource_line="2" + created_at="[null]" user_id="[null]" assignee_id="[null]" resolution="[null]" severity="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="3" + status="OPEN" + rule_failure_permanent_id="3" + resource_id="1" + title="message 3" + resource_line="3" + created_at="[null]" user_id="[null]" assignee_id="[null]" resolution="[null]" severity="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="4" + status="OPEN" + rule_failure_permanent_id="4" + resource_id="1" + title="message 4" + resource_line="4" + created_at="[null]" user_id="[null]" assignee_id="[null]" resolution="[null]" severity="[null]" project_id="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml index 198fa99726d..1a5d21da075 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml @@ -22,7 +22,7 @@ status="U" islast="false" depth="3"/> + created_at="2008-11-01 13:58:00.00" checksum="[null]" committer="[null]"/> + created_at="2008-11-01 13:58:00.00" checksum="[null]" committer="[null]"/> diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml index 77079806665..c2dabd0789d 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml @@ -22,10 +22,10 @@ status="U" islast="false" depth="3"/> + created_at="2008-11-01 13:58:00.00" checksum="[null]" committer="[null]"/> + created_at="2008-11-01 13:58:00.00" checksum="[null]" committer="[null]"/> + created_at="[null]" checksum="[null]" committer="[null]"/> diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml index 03bcb346d36..7552966eefe 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml @@ -21,13 +21,13 @@ status="U" islast="false" depth="3"/> + created_at="2008-11-01 13:58:00.00" checksum="[null]" committer="[null]"/> + created_at="2008-11-01 13:58:00.00" checksum="[null]" committer="[null]"/> + created_at="2010-12-25 00:00:00.00" checksum="checksum" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml index 7f1d2b867c8..cc74ed382d4 100644 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml +++ b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml @@ -61,11 +61,11 @@ + checksum="[null]" committer="[null]"/> - - + checksum="[null]" committer="[null]"/> + + + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> - + checksum="[null]" committer="[null]"/> + + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> - + checksum="[null]" committer="[null]"/> + + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> - - + checksum="[null]" committer="[null]"/> + + + committer="[null]"/> + committer="[null]"/> + committer="[null]"/> + committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> --> + id="1" + status="OPEN" + rule_failure_permanent_id="1" + resource_id="555" + project_id="1" + created_at="[null]" updated_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="1" + review_id="1" + created_at="[null]" updated_at="[null]" user_id="[null]" review_text=""/> + id="1" + status="OPEN" + rule_failure_permanent_id="1" + resource_id="555" + project_id="1" + created_at="[null]" updated_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="2" + status="CLOSED" + rule_failure_permanent_id="2" + resource_id="666" + project_id="2" + created_at="[null]" updated_at="[null]" user_id="[null]" assignee_id="[null]" title="[null]" resolution="[null]" severity="[null]" resource_line="[null]" + rule_id="[null]" + manual_violation="false" + manual_severity="false"/> + id="1" + review_id="1" + created_at="[null]" updated_at="[null]" user_id="[null]" review_text=""/> + id="2" + review_id="2" + created_at="[null]" updated_at="[null]" user_id="[null]" review_text=""/> \ No newline at end of file diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/PurgeUnprocessedTest/purgeUnprocessed-result.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/PurgeUnprocessedTest/purgeUnprocessed-result.xml index 2782cad8bac..6d5fd59dcd8 100644 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/PurgeUnprocessedTest/purgeUnprocessed-result.xml +++ b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/purges/PurgeUnprocessedTest/purgeUnprocessed-result.xml @@ -63,20 +63,20 @@ + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> - - - - + + + + + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> + checksum="[null]" committer="[null]"/> - - - - + + + + - - + + - - - - + + + + - - + + selectByResource(int resourceId); List selectByQuery(ReviewQuery query); + + List selectCloseables(@Param("resourceId") int resourceId, @Param("snapshotId") int snapshotId); } diff --git a/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml b/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml index e336df91505..e60a06ce745 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/persistence/model/ReviewMapper.xml @@ -47,5 +47,19 @@ + + diff --git a/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl b/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl index c08611c872c..05bf6631511 100644 --- a/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl +++ b/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl @@ -314,7 +314,8 @@ CREATE TABLE "REVIEWS" ( "RESOURCE_LINE" INTEGER, "RESOLUTION" VARCHAR(200), "RULE_ID" INTEGER, - "MANUAL_VIOLATION" BOOLEAN + "MANUAL_VIOLATION" BOOLEAN, + "MANUAL_SEVERITY" BOOLEAN ); CREATE TABLE "RULES_CATEGORIES" ( @@ -433,8 +434,7 @@ CREATE TABLE "RULE_FAILURES" ( "CHECKSUM" VARCHAR(1000), "PERMANENT_ID" INTEGER, "SWITCHED_OFF" BOOLEAN, - "COMMITTER" VARCHAR(100), - "OVERRIDDEN_SEVERITY" BOOLEAN + "COMMITTER" VARCHAR(100) ); CREATE TABLE "METRICS" ( diff --git a/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml b/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml index 6cbe3307202..70c101759de 100644 --- a/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml +++ b/sonar-core/src/test/resources/org/sonar/persistence/dao/ReviewDaoTest/shared.xml @@ -2,50 +2,53 @@ + id="100" + status="OPEN" + rule_failure_permanent_id="1" + resolution="RESOLVE" + created_at="[null]" + updated_at="[null]" + project_id="20" + resource_line="200" + severity="BLOCKER" + user_id="300" + resource_id="400" + rule_id="500" + manual_violation="[true]" + manual_severity="[false]"/> + id="101" + status="CLOSED" + rule_failure_permanent_id="1" + resolution="RESOLVE" + created_at="[null]" + updated_at="[null]" + project_id="30" + resource_line="120" + severity="MAJOR" + user_id="300" + resource_id="400" + rule_id="505" + manual_violation="[false]" + manual_severity="[false]"/> + id="102" + status="OPEN" + rule_failure_permanent_id="1" + resolution="RESOLVE" + created_at="[null]" + updated_at="[null]" + project_id="20" + resource_line="200" + severity="BLOCKER" + user_id="300" + resource_id="401" + rule_id="500" + manual_violation="[true]" + manual_severity="[false]"/> diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java index 7a42f5e459b..bbab74ade0b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java @@ -70,9 +70,6 @@ public class RuleFailureModel extends BaseIdentifiable { @Column(name = "committer", updatable = true, nullable = true, length = 100) private String committer; - @Column(name = "overridden_severity", updatable = true, nullable = true) - private Boolean overriddenSeverity; - public String getMessage() { return message; } @@ -185,15 +182,6 @@ public class RuleFailureModel extends BaseIdentifiable { return this; } - public Boolean getOverriddenSeverity() { - return overriddenSeverity; - } - - public RuleFailureModel setOverriddenSeverity(Boolean overriddenSeverity) { - this.overriddenSeverity = overriddenSeverity; - return this; - } - @Override public boolean equals(Object obj) { if (!(obj instanceof RuleFailureModel)) { diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb index 2dcabc50107..dc2f0b8480b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb @@ -29,28 +29,28 @@ class RuleFailure < ActiveRecord::Base # first line of message def title @title||= - begin - if message.blank? - rule.name - else - parts=Api::Utils.split_newlines(message) - parts.size==0 ? rule.name : parts[0] - end + begin + if message.blank? + rule.name + else + parts=Api::Utils.split_newlines(message) + parts.size==0 ? rule.name : parts[0] end + end end def plain_message @plain_message ||= - begin - Api::Utils.convert_string_to_unix_newlines(message) - end + begin + Api::Utils.convert_string_to_unix_newlines(message) + end end def html_message @html_message ||= - begin - message ? Api::Utils.split_newlines(ERB::Util.html_escape(message)).join('
') : '' - end + begin + message ? Api::Utils.split_newlines(ERB::Util.html_escape(message)).join('
') : '' + end end def severity @@ -72,15 +72,15 @@ class RuleFailure < ActiveRecord::Base json['createdAt'] = Api::Utils.format_datetime(created_at) end json['rule'] = { - :key => rule.key, - :name => rule.name + :key => rule.key, + :name => rule.name } json['resource'] = { - :key => resource.key, - :name => resource.name, - :scope => resource.scope, - :qualifier => resource.qualifier, - :language => resource.language + :key => resource.key, + :name => resource.name, + :scope => resource.scope, + :qualifier => resource.qualifier, + :language => resource.language } json['review'] = review.to_json(convert_markdown) if include_review && review json @@ -114,14 +114,16 @@ class RuleFailure < ActiveRecord::Base def build_review(options={}) if self.review.nil? self.review=Review.new( - {:status => Review::STATUS_OPEN, - :severity => severity, - :resource_line => line, - :resource => resource, - :title => title, - :rule => rule, - :manual_violation => false - }.merge(options)) + { + :status => Review::STATUS_OPEN, + :severity => severity, + :resource_line => line, + :resource => resource, + :title => title, + :rule => rule, + :manual_violation => false, + :manual_severity => false + }.merge(options)) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/234_add_overridden_severity_to_rule_failures.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/234_add_manual_severity_to_reviews.rb similarity index 85% rename from sonar-server/src/main/webapp/WEB-INF/db/migrate/234_add_overridden_severity_to_rule_failures.rb rename to sonar-server/src/main/webapp/WEB-INF/db/migrate/234_add_manual_severity_to_reviews.rb index 98839ca0d66..91799f97c4c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/234_add_overridden_severity_to_rule_failures.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/234_add_manual_severity_to_reviews.rb @@ -21,10 +21,10 @@ # # Sonar 2.13 # -class AddOverriddenSeverityToRuleFailures < ActiveRecord::Migration +class AddManualSeverityToReviews < ActiveRecord::Migration def self.up - add_column 'rule_failures', 'overridden_severity', :boolean, :null => true + add_column 'reviews', 'manual_severity', :boolean, :null => true end end -- 2.39.5