当前位置: 首页>>代码示例>>Java>>正文


Java ValidationMessages.create方法代码示例

本文整理汇总了Java中org.sonar.api.utils.ValidationMessages.create方法的典型用法代码示例。如果您正苦于以下问题:Java ValidationMessages.create方法的具体用法?Java ValidationMessages.create怎么用?Java ValidationMessages.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sonar.api.utils.ValidationMessages的用法示例。


在下文中一共展示了ValidationMessages.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: before

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Before
public void before() {
    messages = ValidationMessages.create();

    /*
     * The mocked rule finder defines 3 rules :
     *
     * - JavadocCheck with 2 paramters format and ignore, default priority
     * is MAJOR
     * - EqualsHashCodeCheck without parameters, default priority
     * is BLOCKER
     * - MissingOverride with 1 parameter javaFiveCompatibility,
     * default priority is MINOR
     */
    importer = new CheckstyleProfileImporter(newRuleFinder());
}
 
开发者ID:checkstyle,项目名称:sonar-checkstyle,代码行数:17,代码来源:CheckstyleProfileImporterTest.java

示例2: test_profile_importer

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void test_profile_importer() throws Exception {
  String content = "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key1/@EntryIndexedValue\">WARNING</s:String>" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key2/@EntryIndexedValue\">ERROR</s:String>" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedVariable_002ECompiler/@EntryIndexedValue\">HINT</s:String>" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key2/@EntryIndexedValue\">DO_NOT_SHOW</s:String>" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key2\">DO_NOT_SHOW</s:String>" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key2/@EntryIndexedValue\">INVALID_SEVERITY</s:String>" +
    "<s:String x:Key=\"/other/entry\">value</s:String>" +
    "<s:String>value</s:String>" +
    "<s:other>value</s:other>" +
    "</wpf:ResourceDictionary>";
  ReSharperProfileImporter importer = new ReSharperProfileImporter(new ReSharperConfiguration("key", "key", "key"));
  ValidationMessages messages = ValidationMessages.create();
  RulesProfile profile = importer.importProfile(new StringReader(content), messages);
  List<ActiveRule> rules = profile.getActiveRules();
  assertThat(rules).hasSize(3);
  Map<String, String> ruleKeys = getKeysWithSeverities(rules);
  assertThat(ruleKeys.keySet()).containsOnly("key1", "key2", "UnusedVariable.Compiler");
  assertThat(ruleKeys.get("key1")).isEqualTo("MAJOR");
  assertThat(ruleKeys.get("key2")).isEqualTo("CRITICAL");
  assertThat(ruleKeys.get("UnusedVariable.Compiler")).isEqualTo("INFO");
  assertThat(messages.getErrors()).containsExactly("Skipping rule key2 because has an unexpected severity: INVALID_SEVERITY");
}
 
开发者ID:GregBartlett,项目名称:sonar-resharper,代码行数:26,代码来源:ReSharperProfileImporterTest.java

