Exemplo n.º 1
0
  private void bugInCommit(Commit commit) {

    if (markedCommits.contains(commit.getHash())) return;

    int weekDay = commit.getDate().get(Calendar.DAY_OF_WEEK);
    bugPerWeekday.get(weekDay).bug();

    int hour = commit.getDate().get(Calendar.HOUR_OF_DAY);
    bugPerHour.get(hour).bug();

    markedCommits.add(commit.getHash());
  }
Exemplo n.º 2
0
  @Override
  public void process(SCMRepository repo, Commit commit, PersistenceMechanism writer) {

    if (!noKeywordsIn(commit)) return;

    SCM scm = repo.getScm();

    for (Modification modification : commit.getModifications()) {
      if (modification.wasDeleted()) continue;

      String fileName = modification.getFileName();
      if (!Languages.contains(fileName)) continue;
      Language lang = Languages.forFile(fileName);
      if (lang.isTest(fileName)) continue;

      List<Integer> lines = findLinesToBeBlamedIn(modification);
      if (!lines.isEmpty()) {
        bugInFile(modification);
      }

      for (Integer buggedLine : lines) {

        String hash = scm.blame(modification.getNewPath(), commit.getHash(), buggedLine);
        if (hash == null || hash.isEmpty()) continue;

        Commit buggedCommit = scm.getCommit(hash);

        bugInCommit(buggedCommit);
      }
    }
  }