If your question is about SonarLint in the IntelliJ Platform, VS Code, Visual Studio, or Eclipse, please post it in that sub-category.
Otherwise, please provide:
- Operating system: Linux 3.10.0-693.2.2.el7.x86_64 amd64 in docker container
- IDE name and flavor/env:
Analyzing on SonarQube server 9.9.4.87374
SonarScanner 5.0.1.3006
Java 17.0.8 Alpine (64-bit)
Using Node.js v18.17.1 to analyse frontend project
And a thorough description of the problem / question:
-
After “starting eslint-bridge server”, and after “Using generated tsconfig.json file”, and after “1 source file to be analyzed”, did not have any progress now, util it met timeout after 1h default setting. ( the logs will be displayed below)
-
If it’s OK, the next step, the next line of logs, should be “Initializing linter “default” with no-vue-bypass-sanitization,hashing…”
and this statement should be run in entrance of the method “initializeLinter”.
so the initializeLinter did not be invoked ?
the “analyzeProject” method, Analyzes a JavaScript / TypeScript project in a single run, will invoking the “initializeLinter”,
the worker’s listener, on “message” event, will invoke “analyzeProject” method on “on-analyze-project”.
/** Endpoints running on the worker thread */
router.post(‘/analyze-project’, delegate(worker, ‘on-analyze-project’));
SO, it’s a worker issue when “'on-analyze-project”?? thanks very much.
AND it works fine in local env, only not good in docker runner.
issue logs
10:40:52.362 DEBUG: starting eslint-bridge server at port 35274
54410:40:52.374 DEBUG: eslint-bridge server is running at port 35274
54510:40:52.484 DEBUG: Starting server (done) | time=3952ms
54610:40:52.493 DEBUG: Using generated tsconfig.json file /builds/VqpwAmze/0/tngd-mobile/tngd-web/create-vue-app/.scannerwork/.sonartmp/13807168856129191333.tmp
54710:40:52.497 DEBUG: Analysis of unchanged files will not be skipped (current analysis requires all files to be analyzed)
54810:40:52.498 INFO: 1 source file to be analyzed
550ERROR: Job failed: execution took longer than 1h0m0s seconds
> > ```
export function initializeLinter(
inputRules: RuleConfig[],
environments: string[] = [],
globals: string[] = [],
linterId = 'default',
) {
debug(`Initializing linter "${linterId}" with ${inputRules.map(rule => rule.key)}`);
linters[linterId] = new LinterWrapper({ inputRules, environments, globals });
}
/**
* Analyzes a JavaScript / TypeScript project in a single run
*
* @param input the JavaScript / TypeScript project to analyze
* @returns the JavaScript / TypeScript project analysis output
*/
export async function analyzeProject(input: ProjectAnalysisInput): Promise<ProjectAnalysisOutput> {
const {
rules,
baseDir,
environments = DEFAULT_ENVIRONMENTS,
globals = DEFAULT_GLOBALS,
exclusions = [],
isSonarlint = false,
maxFilesForTypeChecking,
} = input;
const inputFilenames = Object.keys(input.files);
const results: ProjectAnalysisOutput = {
files: {},
meta: {
withProgram: false,
withWatchProgram: false,
filesWithoutTypeChecking: [],
programsCreated: [],
},
};
if (!inputFilenames.length) {
return results;
}
const pendingFiles: Set<string> = new Set(inputFilenames);
const watchProgram = input.isSonarlint;
**initializeLinter(rules, environments, globals);**
...
parentThread.on('message', async message => {
try {
...
case 'on-analyze-project': {
const output = await analyzeProject(data);
parentThread.postMessage({ type: 'success', result: JSON.stringify(output) });
break;
}
/** Endpoints running on the worker thread */
router.post('/analyze-project', delegate(worker, 'on-analyze-project'));