Skip to content

Commit 827e98e

Browse files
fix property
1 parent f711212 commit 827e98e

File tree

2 files changed

+24
-28
lines changed

2 files changed

+24
-28
lines changed

src/checker.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -316,17 +316,25 @@ export class SyntaxChecker {
316316
}
317317

318318
/**
319-
* Check if variant has errors
319+
* Check if variant has any issues (malformations, parameter errors, type mismatches)
320320
* @param variant - Parsed variant object
321-
* @param params - Actual parameter array
322-
* @param actualParamNames - Array of actual parameter names
323-
* @returns True if variant has errors or malformation at current warning level
321+
* @param params - Actual parameter array (can be empty/undefined)
322+
* @param actualParamNames - Array of actual parameter names (can be empty)
323+
* @returns True if variant has any issues at current warning level
324324
*/
325-
hasVariantErrors(variant: ParsedVariant, params: DocumentationParameter[], actualParamNames: string[]): boolean {
325+
private hasVariantIssues(variant: ParsedVariant, params: DocumentationParameter[] = [], actualParamNames: string[] = []): boolean {
326+
// Always check for malformations first
327+
const hasMalformation = this.hasRelevantMalformation(variant);
328+
329+
// Only check parameter errors if we have params to validate against
330+
if (params.length === 0) {
331+
return hasMalformation;
332+
}
333+
326334
const { extraParams, typeMismatches, returnTypeMismatches } = this.validateVariantParameters(variant, params, actualParamNames);
327335
const hasParameterErrors = extraParams.length > 0 || typeMismatches.length > 0 || returnTypeMismatches.length > 0;
328-
const hasMalformation = this.hasRelevantMalformation(variant);
329-
return hasParameterErrors || hasMalformation;
336+
337+
return hasMalformation || hasParameterErrors;
330338
}
331339

332340
/**
@@ -392,24 +400,14 @@ export class SyntaxChecker {
392400

393401
// Check if there are any errors/warnings
394402
let hasErrors = false;
403+
const actualParamNames = params && params.length > 0 ? this.extractActualParamNames(params) : [];
395404

396-
if (params && params.length > 0) {
397-
const actualParamNames = this.extractActualParamNames(params);
398-
399-
// Check each parsed variant for errors
400-
parsedParams.forEach((variant) => {
401-
if (this.hasVariantErrors(variant, params, actualParamNames)) {
402-
hasErrors = true;
403-
}
404-
});
405-
} else {
406-
// Even without params, check for malformations
407-
parsedParams.forEach((variant) => {
408-
if (this.hasRelevantMalformation(variant)) {
409-
hasErrors = true;
410-
}
411-
});
412-
}
405+
// Check each parsed variant for issues (malformations and parameter errors)
406+
parsedParams.forEach((variant) => {
407+
if (this.hasVariantIssues(variant, params, actualParamNames)) {
408+
hasErrors = true;
409+
}
410+
});
413411

414412
// Only show full output if there are errors
415413
if (hasErrors) {

src/malformation-checker.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,12 @@ export class MalformationChecker {
141141
}
142142
}
143143

144+
// If no parentheses found, this is a property (valid syntax without parameters)
144145
if (paramStart === -1) {
145-
structuralIssues.push({
146-
message: 'Missing opening parenthesis',
147-
level: WarningLevel.LEVEL_1
148-
});
149146
return { paramString: null, paramEnd: -1, issues: structuralIssues };
150147
}
151148

149+
// If opening parenthesis found but no closing parenthesis, that's an error
152150
if (paramEnd === -1) {
153151
structuralIssues.push({
154152
message: 'Missing closing parenthesis',

0 commit comments

Comments
 (0)