Skip to content

Conversation

@vdiez
Copy link
Contributor

@vdiez vdiez commented Dec 9, 2025

No description provided.

@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Dec 9, 2025

JS-937

Copy link
Contributor

@zglicz zglicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Just a few comments.

Image

import { analyzeFileHandler } from './service.js';
import { info, error as logError } from '../../shared/src/helpers/logging.js';

const DEFAULT_PORT = 50051;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 50051? when in Docker you have 3000?

import { info, error as logError } from '../../shared/src/helpers/logging.js';

const DEFAULT_PORT = 50051;
const SERVICE_NAME = 'analyzer.LanguageAnalyzerService';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not something more specific to Js/Ts or Web?

Comment on lines +38 to +44
// Transform gRPC request to analyzeProject input
const projectInput = transformRequestToProjectInput(request);

// Call the existing analyzeProject function
const projectOutput = await analyzeProject(projectInput);

// Transform the output back to gRPC response format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm... due to the use of nicely named methods, these comments seem superfluous

}

const parts = filePaths.map(p => p.split('/'));
const minLength = Math.min(...parts.map(p => p.length));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I didn't know this, I'd assume Math.min(arr) is fine :(

const filePaths: string[] = [];

for (const sourceFile of sourceFiles) {
const relativePath = sourceFile.relativePath ?? '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm... seems you get a relative path here? You no trust it?

}

// Add rule for both JS and TS to support both languages
for (const language of ['js', 'ts'] as const) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to check this together with the rspec data to make sure for which language a rule should be enabled?

}

return {
id: `${issue.ruleId}:${filePath}:${issue.line}:${issue.column}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impressive

Comment on lines +91 to +99
const params = activeRule.params || [];
if (params.length > 0) {
const paramsObj: Record<string, unknown> = {};
for (const param of params) {
// Try to parse numeric values
const numValue = Number(param.value);
paramsObj[param.key ?? ''] = !isNaN(numValue) ? numValue : param.value;
}
configurations.push(paramsObj);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this I'm also a bit curious if it'll work


const stylelintPkgJson = readFileSync('node_modules/stylelint/package.json', 'utf8');

await esbuild.build({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good if we could have a shared object for esbuild defaults and here we wouldn't need to copy-paste and maintain in 2 places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants