Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.Profile$Rule


            String segment = currTextSegment.toString();
            List<Rule> parentMatches = getMatches().peek();
            int len = parentMatches.size();
            for ( int i = 0; i < len; ++i )
            {
                Rule r = parentMatches.get( i );
                if ( r instanceof TextSegmentHandler )
                {
                    TextSegmentHandler h = (TextSegmentHandler) r;
                    try
                    {
View Full Code Here


    {

        @Override
        protected void configure()
        {
            forPattern( "bar" ).addRule( new Rule()
            {

                @Override
                public void body( String namespace, String name, String text )
                    throws Exception
View Full Code Here

            Log log = getDigester().getLogger();
            boolean debug = log.isDebugEnabled();
            for ( int i = 0; i < rules.size(); i++ )
            {
                int j = ( rules.size() - i ) - 1;
                Rule rule = rules.get( j );
                if ( debug )
                {
                    log.debug( "  Fire end() for " + rule );
                }
                try
                {
                    rule.end( namespaceURI, name );
                }
                catch ( Exception e )
                {
                    throw getDigester().createSAXException( e );
                }
View Full Code Here

    " pages: " + issues.paging().pages() + " max results reached: " + issues.maxResultsReached());
  }

  private static void testGetProfile() {
    SonarServer sonarServer = SonarServer.create("https://sonar.corp.mobile.de/sonar");
    final Profile profile = sonarServer.getProfile("java", "mobile_relaxed");
    System.out.println("rules count: " + profile.getRules().size());
  }
View Full Code Here

public class ProfileUnmarshallerTest extends UnmarshallerTestCase {

  @Test
  public void shouldNotHaveProfile() {
    Profile profile = new ProfileUnmarshaller().toModel("[]");
    assertThat(profile, nullValue());
  }
View Full Code Here

    assertThat(profile, nullValue());
  }

  @Test
  public void shouldGetProfile() {
    Profile profile = new ProfileUnmarshaller().toModel(loadFile("/profiles/profile.json"));
    assertThat(profile.getLanguage(), is("java"));
    assertThat(profile.getName(), is("Sonar way"));
    assertThat(profile.getParentName(), nullValue());
    assertThat(profile.isDefaultProfile(), is(true));

    assertThat(profile.getRules().size(), is(116));
    Profile.Rule rule1 = profile.getRules().get(0);
    assertThat(rule1.getKey(), is("com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck"));
    assertThat(rule1.getRepository(), is("checkstyle"));
    assertThat(rule1.getInheritance(), nullValue());
    assertThat(rule1.getSeverity(), is("MAJOR"));
    assertThat(rule1.getParameters().size(), is(0));
    assertThat(rule1.getParameter("foo"), nullValue());

    Profile.Rule rule2 = profile.getRule("checkstyle", "com.puppycrawl.tools.checkstyle.checks.naming.LocalFinalVariableNameCheck");
    assertThat(rule2.getParameters().size(), is(1));
    assertThat(rule2.getParameter("format"), is("^[a-z][a-zA-Z0-9]*$"));
  }
View Full Code Here

public class ProfileUnmarshaller extends AbstractUnmarshaller<Profile> {

  @Override
  protected Profile parse(Object json) {
    WSUtils utils = WSUtils.getINSTANCE();
    Profile profile = new Profile();
    Boolean defaultProfile = utils.getBoolean(json, "default");
    profile
        .setLanguage(utils.getString(json, "language"))
        .setName(utils.getString(json, "name"))
        .setDefaultProfile(defaultProfile != null ? defaultProfile : false)
        .setParentName(utils.getString(json, "parent"));
View Full Code Here

   */
  public String graph() throws Exception {
    StringBuffer text = new StringBuffer();
   
    text.append("digraph M5Tree {\n");
    Rule temp = (Rule)m_ruleSet.elementAt(0);
    temp.topOfTree().graph(text);
    text.append("}\n");
    return text.toString();
  }
View Full Code Here

TOP

Related Classes of org.sonar.wsclient.services.Profile$Rule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.