private void handleIssueTag()

in fxcop-agent/src/jetbrains/buildServer/fxcop/agent/FxCopFileProcessor.java [167:240]


  private void handleIssueTag() {
    if (myCurrentPass != PassType.ISSUES) {
      return;
    }

    InspectionInstance info = new InspectionInstance();

    final String path = myStream.getAttribute("Path");
    final String file = myStream.getAttribute("File");
    final String line = myStream.getAttribute("Line");
    final String level = myStream.getAttribute("Level");

    String inspectionMessage = reformatInOneLine(myStream.getValue());
    if (!myCurrentEntity.isEmpty()) {
      if (myCurrentEntity.peek() == EntityType.MEMBER) {
        inspectionMessage += " (" + myCurrentMember + ")";
      } else if (myCurrentEntity.peek() == EntityType.ACCESSOR) {
        inspectionMessage += " (" + myCurrentAccessor + ")";
      }
    }
    info.setMessage(inspectionMessage);

    String inspectionFile = getEntitySpec();
    if (!StringUtil.isEmptyOrSpaces(file)) {
      if (StringUtil.isEmptyOrSpaces(path)) {
        inspectionFile += " :: " + file;
      } else {
        String reportPath = path.replace('\\', '/');

        if (reportPath.toLowerCase().startsWith(mySourceFilePrefixLower)) {
          reportPath = reportPath.substring(mySourceFilePrefixLower.length());
        }

        reportPath = reportPath.replace('/', '|').replace("\\", "|");
        if (reportPath.startsWith("|")) {
          reportPath = reportPath.substring(1);
        }

        if (reportPath.length() > 0) {
          inspectionFile += " :: " + reportPath + "|" + file;
        } else {
          inspectionFile += " :: " + file;
        }
      }
    }
    info.setFilePath(inspectionFile);

    if (StringUtil.isEmptyOrSpaces(line)) {
      info.setLine(0);
    } else {
      info.setLine(Integer.parseInt(line));
    }

    if (!StringUtil.isEmptyOrSpaces(level)) {
      final InspectionSeverityValues apiLevel = convertLevel(level);

      if (apiLevel == InspectionSeverityValues.ERROR) {
        myErrorsCount++;
      }

      if (apiLevel == InspectionSeverityValues.WARNING) {
        myWarningsCount++;
      }

      info.addAttribute(InspectionAttributesId.SEVERITY.toString(), Collections.singleton(apiLevel.toString()));
    }

    if (myMessageInspectionId.isEmpty()){
      throw new IllegalArgumentException("No current message inspection ID while processing entry: path: '" + path + "', file: '" + file + "'. Broken report?");
    }
    info.setInspectionId(myMessageInspectionId.peek());

    myReporter.reportInspection(info);
  }