Skip to content

Commit

Permalink
build(deps-dev): bump prettier from 2.8.8 to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
paambaati authored Aug 31, 2023
2 parents dccbca6 + 77e4c3b commit c2b6229
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 81 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@types/sinon": "10.0.14",
"@types/tape": "4.13.4",
"nock": "13.3.1",
"prettier": "2.8.8",
"prettier": "3.0.0",
"semantic-release-export-data": "1.0.1",
"sinon": "15.2.0",
"tape": "5.6.3",
Expand Down
52 changes: 26 additions & 26 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const FILE_ARTIFACTS = new Set<string>();
export async function downloadAndRecord(
url: string,
file: string,
mode?: number
mode?: number,
): Promise<void> {
await downloadToFile(url, file, mode);
FILE_ARTIFACTS.add(file);
Expand Down Expand Up @@ -90,7 +90,7 @@ function prepareEnv() {
export async function verifyChecksumAndSignature(
downloadUrl: string = DOWNLOAD_URL,
executablePath: string = EXECUTABLE,
algorithm: string = 'sha256'
algorithm: string = 'sha256',
): Promise<void> {
const checksumUrl = `${downloadUrl}.${algorithm}`;
const checksumFilePath = `${executablePath}.${algorithm}`;
Expand All @@ -104,7 +104,7 @@ export async function verifyChecksumAndSignature(
const checksumVerified = await verifyChecksum(
executablePath,
checksumFilePath,
algorithm
algorithm,
);
if (!checksumVerified)
throw new Error('CC Reporter checksum does not match!');
Expand All @@ -120,12 +120,12 @@ export async function verifyChecksumAndSignature(
await downloadAndRecord(signatureUrl, signatureFilePath);
await downloadAndRecord(
CODECLIMATE_GPG_PUBLIC_KEY_URL,
ccPublicKeyFilePath
ccPublicKeyFilePath,
);
const signatureVerified = await verifySignature(
checksumFilePath,
signatureFilePath,
ccPublicKeyFilePath
ccPublicKeyFilePath,
);
if (!signatureVerified)
throw new Error('CC Reporter GPG signature is invalid!');
Expand All @@ -138,7 +138,7 @@ export async function verifyChecksumAndSignature(
}

async function getLocationLines(
coverageLocationPatternsParam: string
coverageLocationPatternsParam: string,
): Promise<Array<string>> {
const coverageLocationPatternsLines = coverageLocationPatternsParam
.split(/\r?\n/)
Expand All @@ -153,14 +153,14 @@ async function getLocationLines(
const globber = await glob.create(pattern);
const paths = await globber.glob();
const pathsWithFormat = paths.map(
(singlePath) => `${singlePath}:${format}`
(singlePath) => `${singlePath}:${format}`,
);
return pathsWithFormat;
})
}),
);

const coverageLocationLines = ([] as Array<string>).concat(
...pathsWithFormat
...pathsWithFormat,
);

return coverageLocationLines;
Expand All @@ -174,7 +174,7 @@ export function run(
codeClimateDebug: string = DEFAULT_CODECLIMATE_DEBUG,
coverageLocationsParam: string = DEFAULT_COVERAGE_LOCATIONS,
coveragePrefix?: string,
verifyDownload: string = DEFAULT_VERIFY_DOWNLOAD
verifyDownload: string = DEFAULT_VERIFY_DOWNLOAD,
): Promise<void> {
return new Promise(async (resolve, reject) => {
let lastExitCode = 1;
Expand All @@ -200,7 +200,7 @@ export function run(
setFailed('🚨 CC Reporter download failed!');
warning(`Could not download ${downloadUrl}`);
warning(
`Please check if your platform is supported — see https://docs.codeclimate.com/docs/configuring-test-coverage#section-locations-of-pre-built-binaries`
`Please check if your platform is supported — see https://docs.codeclimate.com/docs/configuring-test-coverage#section-locations-of-pre-built-binaries`,
);
return reject(err);
}
Expand All @@ -220,7 +220,7 @@ export function run(
lastExitCode = await exec(executable, ['before-build'], execOpts);
if (lastExitCode !== 0) {
throw new Error(
`Coverage after-build exited with code ${lastExitCode}`
`Coverage after-build exited with code ${lastExitCode}`,
);
}
debug('✅ CC Reporter before-build checkin completed...');
Expand All @@ -244,7 +244,7 @@ export function run(
}
} else {
info(
`ℹ️ 'coverageCommand' not set, so skipping building coverage report!`
`ℹ️ 'coverageCommand' not set, so skipping building coverage report!`,
);
}

Expand All @@ -253,24 +253,24 @@ export function run(
debug(
`Parsing ${
coverageLocations.length
} coverage location(s) — ${coverageLocations} (${typeof coverageLocations})`
} coverage location(s) — ${coverageLocations} (${typeof coverageLocations})`,
);
// Run format-coverage on each location.
const parts: Array<string> = [];
for (const i in coverageLocations) {
const { format: type, pattern: location } = parsePathAndFormat(
coverageLocations[i]
coverageLocations[i],
);
if (!type) {
const err = new Error(`Invalid formatter type ${type}`);
debug(
`⚠️ Could not find coverage formatter type! Found ${
coverageLocations[i]
} (${typeof coverageLocations[i]})`
} (${typeof coverageLocations[i]})`,
);
error(err.message);
setFailed(
'🚨 Coverage formatter type not set! Each coverage location should be of the format <file_path>:<coverage_format>'
'🚨 Coverage formatter type not set! Each coverage location should be of the format <file_path>:<coverage_format>',
);
return reject(err);
}
Expand All @@ -293,7 +293,7 @@ export function run(
lastExitCode = await exec(executable, commands, execOpts);
if (lastExitCode !== 0) {
throw new Error(
`Coverage formatter exited with code ${lastExitCode}`
`Coverage formatter exited with code ${lastExitCode}`,
);
}
} catch (err) {
Expand All @@ -318,7 +318,7 @@ export function run(
lastExitCode = await exec(executable, sumCommands, execOpts);
if (lastExitCode !== 0) {
throw new Error(
`Coverage sum process exited with code ${lastExitCode}`
`Coverage sum process exited with code ${lastExitCode}`,
);
}
} catch (err) {
Expand Down Expand Up @@ -354,7 +354,7 @@ export function run(
lastExitCode = await exec(executable, commands, execOpts);
if (lastExitCode !== 0) {
throw new Error(
`Coverage after-build exited with code ${lastExitCode}`
`Coverage after-build exited with code ${lastExitCode}`,
);
}
debug('✅ CC Reporter after-build checkin completed!');
Expand All @@ -371,24 +371,24 @@ export function run(
if (require.main === module) {
const coverageCommand = getOptionalString(
'coverageCommand',
DEFAULT_COVERAGE_COMMAND
DEFAULT_COVERAGE_COMMAND,
);
const workingDirectory = getOptionalString(
'workingDirectory',
DEFAULT_WORKING_DIRECTORY
DEFAULT_WORKING_DIRECTORY,
);
const codeClimateDebug = getOptionalString(
'debug',
DEFAULT_CODECLIMATE_DEBUG
DEFAULT_CODECLIMATE_DEBUG,
);
const coverageLocations = getOptionalString(
'coverageLocations',
DEFAULT_COVERAGE_LOCATIONS
DEFAULT_COVERAGE_LOCATIONS,
);
const coveragePrefix = getOptionalString('prefix');
const verifyDownload = getOptionalString(
'verifyDownload',
DEFAULT_VERIFY_DOWNLOAD
DEFAULT_VERIFY_DOWNLOAD,
);
try {
run(
Expand All @@ -399,7 +399,7 @@ if (require.main === module) {
codeClimateDebug,
coverageLocations,
coveragePrefix,
verifyDownload
verifyDownload,
);
} catch (err) {
throw err;
Expand Down
18 changes: 9 additions & 9 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const getOptionalString = (name: string, defaultValue = '') =>
*/
export const areObjectsEqual = (
obj1: object | [],
obj2: object | []
obj2: object | [],
): boolean => JSON.stringify(obj1) === JSON.stringify(obj2);

/**
Expand All @@ -41,7 +41,7 @@ export const areObjectsEqual = (
export function downloadToFile(
url: string,
file: string,
mode: number = 0o755
mode: number = 0o755,
): Promise<void> {
return new Promise(async (resolve, reject) => {
try {
Expand All @@ -52,7 +52,7 @@ export function downloadToFile(
});
if (response.status < 200 || response.status > 299) {
throw new Error(
`Download of '${url}' failed with response status code ${response.status}`
`Download of '${url}' failed with response status code ${response.status}`,
);
}
const writer = createWriteStream(file, { mode });
Expand All @@ -75,7 +75,7 @@ export function downloadToFile(
*/
export async function getFileContents(
filePath: string,
options?: ReadFileAsyncOptions
options?: ReadFileAsyncOptions,
): Promise<Buffer> {
return await readFileAsync(filePath, options);
}
Expand All @@ -89,7 +89,7 @@ export async function getFileContents(
*/
export async function getFileContentsAsString(
filePath: string,
options?: ReadFileAsyncOptions
options?: ReadFileAsyncOptions,
): Promise<string> {
return (await getFileContents(filePath, options)).toString('utf8');
}
Expand All @@ -103,7 +103,7 @@ export async function getFileContentsAsString(
*/
export async function getFileChecksum(
filePath: string,
algorithm: string = 'sha256'
algorithm: string = 'sha256',
): Promise<string> {
const fileContents = await getFileContents(filePath);
return createHash(algorithm).update(fileContents).digest('hex');
Expand All @@ -123,7 +123,7 @@ export async function getFileChecksum(
export async function verifyChecksum(
originalFile: string,
checksumFile: string,
algorithm: string = 'sha256'
algorithm: string = 'sha256',
): Promise<boolean> {
const binaryChecksum = await getFileChecksum(originalFile, algorithm);
const declaredChecksumFileContents = await getFileContents(checksumFile);
Expand All @@ -134,7 +134,7 @@ export async function verifyChecksum(
try {
return timingSafeEqual(
Buffer.from(binaryChecksum),
Buffer.from(declaredChecksum)
Buffer.from(declaredChecksum),
);
} catch {
// Fail on other errors that can definitely cause the comparison to fail, including
Expand All @@ -154,7 +154,7 @@ export async function verifyChecksum(
export async function verifySignature(
messageFilePath: string,
signatureFilePath: string,
publicKeyFilePath: string
publicKeyFilePath: string,
): Promise<boolean> {
const messageText = await getFileContentsAsString(messageFilePath);
const signatureBuffer = await getFileContents(signatureFilePath);
Expand Down
4 changes: 2 additions & 2 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ test.skip(
`::debug::✅ CC Reported GPG signature verification completed...`,
``,
].join(EOL),
'should download the reporter and correctly pass checksum and signature verification steps.'
'should download the reporter and correctly pass checksum and signature verification steps.',
);
t.end();
}
},
);
Loading

0 comments on commit c2b6229

Please sign in to comment.