示例3: profilesByLanguage

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
private static ListMultimap<String, RulesProfile> profilesByLanguage(ProfileDefinition[] profileDefinitions) {
  ListMultimap<String, RulesProfile> byLang = ArrayListMultimap.create();
  for (ProfileDefinition definition : profileDefinitions) {
    ValidationMessages validation = ValidationMessages.create();
    RulesProfile profile = definition.createProfile(validation);
    if (profile != null && !validation.hasErrors()) {
      byLang.put(StringUtils.lowerCase(profile.getLanguage()), profile);
    }
  }
  return byLang;
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:12,代码来源:StandaloneActiveRulesProvider.java

示例4: should_create_sonarqube_way_profile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void should_create_sonarqube_way_profile() {
  ValidationMessages validation = ValidationMessages.create();
  CssProfile definition = new CssProfile(universalRuleFinder());
  RulesProfile profile = definition.createProfile(validation);

  assertThat(profile.getName()).isEqualTo("SonarQube Way");
  assertThat(profile.getLanguage()).isEqualTo("css");
  assertThat(profile.getActiveRulesByRepository("css")).hasSize(73);
  assertThat(validation.hasErrors()).isFalse();
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:12,代码来源:CssProfileTest.java

示例5: should_create_sonarqube_way_profile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void should_create_sonarqube_way_profile() {
  ValidationMessages validation = ValidationMessages.create();
  LessProfile definition = new LessProfile(universalRuleFinder());
  RulesProfile profile = definition.createProfile(validation);

  assertThat(profile.getName()).isEqualTo("SonarQube Way");
  assertThat(profile.getLanguage()).isEqualTo("less");
  assertThat(profile.getActiveRulesByRepository("less")).hasSize(73);
  assertThat(validation.hasErrors()).isFalse();
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:12,代码来源:LessProfileTest.java

示例6: should_create_sonarqube_way_profile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void should_create_sonarqube_way_profile() {
  ValidationMessages validation = ValidationMessages.create();
  ScssProfile definition = new ScssProfile(universalRuleFinder());
  RulesProfile profile = definition.createProfile(validation);

  assertThat(profile.getName()).isEqualTo("SonarQube Way");
  assertThat(profile.getLanguage()).isEqualTo("scss");
  assertThat(profile.getActiveRulesByRepository("scss")).hasSize(84);
  assertThat(validation.hasErrors()).isFalse();
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:12,代码来源:ScssProfileTest.java

示例7: should_create_perlcritic_profile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void should_create_perlcritic_profile() {
  ValidationMessages validation = ValidationMessages.create();
  SonarWayProfile definition = new SonarWayProfile(new XMLProfileParser(ruleFinder()));
  RulesProfile profile = definition.createProfile(validation);
  assertThat(profile.getLanguage()).isEqualTo(PerlLanguage.KEY);
  assertThat(profile.getName()).isEqualTo("Sonar way");
  assertThat(profile.getActiveRules()).extracting("repositoryKey").containsOnly("PerlCritic", "common-perl");
  assertThat(validation.hasErrors()).isFalse();
  assertThat(profile.getActiveRules().size()).isGreaterThan(87);

}
 
开发者ID:sonar-perl,项目名称:sonar-perl,代码行数:13,代码来源:SonarWayProfileTest.java

示例8: testCreateSonarWayProfile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void testCreateSonarWayProfile() {
    ValidationMessages validation = ValidationMessages.create();

    RuleFinder ruleFinder = buildRuleFinder();
    ApexProfile definition = new ApexProfile(ruleFinder);
    RulesProfile profile = definition.createProfile(validation);

    assertThat(profile.getLanguage(), equalTo(Apex.KEY));
    assertThat(profile.getName(), equalTo(CheckList.SONAR_WAY_PROFILE));
    assertThat(validation.hasErrors(), is(FALSE));
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:13,代码来源:ApexProfileTest.java

示例9: should_create_sonarqube_way_profile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void should_create_sonarqube_way_profile() {
  ValidationMessages validation = ValidationMessages.create();
  GherkinProfile definition = new GherkinProfile(universalRuleFinder());
  RulesProfile profile = definition.createProfile(validation);

  assertThat(profile.getName()).isEqualTo("SonarQube Way");
  assertThat(profile.getLanguage()).isEqualTo("gherkin");
  assertThat(profile.getActiveRulesByRepository("gherkin")).hasSize(36);
  assertThat(validation.hasErrors()).isFalse();
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:12,代码来源:GherkinProfileTest.java

示例10: should_create_sonarqube_way_profile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void should_create_sonarqube_way_profile() {
  ValidationMessages validation = ValidationMessages.create();
  JavaPropertiesProfile definition = new JavaPropertiesProfile(universalRuleFinder());
  RulesProfile profile = definition.createProfile(validation);

  assertThat(profile.getName()).isEqualTo("SonarQube Way");
  assertThat(profile.getLanguage()).isEqualTo("jproperties");
  assertThat(profile.getActiveRulesByRepository("jproperties")).hasSize(22);
  assertThat(validation.hasErrors()).isFalse();
}
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:12,代码来源:JavaPropertiesProfileTest.java

示例11: should_create_sonarqube_way_profile

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void should_create_sonarqube_way_profile() {
  ValidationMessages validation = ValidationMessages.create();
  JSONProfile definition = new JSONProfile(universalRuleFinder());
  RulesProfile profile = definition.createProfile(validation);

  assertThat(profile.getName()).isEqualTo(JSONProfile.SONARQUBE_WAY_PROFILE_NAME);
  assertThat(profile.getLanguage()).isEqualTo(JSONLanguage.KEY);
  assertThat(profile.getActiveRulesByRepository(CheckList.REPOSITORY_KEY)).hasSize(5);
  assertThat(validation.hasErrors()).isFalse();
}
 
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:12,代码来源:JSONProfileTest.java

示例12: test_profile_importer

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void test_profile_importer() throws Exception {
  String content = "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key1/@EntryIndexedValue\">WARNING</s:String>" +
    "</wpf:ResourceDictionary>";
  CSharpReSharperProvider.CSharpReSharperProfileImporter importer = new CSharpReSharperProvider.CSharpReSharperProfileImporter();
  ValidationMessages messages = ValidationMessages.create();
  RulesProfile profile = importer.importProfile(new StringReader(content), messages);
  List<ActiveRule> rules = profile.getActiveRules();
  assertThat(rules).hasSize(1);
  assertThat(messages.getErrors()).isEmpty();
}
 
开发者ID:GregBartlett,项目名称:sonar-resharper,代码行数:13,代码来源:CSharpReSharperProviderTest.java

示例13: test_invalid_xml

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void test_invalid_xml() throws Exception {
  String content = "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">\n" +
    "  <s:String x:Key=\"/Defa";
  ReSharperProfileImporter importer = new ReSharperProfileImporter(new ReSharperConfiguration("key", "key", "key"));
  ValidationMessages messages = ValidationMessages.create();
  RulesProfile profile = importer.importProfile(new StringReader(content), messages);
  List<ActiveRule> rules = profile.getActiveRules();
  assertThat(rules).isEmpty();
  List<String> errors = messages.getErrors();
  assertThat(errors).hasSize(1);
  assertThat(errors.get(0)).startsWith("Error parsing content: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF ");
}
 
开发者ID:GregBartlett,项目名称:sonar-resharper,代码行数:14,代码来源:ReSharperProfileImporterTest.java

示例14: test_invalid_root_element

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void test_invalid_root_element() throws Exception {
  String content = "<bad xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">\n" +
    "  <s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key1/@EntryIndexedValue\">WARNING</s:String>\n" +
    "</bad>";
  ReSharperProfileImporter importer = new ReSharperProfileImporter(new ReSharperConfiguration("key", "key", "key"));
  ValidationMessages messages = ValidationMessages.create();
  RulesProfile profile = importer.importProfile(new StringReader(content), messages);
  List<ActiveRule> rules = profile.getActiveRules();
  assertThat(rules).isEmpty();
  assertThat(messages.getErrors()).containsExactly("Expected element: wpf:ResourceDictionary, actual: bad");
}
 
开发者ID:GregBartlett,项目名称:sonar-resharper,代码行数:13,代码来源:ReSharperProfileImporterTest.java

示例15: test_profile_importer

import org.sonar.api.utils.ValidationMessages; //导入方法依赖的package包/类
@Test
public void test_profile_importer() throws Exception {
  String content = "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">" +
    "<s:String x:Key=\"/Default/CodeInspection/Highlighting/InspectionSeverities/=key1/@EntryIndexedValue\">WARNING</s:String>" +
    "</wpf:ResourceDictionary>";
  ReSharperProfileImporter importer = new VBNetReSharperProvider.VBNetReSharperProfileImporter();
  ValidationMessages messages = ValidationMessages.create();
  RulesProfile profile = importer.importProfile(new StringReader(content), messages);
  List<ActiveRule> rules = profile.getActiveRules();
  assertThat(rules).hasSize(1);
  assertThat(messages.getErrors()).isEmpty();
}
 
开发者ID:GregBartlett,项目名称:sonar-resharper,代码行数:13,代码来源:VBNetReSharperProviderTest.java


注:本文中的org.sonar.api.utils.ValidationMessages.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。