export async function publishOutput()

in vsts/src/output.ts [62:117]


export async function publishOutput(
  projectDir: string,
  sourceDir: string,
  resultsDir: string,
  postComment: boolean,
  isPrMode: boolean,
  execute: boolean
): Promise<void> {
  if (!execute) {
    return
  }
  try {
    const problems = parseSarif(
      `${resultsDir}/${QODANA_SARIF_NAME}`,
      getQodanaHelpString()
    )
    const reportUrl = getReportURL(resultsDir)
    const coverageInfo = getCoverageStats(
      getCoverageFromSarif(`${resultsDir}/${QODANA_SHORT_SARIF_NAME}`),
      false
    )

    const licensesInfo = getLicenseInfo(resultsDir)

    const problemsDescriptions = problems.problemDescriptions ?? []
    const toolName = problems.title.split('found by ')[1] ?? QODANA_CHECK_NAME
    problems.summary = getSummary(
      toolName,
      projectDir,
      sourceDir,
      problemsDescriptions,
      coverageInfo,
      licensesInfo.packages,
      licensesInfo.licenses,
      reportUrl,
      isPrMode,
      DEPENDENCY_CHARS_LIMIT,
      VIEW_REPORT_OPTIONS
    )

    postSummary(problems.summary)
    await postResultsToPRComments(
      toolName,
      sourceDir,
      problems.summary,
      problemsDescriptions.length != 0,
      postComment
    )
  } catch (error) {
    tl.warning(
      `Qodana has problems with publishing results to Azure – ${
        (error as Error).message
      }`
    )
  }
}