@Override
  public void executeOn(Project project, SensorContext context) {
    System.out.println("ListAllIssuesPostJob");

    // all open issues
    for (Issue issue : projectIssues.issues()) {
      String ruleKey = issue.ruleKey().toString();
      Integer issueLine = issue.line();
      String severity = issue.severity();
      boolean isNew = issue.isNew();

      // just to illustrate, we dump some fields of the 'issue' in sysout (bad, very bad)
      System.out.println(ruleKey + " : " + issue.componentKey() + "(" + issueLine + ")");
      System.out.println("isNew: " + isNew + " | severity: " + severity);
    }

    // all resolved issues
    for (Issue issue : projectIssues.resolvedIssues()) {
      String ruleKey = issue.ruleKey().toString();
      Integer issueLine = issue.line();
      boolean isNew = issue.isNew();

      System.out.println(ruleKey + " : " + issue.componentKey() + "(" + issueLine + ")");
      System.out.println("isNew: " + isNew + " | resolution: " + issue.resolution());
    }
  }
  /** Create issue report according to issue list generated during SonarQube analysis. */
  public static SonarQubeIssuesReport extractIssueReport(
      ProjectIssues projectIssues, InputFileCache inputFileCache, File projectBaseDir) {
    SonarQubeIssuesReport result = new SonarQubeIssuesReport();

    for (Issue issue : projectIssues.issues()) {
      if (!issue.isNew()) {
        LOGGER.debug("Issue {} is not a new issue and so, not added to the report", issue.key());
      } else {
        String key = issue.key();
        String severity = issue.severity();
        String rule = issue.ruleKey().toString();
        String message = issue.message();

        int line = 0;
        if (issue.line() != null) {
          line = issue.line();
        }

        InputFile inputFile = inputFileCache.getInputFile(issue.componentKey());
        if (inputFile == null) {
          LOGGER.debug("Issue {} is not linked to a file, not added to the report", issue.key());
        } else {
          String path = new PathResolver().relativePath(projectBaseDir, inputFile.file());

          // Create the issue and Add to report
          SonarQubeIssue stashIssue = new SonarQubeIssue(key, severity, message, rule, path, line);
          result.add(stashIssue);
        }
      }
    }

    return result;
  }