Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* By default all hints get configured with `default` so they can
* decide the severity of each report unless it's overriden by the
* user.
*/
const finalSeverity = this.severity !== Severity.default ?
this.severity :
severity;
/*
* If location is undefined or equal to null, `position` will be set as `{ column: -1, line: -1 }` later in `hint.report`.
* So pass the `location` on as it is.
*/
this.engine.report({
category: (this.meta && this.meta.docs && this.meta.docs.category) ? this.meta.docs.category : Category.other,
codeLanguage: options.codeLanguage,
hintId: this.id,
location: position || { column: -1, line: -1 },
message,
resource,
severity: finalSeverity,
sourceCode: codeSnippet || sourceCode || ''
});
}private getHintCategory(hint: IHintConstructor): string {
return hint.meta.docs && hint.meta.docs.category || Category.other;
}public constructor(hintData: inquirer.Answers, parentName?: string) {
this.name = hintData.name;
this.normalizedName = normalizeStringByDelimiter(hintData.name, '-');
this.className = `${parentName ? toPascalCase(parentName) : ''}${toPascalCase(this.normalizedName)}Hint`;
this.category = hintData.category || Category.other;
this.description = escapeSafeString(hintData.description);
this.elementType = hintData.elementType;
this.events = getEventsByUseCase(hintData.useCase);
this.useCase[hintData.useCase] = true;
this.scope = hintData.scope;
this.parentName = parentName || '';
}
}return [...new Set(metas.map((meta) => {
return (meta.docs && meta.docs.category || Category.other);
}))].sort();
};const categoriesArray: string[] = resources.hints.map((hint) => {
if (hint.meta.docs && hint.meta.docs.category) {
return hint.meta.docs.category;
}
return Category.other;
});