]> source.dussan.org Git - sonarqube.git/commitdiff
Replace all space by '_' in key when creating manual rule
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 4 Jun 2013 14:29:55 +0000 (16:29 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 4 Jun 2013 14:30:08 +0000 (16:30 +0200)
sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb

index 7b425f0cbe4558f9aa8b9885c602ebe6d71e7062..a8bd6d19d3752ce58d277ee94b0d75bf6317a389 100644 (file)
@@ -181,7 +181,7 @@ class Rule < ActiveRecord::Base
     if Api::Utils.is_integer?(rule_id_or_name)
       rule = Rule.first(:conditions => {:status => STATUS_READY, :plugin_name => MANUAL_REPOSITORY_KEY, :id => rule_id_or_name.to_i})
     else
-      key = rule_id_or_name.strip.downcase.sub(/\s+/, '_')
+      key = rule_id_or_name.strip.downcase.gsub(/\s/, '_')
       rule = Rule.first(:conditions => {:status => STATUS_READY, :plugin_name => MANUAL_REPOSITORY_KEY, :plugin_rule_key => key})
       if rule==nil && create_if_not_found
         description = options[:description] || Api::Utils.message('manual_rules.should_provide_real_description')