diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f3aadf61e0..825b7a0913 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -## Contributing +# Contributing [fork]: https://github.com/github/codeql-action/fork [pr]: https://github.com/github/codeql-action/compare @@ -37,6 +37,7 @@ As well as the unit tests (see _Common tasks_ above), there are integration test 3. Make your change, add tests, and make sure the tests still pass 4. Push to your fork and [submit a pull request][pr] 5. Pat yourself on the back and wait for your pull request to be reviewed and merged. + If you're a GitHub staff member, you can merge your own PR once it's approved; for external contributors, GitHub staff will merge your PR once it's approved. Here are a few things you can do that will increase the likelihood of your pull request being accepted: diff --git a/lib/fingerprints.js b/lib/fingerprints.js index e1338e17f4..d9a1e3b27f 100644 --- a/lib/fingerprints.js +++ b/lib/fingerprints.js @@ -146,10 +146,10 @@ function locationUpdateCallback(result, location) { result.partialFingerprints.primaryLocationLineHash = hash; } else if (existingFingerprint !== hash) { - core.warning("Calculated fingerprint of " + hash + - " for file " + location.physicalLocation.artifactLocation.uri + - " line " + lineNumber + - ", but found existing inconsistent fingerprint value " + existingFingerprint); + core.warning('Calculated fingerprint of ' + hash + + ' for file ' + location.physicalLocation.artifactLocation.uri + + ' line ' + lineNumber + + ', but found existing inconsistent fingerprint value ' + existingFingerprint); } }; } @@ -164,14 +164,14 @@ function resolveUriToFile(location, artifacts) { location.index < 0 || location.index >= artifacts.length || typeof artifacts[location.index].location !== 'object') { - core.debug('Ignoring location as index "' + location.index + '" is invalid'); + core.debug(`Ignoring location as URI "${location.index}" is invalid`); return undefined; } location = artifacts[location.index].location; } // Get the URI and decode if (typeof location.uri !== 'string') { - core.debug('Ignoring location as uri "' + location.uri + '" is invalid'); + core.debug(`Ignoring location as index "${location.uri}" is invalid`); return undefined; } let uri = decodeURIComponent(location.uri); @@ -181,13 +181,13 @@ function resolveUriToFile(location, artifacts) { uri = uri.substring(fileUriPrefix.length); } if (uri.indexOf('://') !== -1) { - core.debug('Ignoring location URI "' + uri + "' as the scheme is not recognised"); + core.debug(`Ignoring location URI "${uri}" as the scheme is not recognised`); return undefined; } // Discard any absolute paths that aren't in the src root const srcRootPrefix = process.env['GITHUB_WORKSPACE'] + '/'; if (uri.startsWith('/') && !uri.startsWith(srcRootPrefix)) { - core.debug('Ignoring location URI "' + uri + "' as it is outside of the src root"); + core.debug(`Ignoring location URI "${uri}" as it is outside of the src root`); return undefined; } // Just assume a relative path is relative to the src root. @@ -198,7 +198,7 @@ function resolveUriToFile(location, artifacts) { } // Check the file exists if (!fs.existsSync(uri)) { - core.debug("Unable to compute fingerprint for non-existent file: " + uri); + core.debug(`Unable to compute fingerprint for non-existent file: ${uri}`); return undefined; } return uri; @@ -207,6 +207,7 @@ exports.resolveUriToFile = resolveUriToFile; // Compute fingerprints for results in the given sarif file // and return an updated sarif file contents. function addFingerprints(sarifContents) { + var _a, _b; let sarif = JSON.parse(sarifContents); // Gather together results for the same file and construct // callbacks to accept hashes for that file and update the location @@ -217,10 +218,8 @@ function addFingerprints(sarifContents) { for (const result of run.results || []) { // Check the primary location is defined correctly and is in the src root const primaryLocation = (result.locations || [])[0]; - if (!primaryLocation || - !primaryLocation.physicalLocation || - !primaryLocation.physicalLocation.artifactLocation) { - core.debug("Unable to compute fingerprint for invalid location: " + JSON.stringify(primaryLocation)); + if (!((_b = (_a = primaryLocation) === null || _a === void 0 ? void 0 : _a.physicalLocation) === null || _b === void 0 ? void 0 : _b.artifactLocation)) { + core.debug(`Unable to compute fingerprint for invalid location: ${JSON.stringify(primaryLocation)}`); continue; } const filepath = resolveUriToFile(primaryLocation.physicalLocation.artifactLocation, artifacts); diff --git a/lib/fingerprints.js.map b/lib/fingerprints.js.map index d61ab331d4..3b8064b848 100644 --- a/lib/fingerprints.js.map +++ b/lib/fingerprints.js.map @@ -1 +1 @@ -{"version":3,"file":"fingerprints.js","sourceRoot":"","sources":["../src/fingerprints.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsC;AACtC,uCAAyB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AAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAxCD,0CAwCC"} \ No newline at end of file diff --git a/src/fingerprints.ts b/src/fingerprints.ts index b75f11e933..83ab602e13 100644 --- a/src/fingerprints.ts +++ b/src/fingerprints.ts @@ -148,10 +148,10 @@ function locationUpdateCallback(result: any, location: any): hashCallback { if (!existingFingerprint) { result.partialFingerprints.primaryLocationLineHash = hash; } else if (existingFingerprint !== hash) { - core.warning("Calculated fingerprint of " + hash + - " for file " + location.physicalLocation.artifactLocation.uri + - " line " + lineNumber + - ", but found existing inconsistent fingerprint value " + existingFingerprint); + core.warning('Calculated fingerprint of ' + hash + + ' for file ' + location.physicalLocation.artifactLocation.uri + + ' line ' + lineNumber + + ', but found existing inconsistent fingerprint value ' + existingFingerprint); } }; } @@ -167,7 +167,7 @@ export function resolveUriToFile(location: any, artifacts: any[]): string | unde location.index < 0 || location.index >= artifacts.length || typeof artifacts[location.index].location !== 'object') { - core.debug('Ignoring location as index "' + location.index + '" is invalid'); + core.debug(`Ignoring location as URI "${location.index}" is invalid`); return undefined; } location = artifacts[location.index].location; @@ -175,7 +175,7 @@ export function resolveUriToFile(location: any, artifacts: any[]): string | unde // Get the URI and decode if (typeof location.uri !== 'string') { - core.debug('Ignoring location as uri "' + location.uri + '" is invalid'); + core.debug(`Ignoring location as index "${location.uri}" is invalid`); return undefined; } let uri = decodeURIComponent(location.uri); @@ -186,14 +186,14 @@ export function resolveUriToFile(location: any, artifacts: any[]): string | unde uri = uri.substring(fileUriPrefix.length); } if (uri.indexOf('://') !== -1) { - core.debug('Ignoring location URI "' + uri + "' as the scheme is not recognised"); + core.debug(`Ignoring location URI "${uri}" as the scheme is not recognised`); return undefined; } // Discard any absolute paths that aren't in the src root const srcRootPrefix = process.env['GITHUB_WORKSPACE'] + '/'; if (uri.startsWith('/') && !uri.startsWith(srcRootPrefix)) { - core.debug('Ignoring location URI "' + uri + "' as it is outside of the src root"); + core.debug(`Ignoring location URI "${uri}" as it is outside of the src root`); return undefined; } @@ -206,7 +206,7 @@ export function resolveUriToFile(location: any, artifacts: any[]): string | unde // Check the file exists if (!fs.existsSync(uri)) { - core.debug("Unable to compute fingerprint for non-existent file: " + uri); + core.debug(`Unable to compute fingerprint for non-existent file: ${uri}`); return undefined; } @@ -228,10 +228,8 @@ export function addFingerprints(sarifContents: string): string { for (const result of run.results || []) { // Check the primary location is defined correctly and is in the src root const primaryLocation = (result.locations || [])[0]; - if (!primaryLocation || - !primaryLocation.physicalLocation || - !primaryLocation.physicalLocation.artifactLocation) { - core.debug("Unable to compute fingerprint for invalid location: " + JSON.stringify(primaryLocation)); + if (!primaryLocation?.physicalLocation?.artifactLocation) { + core.debug(`Unable to compute fingerprint for invalid location: ${JSON.stringify(primaryLocation)}`); continue; }