Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
switchMap(async () => {
StoresManager.close()
StoresManager.flush()
const cpd = new JSCPD({})
const clones: IClone[] = []
for (const doc of docs) {
clones.push(...(await cpd.detect(doc.text, { id: doc.uri, format: jscpdFormat(doc) })))
}
const diagnostics: sourcegraph.Diagnostic[] = clones.map(c => {
const numLines = c.duplicationA.end.line - c.duplicationA.start.line
return {
resource: new URL(c.duplicationA.sourceId),
range: duplicationRange(c.duplicationA),
message: `Duplicated code (${numLines} line${numLines !== 1 ? 's' : ''})`,
source: 'codeDuplication',
severity: sourcegraph.DiagnosticSeverity.Information,
relatedInformation: [
{
location: new sourcegraph.Location(