Esempio n. 1
0
  public void analyse(Project project, SensorContext context) {
    List<QProfileWithId> profiles = Lists.newArrayList();
    for (String language : fs.languages()) {
      QProfileWithId qProfile = (QProfileWithId) moduleQProfiles.findByLanguage(language);
      if (qProfile != null) {
        dao.updateUsedColumn(qProfile.id(), true);
        profiles.add(qProfile);
      }
    }
    UsedQProfiles used = UsedQProfiles.fromProfiles(profiles);
    Measure detailsMeasure = new Measure(CoreMetrics.QUALITY_PROFILES, used.toJSON());
    context.saveMeasure(detailsMeasure);

    // For backward compatibility
    if (profiles.size() == 1) {
      QProfileWithId qProfile = profiles.get(0);
      Measure measure =
          new Measure(CoreMetrics.PROFILE, qProfile.name()).setValue((double) qProfile.id());
      Measure measureVersion =
          new Measure(CoreMetrics.PROFILE_VERSION, qProfile.version().doubleValue());
      context.saveMeasure(measure);
      context.saveMeasure(measureVersion);
    }
  }
  public boolean shouldExecuteOnProject(final Project project) {

    this.project = project;

    return project.isRoot() && fileSystem.languages().contains(Swift.KEY);
  }