summaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-02-22 16:25:17 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-02-22 16:25:17 +0100
commit6843aa6703697e7fd9073b26d1b8413170e7248f (patch)
tree8629965245d2156a594c1dc71a94bdbb902bdf69 /sonar-server
parente8e5e0c895705af4f0b685b521e53128796769bd (diff)
downloadsonarqube-6843aa6703697e7fd9073b26d1b8413170e7248f.tar.gz
sonarqube-6843aa6703697e7fd9073b26d1b8413170e7248f.zip
SONAR-2205 Web service /api/rules should provide configKey
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rules_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb12
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb3
3 files changed, 10 insertions, 7 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rules_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rules_controller.rb
index 0d9a4bb5394..6b5b0d52b17 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rules_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/rules_controller.rb
@@ -80,7 +80,7 @@ class Api::RulesController < Api::RestController
xml.instruct!
xml.rules do
rules.each do |rule|
- xml << rule.to_xml(profile)
+ rule.to_xml(profile, xml)
end
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb
index c485d0d0736..6b2a91db46d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb
@@ -57,6 +57,10 @@ class Rule < ActiveRecord::Base
def <=>(rule)
name<=>rule.name
end
+
+ def config_key
+ plugin_config_key
+ end
def self.to_i(key_or_id)
id=key_or_id.to_i
@@ -87,7 +91,7 @@ class Rule < ActiveRecord::Base
end
def to_hash_json(profile)
- json = {'title' => name, 'key' => key, 'plugin' => plugin_name}
+ json = {'title' => name, 'key' => key, 'plugin' => plugin_name, 'config_key' => config_key}
json['description'] = description
active_rule = nil
if profile
@@ -106,11 +110,11 @@ class Rule < ActiveRecord::Base
json
end
- def to_xml(profile)
- xml = Builder::XmlMarkup.new
+ def to_xml(profile, xml)
xml.rule do
xml.title(name)
xml.key(key)
+ xml.config_key(config_key)
xml.plugin(plugin_name)
xml.description {xml.cdata!(description)}
active_rule = nil
@@ -127,7 +131,7 @@ class Rule < ActiveRecord::Base
xml.priority(priority_text)
end
parameters.each do |parameter|
- xml << parameter.to_xml(active_rule)
+ parameter.to_xml(active_rule, xml)
end
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb
index 1bcc7fd012d..d7c67334baa 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb
@@ -109,8 +109,7 @@ class RulesParameter < ActiveRecord::Base
json
end
- def to_xml(active_rule)
- xml = Builder::XmlMarkup.new
+ def to_xml(active_rule, xml)
xml.param do
xml.name(name)
xml.description {xml.cdata!(description)}