From 365a5dbae8f05b95f55637659d392688474a1730 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Wed, 22 Sep 2010 13:29:23 +0000 Subject: [PATCH] SONAR-1798 rename RULE_FAILURES.POINTS to COST --- .../purgeDeletedResources-result.xml | 8 ++++---- .../purgeDeletedResources.xml | 8 ++++---- .../purgeDeprecatedLast-result.xml | 8 ++++---- .../purgeDeprecatedLast.xml | 8 ++++---- .../purgeEntities-result.xml | 16 +++++++-------- .../PurgeEntitiesTest/purgeEntities.xml | 16 +++++++-------- .../purgeUnprocessed-result.xml | 16 +++++++-------- .../PurgeUnprocessedTest/purgeUnprocessed.xml | 16 +++++++-------- .../java/org/sonar/batch/ViolationsDao.java | 4 ++-- ...pdatedWhenAnalyzingPastSnapshot-result.xml | 12 +++++------ ...tIsNotUpdatedWhenAnalyzingPastSnapshot.xml | 12 +++++------ .../purgeSnapshots-result.xml | 8 ++++---- .../AbstractPurgeTest/purgeSnapshots.xml | 8 ++++---- .../api/database/model/RuleFailureModel.java | 12 +++++------ .../java/org/sonar/api/rules/Violation.java | 20 ++++++++++++++----- ...oints.rb => 141_add_rule_failures_cost.rb} | 4 ++-- 16 files changed, 93 insertions(+), 83 deletions(-) rename sonar-server/src/main/webapp/WEB-INF/db/migrate/{141_add_rule_failures_points.rb => 141_add_rule_failures_cost.rb} (84%) diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/purges/PurgeDeletedResourcesTest/purgeDeletedResources-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/purges/PurgeDeletedResourcesTest/purgeDeletedResources-result.xml index 20a21ee945e..e9bcbeea46c 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/purges/PurgeDeletedResourcesTest/purgeDeletedResources-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/purges/PurgeDeletedResourcesTest/purgeDeletedResources-result.xml @@ -26,10 +26,10 @@ - - - - + + + + - - - - + + + + --> - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - - - - + + + + - - + + --> - - - - + + + + - - - - + + + + setCost() + */ + public Double getCost() { + return cost; } - public Violation setPoints(Double d) { - this.points = d; + /** + * The cost to fix a violation can't be precisely computed without this information. + * Let's take the following example : a rule forbids to have methods whose complexity is greater than 10. Without this field "cost", + * the same violation is created with a method whose complexity is 15 and a method whose complexity is 100. + * If the cost to fix one point of complexity is 0.05h, then 15mn is necessary to fix the method whose complexity is 15, + * and 3h5mn is required to fix the method whose complexity is 100. + */ + public Violation setCost(Double d) { + this.cost = d; return this; } diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/141_add_rule_failures_points.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/141_add_rule_failures_cost.rb similarity index 84% rename from sonar-server/src/main/webapp/WEB-INF/db/migrate/141_add_rule_failures_points.rb rename to sonar-server/src/main/webapp/WEB-INF/db/migrate/141_add_rule_failures_cost.rb index e3df02105b1..c2cf2737298 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/141_add_rule_failures_points.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/141_add_rule_failures_cost.rb @@ -17,10 +17,10 @@ # License along with Sonar; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 # -class AddRuleFailuresPoints < ActiveRecord::Migration +class AddRuleFailuresCost < ActiveRecord::Migration def self.up - add_column 'rule_failures', 'points', :decimal, :null => true, :precision => 30, :scale => 20 + add_column 'rule_failures', 'cost', :decimal, :null => true, :precision => 30, :scale => 20 end end -- 2.39.5