Examples of RuleKey


Examples of org.sonar.api.rule.RuleKey

      createIssues(file, context);
    }
  }

  private void createIssues(InputFile file, SensorContext context) {
    RuleKey ruleKey = RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY);
    InputDir inputDir = context.fileSystem().inputDir(file.file().getParentFile());
    if (inputDir != null) {
      context.newIssue()
        .ruleKey(ruleKey)
        .onDir(inputDir)
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

      // mandatory parameters
      String componentKey = params.get("component");
      if (StringUtils.isBlank(componentKey)) {
        result.addError("Component is not set");
      }
      RuleKey ruleKey = null;
      String rule = params.get("rule");
      if (StringUtils.isBlank(rule)) {
        result.addError(Result.Message.ofL10n("issue.manual.missing_rule"));
      } else {
        ruleKey = RuleKey.parse(rule);
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

      .setExampleValue("squid:XPath_1402065390816");
  }

  @Override
  public void handle(Request request, Response response) {
    RuleKey key = RuleKey.parse(request.mandatoryParam(PARAM_KEY));
    service.delete(key);
  }
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

        } else if (StringUtils.equals("parameters", nodeName)) {
          SMInputCursor propsCursor = ruleCursor.childElementCursor("parameter");
          readParameters(propsCursor, parameters);
        }
      }
      RuleKey ruleKey = RuleKey.of(repositoryKey, key);
      RuleActivation activation = new RuleActivation(ruleKey);
      activation.setSeverity(severity);
      activation.setParameters(parameters);
      activations.add(activation);
    }
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

      .setDefaultValue(false);
  }

  @Override
  public void handle(Request request, Response response) {
    RuleKey key = RuleKey.parse(request.mandatoryParam(PARAM_KEY));
    Rule rule = service.getByKey(key);
    if (rule == null) {
      throw new NotFoundException("Rule not found: " + key);
    }
    JsonWriter json = response.newJsonWriter().beginObject().name("rule");
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    service.update(update);
    writeResponse(response, update.getRuleKey());
  }

  private RuleUpdate readRequest(Request request) {
    RuleKey key = RuleKey.parse(request.mandatoryParam(PARAM_KEY));
    RuleUpdate update = createRuleUpdate(key);
    readTags(request, update);
    readMarkdownNote(request, update);
    readDebt(request, update);
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

      Integer templateId = rule.getTemplateId();
      String templateKeyFieldValue = null;
      if (templateId != null) {
        RuleDto templateRule = db.ruleDao().getById(session, templateId);
        if (templateRule != null) {
          RuleKey templateKey = templateRule.getKey();
          templateKeyFieldValue = templateKey != null ? templateKey.toString() : null;
        }
      }
      update.put(RuleField.TEMPLATE_KEY.field(), templateKeyFieldValue);

      // TODO Legacy ID in DTO should be Key
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    assertThat(profile).isNotNull();

    // Check ActiveRules in DB
    ActiveRuleDao activeRuleDao = dbClient().activeRuleDao();
    assertThat(activeRuleDao.findByProfileKey(dbSession, profile.getKey())).hasSize(2);
    RuleKey ruleKey = RuleKey.of("xoo", "x1");
    ActiveRuleKey activeRuleKey = ActiveRuleKey.of(profile.getKey(), ruleKey);

    // 0. Check and clear ES
    assertThat(tester.get(ActiveRuleIndex.class).getNullableByKey(activeRuleKey)).isNotNull();
    tester.clearIndexes();
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    verifyProperty("sonar.profile.xoo", "Basic");

    // Check ActiveRules in DB
    ActiveRuleDao activeRuleDao = dbClient().activeRuleDao();
    assertThat(activeRuleDao.findByProfileKey(dbSession, profile.getKey())).hasSize(2);
    RuleKey ruleKey = RuleKey.of("xoo", "x1");

    ActiveRuleDto activeRule = activeRuleDao.getNullableByKey(dbSession, ActiveRuleKey.of(profile.getKey(), ruleKey));
    assertThat(activeRule.getKey().qProfile()).isEqualTo(profile.getKey());
    assertThat(activeRule.getKey().ruleKey()).isEqualTo(ruleKey);
    assertThat(activeRule.getSeverityString()).isEqualTo(Severity.CRITICAL);
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

  @Test
  public void insert_and_index_active_rule() {
    QualityProfileDto profileDto = QProfileTesting.newXooP1();
    db.qualityProfileDao().insert(dbSession, profileDto);
    RuleKey ruleKey = RuleTesting.XOO_X1;
    RuleDto ruleDto = newRuleDto(ruleKey);
    db.ruleDao().insert(dbSession, ruleDto);

    ActiveRuleDto activeRule = ActiveRuleDto.createFor(profileDto, ruleDto)
      .setInheritance(ActiveRule.Inheritance.INHERITED.name())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.