How to use the @codechecks/client.codechecks.getValue function in @codechecks/client

To help you get started, we’ve selected a few @codechecks/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cgewecke / eth-gas-reporter / codechecks.js View on Github external
console.log(`Successful save: output.namespace was: ${output.namespace}`);
    } catch (err) {
      console.log(
        `If you have a chance, report this incident to the eth-gas-reporter github issues.`
      );
      console.log(`Codechecks errored running 'saveValue'...\n${err}\n`);
      console.log(`output.namespace was: ${output.namespace}`);
      console.log(`Saved gas-reporter data was: ${report.newData}`);
    }

    return;
  }

  // Get historical data for each pr commit
  try {
    output.config.previousData = await codechecks.getValue(output.namespace);
  } catch (err) {
    console.log(
      `If you have a chance, report this incident to the eth-gas-reporter github issues.`
    );
    console.log(`Codechecks errored running 'getValue'...\n${err}\n`);
    return;
  }

  const report = new CodeChecksReport(output.config);
  const table = report.generate(output.info);
  const shortDescription = report.getShortDescription();

  // Submit report
  try {
    await codechecks.success({
      name: "Gas Usage",
github codechecks / build-size-watcher / src / index.ts View on Github external
const artifact: FileArtifact = {
      path: file.path,
      files: matches.length,
      overallSize,
    };

    fullArtifact[file.path] = artifact;
  }

  await codechecks.saveValue(options.artifactName, fullArtifact);

  if (!codechecks.isPr()) {
    return;
  }

  const baseArtifact = await codechecks.getValue(options.artifactName);

  const diff = getArtifactDiff(fullArtifact, baseArtifact);

  const report = getReportFromDiff(diff, options.files, options);
  await codechecks.report(report);
}
github nestjs / nest / tools / benchmarks / check-benchmarks.ts View on Github external
export default async function checkBenchmarks() {
  const currentBenchmarks = await getBenchmarks();
  await codechecks.saveValue(benchmarksKey, currentBenchmarks);

  if (!codechecks.isPr()) {
    return;
  }
  const baselineBenchmarks = await codechecks.getValue(
    benchmarksKey,
  );
  const report = getCodechecksReport(currentBenchmarks, baselineBenchmarks);
  await codechecks.report(report);
}