Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
language: cfg.local || undefined,
});
const { filename, text } = fileInfo;
const info = calcFinalConfigInfo(configInfo, settingsFromCommandLine, filename, text);
const config = info.configInfo.config;
const source = info.configInfo.source;
cfg.debug(`Filename: ${filename}, Extension: ${path.extname(filename)}, LanguageIds: ${info.languageIds.toString()}`);
if (!info.configInfo.config.enabled) return 0;
const debugCfg = { config: {...config, source: null}, source };
cfg.debug(commentJson.stringify(debugCfg, undefined, 2));
const startTime = Date.now();
const wordOffsets = await cspell.validateText(text, info.configInfo.config);
const issues = cspell.Text.calculateTextDocumentOffsets(filename, text, wordOffsets);
const elapsed = (Date.now() - startTime) / 1000.0;
const dictionaries = config.dictionaries || [];
cfg.info(
`Checking: ${filename}, File type: ${config.languageId}, Language: ${config.language} ... Issues: ${issues.length} ${elapsed}S`,
MessageTypes.Info
);
cfg.info(`Dictionaries Used: ${dictionaries.join(', ')}`, MessageTypes.Info);
issues
.filter(cfg.uniqueFilter)
.forEach((issue) => cfg.logIssue(issue));
return issues.length;
}