export async function publishOutput()

in gitlab/src/output.ts [37:88]


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}`),
      true
    )

    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
    )
    if (postComment) {
      await postResultsToPRComments(
        toolName,
        sourceDir,
        problems.summary,
        problemsDescriptions.length != 0,
        postComment
      )
    }
  } catch (e) {
    console.error((e as Error).message)
  }
}