<cardinality>MULTIPLE</cardinality>
- <param key="xpath" type="s">
+ <param key="xpath" type="TEXT">
</param>
<param key="message" type="s">
*/
package org.sonar.plugins.pmd;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
import org.junit.Before;
import org.junit.Test;
+import org.sonar.api.PropertyType;
import org.sonar.api.platform.ServerFileSystem;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.XMLRuleParser;
assertThat(rules).onProperty("key").excludes("JUnitStaticSuite");
}
+ @Test
+ public void should_use_text_parameter_for_xpath_rule() {
+ Rule xpathRule = Iterables.find(repository.createRules(), new Predicate<Rule>() {
+ public boolean apply(Rule rule) {
+ return rule.getKey().equals("XPathRule");
+ }
+ });
+
+ assertThat(xpathRule.getParam("xpath").getType()).isEqualTo(PropertyType.TEXT.name());
+ }
+
@Test
public void should_provide_a_name_and_description_for_each_rule() {
List<Rule> rules = RuleRepositoryTestHelper.createRulesWithNameAndDescription("pmd", repository);
return PropertyType::TYPE_INTEGER if type == PARAM_TYPE_INTEGER_LIST
return PropertyType::TYPE_BOOLEAN if type == PARAM_TYPE_BOOLEAN
return PropertyType::TYPE_STRING if type == PARAM_TYPE_REGEXP
+ return PropertyType::TYPE_STRING if is_set(type)
- PropertyType::TYPE_STRING
+ type
end
def readable_type(type)
- return "" if type == PARAM_TYPE_STRING
return "Set of string (, as delimiter)" if type == PARAM_TYPE_STRING_LIST
return "Number" if type == PARAM_TYPE_INTEGER
return "Set of number (, as delimiter)" if type == PARAM_TYPE_INTEGER_LIST
- return "" if type == PARAM_TYPE_BOOLEAN
return "Regular expression" if type == PARAM_TYPE_REGEXP
return "Set of values (, as delimiter)" if is_set(type)
+ ""
end
def param_value_input(parameter, value, options = {})