Java Code Examples for org.sonar.api.utils.ValidationMessages#create()

The following examples show how to use org.sonar.api.utils.ValidationMessages#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckstyleProfileImporterTest.java    From sonar-checkstyle with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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());
}
 
Example 2
Source File: CssProfileTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 3
Source File: LessProfileTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 4
Source File: ScssProfileTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 5
Source File: ApexProfileTest.java    From enforce-sonarqube-plugin with MIT License 5 votes vote down vote up
@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));
}
 
Example 6
Source File: GherkinProfileTest.java    From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 7
Source File: LuaProfileTest.java    From sonar-lua with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_create_sonar_way_profile() {
  ValidationMessages validation = ValidationMessages.create();

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

  assertThat(profile.getLanguage()).isEqualTo(Lua.KEY);
  assertThat(profile.getName()).isEqualTo(CheckList.SONAR_WAY_PROFILE);
  assertThat(profile.getActiveRulesByRepository(CheckList.REPOSITORY_KEY)).hasSize(15);
  assertThat(validation.hasErrors()).isFalse();
}
 
Example 8
Source File: PmdProfileImporterTest.java    From sonar-p3c-pmd with MIT License 4 votes vote down vote up
@Before
public void setUpImporter() {
  messages = ValidationMessages.create();
  importer = new PmdProfileImporter(createRuleFinder());
}