How to use the jscpd/build/stores/stores-manager.StoresManager.flush function in jscpd

To help you get started, we’ve selected a few jscpd 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 sourcegraph / sourcegraph / extensions / enterprise / check-search / src / codeDuplication.ts View on Github external
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(

jscpd

detector of copy/paste in files

MIT
Latest version published 6 months ago

Package Health Score

85 / 100
Full package analysis

Similar packages