]> source.dussan.org Git - sonarqube.git/commitdiff
Remove no more used code on active rules
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 21 Jan 2014 19:12:21 +0000 (20:12 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 21 Jan 2014 19:12:41 +0000 (20:12 +0100)
sonar-server/src/main/webapp/WEB-INF/app/helpers/old_rules_configuration_helper.rb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/models/active_rule.rb
sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_parameter.rb
sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb

diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/old_rules_configuration_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/old_rules_configuration_helper.rb
deleted file mode 100644 (file)
index e66d9fe..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2013 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# SonarQube is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-#
-module OldRulesConfigurationHelper
-  include PropertiesHelper
-
-  PARAM_TYPE_STRING_LIST = "s{}"
-  PARAM_TYPE_INTEGER_LIST = "i{}"
-
-  # Kept for compatibility with old rule param type
-  def type_with_compatibility(type)
-    return PropertyType::TYPE_STRING if type == 's'
-    return PropertyType::TYPE_STRING if type == PARAM_TYPE_STRING_LIST
-    return PropertyType::TYPE_INTEGER if type == 'i'
-    return PropertyType::TYPE_INTEGER if type == PARAM_TYPE_INTEGER_LIST
-    return PropertyType::TYPE_BOOLEAN if type == 'b'
-    return PropertyType::TYPE_REGULAR_EXPRESSION if type == 'r'
-    return PropertyType::TYPE_STRING if is_set(type)
-
-    type
-  end
-
-  def readable_type(param_type)
-    type=type_with_compatibility(param_type)
-
-    return "Set of comma delimited strings" if param_type == PARAM_TYPE_STRING_LIST
-    return "Number" if type == PropertyType::TYPE_INTEGER
-    return "Set of comma delimited numbers" if param_type == PARAM_TYPE_INTEGER_LIST
-    return "Regular expression" if type == PropertyType::TYPE_REGULAR_EXPRESSION
-    return "Set of comma delimited values" if is_set(param_type)
-    ""
-  end
-
-  def param_value_input(parameter, value, options = {})
-    type=type_with_compatibility(parameter.param_type)
-    name = options[:name] || 'value'
-    property_input_field name, type, value, 'WIDGET', {:id => parameter.id, :size => options[:size] }.update(options)
-  end
-
-  def is_set(type)
-    type.at(1) == "[" && type.ends_with?("]")
-  end
-
-  def validate_rule_param(attribute, param_type, errors, value)
-    return if attribute.nil? or attribute.length == 0
-
-    type=type_with_compatibility(param_type)
-
-    if is_set_type
-      attribute.split(',').each do |v|
-        if !get_allowed_tokens.include?(v)
-          errors.add("#{value}", "'#{v}' must be one of : " + get_allowed_tokens.join(', '))
-        end
-      end
-    elsif param_type == RulesConfigurationHelper::PARAM_TYPE_INTEGER_LIST
-      attribute.split(',').each do |n|
-        if !Api::Utils.is_integer?(n)
-          errors.add("#{value}", "'#{n}' must be an integer.")
-        end
-      end
-    elsif type == PropertyType::TYPE_REGULAR_EXPRESSION
-      errors.add("#{value}", "'#{attribute}' must be a regular expression") unless Api::Utils.is_regexp?(attribute)
-    elsif type == PropertyType::TYPE_INTEGER
-      errors.add("#{value}", "'#{attribute}' must be an integer.") unless Api::Utils.is_integer?(attribute)
-    elsif type == PropertyType::TYPE_BOOLEAN
-      errors.add("#{value}", "'#{attribute}' must be one of : true,false") unless Api::Utils.is_boolean?(attribute)
-    end
-  end
-end
-
index 0f43ae3beef2b262ad7a75e76c86fb968809be87..0267f2e642863be06d584fab689666347e5bab35 100644 (file)
@@ -94,14 +94,6 @@ class ActiveRule < ActiveRecord::Base
     nil
   end
 
-  def copy
-    new_active_rule = ActiveRule.new(:rule => rule, :failure_level => failure_level)
-    self.active_rule_parameters.each do |active_rule_parameter|
-      new_active_rule.active_rule_parameters << active_rule_parameter.copy
-    end
-    new_active_rule
-  end
-
   def inherited?
     inheritance=='INHERITED'
   end
index 0bba9a85665d8e816bb34c7cec6e1309d7b4b1cd..a30fdbb457ff9f5b96092e93f8294b25b0be33a3 100644 (file)
      rules_parameter
    end
 
-   def validate
-     rules_parameter.validate_value(value, errors, "value")
-   end
-
-   def copy
-     ActiveRuleParameter.new(:rules_parameter => rules_parameter, :value => value, :rules_parameter_key => rules_parameter.name)
-   end
-
  end
index f8c539a7002e94e911fae956567cc2a7407c400e..69239fd51cf047b48e5c8d20741762fa74946b56 100644 (file)
@@ -25,18 +25,6 @@ class RulesParameter < ActiveRecord::Base
   validates_presence_of :name, :param_type
   belongs_to :rule
 
-  def is_set_type
-    param_type.at(1) == "[" && param_type.ends_with?("]")
-  end
-
-  def get_allowed_tokens
-    param_type[2, param_type.length-3].split(",")
-  end
-
-  def validate_value(attribute, errors, value)
-    validate_rule_param(attribute, param_type, errors, value)
-  end
-
   def to_hash_json(active_rule)
     json = {'name' => name}
     json['description']=description if description