MCPcopy Index your code
hub / github.com/angular/angular-cli / isWarningEnabled

Function isWarningEnabled

packages/angular/cli/src/utilities/config.ts:388–420  ·  view source on GitHub ↗
(warning: string)

Source from the content-addressed store, hash-verified

386}
387
388export async function isWarningEnabled(warning: string): Promise<boolean> {
389 const getWarning = (source: json.JsonValue | undefined): boolean | undefined => {
390 if (isJsonObject(source)) {
391 const warnings = source['warnings'];
392 if (isJsonObject(warnings)) {
393 const value = warnings[warning];
394 if (typeof value == 'boolean') {
395 return value;
396 }
397 }
398 }
399 };
400
401 let result: boolean | undefined;
402
403 const workspace = await getWorkspace('local');
404 if (workspace) {
405 const project = getProjectByCwd(workspace);
406 if (project) {
407 result = getWarning(workspace.projects.get(project)?.extensions['cli']);
408 }
409
410 result = result ?? getWarning(workspace.extensions['cli']);
411 }
412
413 if (result === undefined) {
414 const globalOptions = await getWorkspace('global');
415 result = getWarning(globalOptions?.extensions['cli']);
416 }
417
418 // All warnings are enabled by default
419 return result ?? true;
420}

Callers 1

init.tsFile · 0.90

Calls 4

getProjectByCwdFunction · 0.85
getWarningFunction · 0.85
getWorkspaceFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected