@webpieces/dev-config 0.2.90 → 0.2.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/architecture/executors/validate-code/executor.js +1 -1
- package/architecture/executors/validate-code/executor.js.map +1 -1
- package/architecture/executors/validate-code/executor.ts +1 -1
- package/architecture/executors/validate-code/schema.json +1 -1
- package/architecture/executors/validate-no-direct-api-resolver/executor.d.ts +5 -4
- package/architecture/executors/validate-no-direct-api-resolver/executor.js +167 -3
- package/architecture/executors/validate-no-direct-api-resolver/executor.js.map +1 -1
- package/architecture/executors/validate-no-direct-api-resolver/executor.ts +193 -5
- package/architecture/executors/validate-no-direct-api-resolver/schema.json +2 -2
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ const VALID_MODES = {
|
|
|
21
21
|
validateDtos: ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'],
|
|
22
22
|
prismaConverter: ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],
|
|
23
23
|
noDestructure: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],
|
|
24
|
-
noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],
|
|
24
|
+
noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* Validate that all configured modes are valid. Produces clear error messages naming the rule.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-code/executor.ts"],"names":[],"mappings":";;AAwUA,8BA6EC;;AApZD,wFAAqE;AACrE,6FAA+E;AAC/E,2FAA2E;AAC3E,yFAA2F;AAC3F,4FAAmG;AACnG,2FAAgG;AAChG,iFAAsF;AACtF,8FAA0G;AAC1G,2FAAkG;AAClG,oGAAsH;AAyItH,MAA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D,mBAAmB,CAAC,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC;IAErE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC;IAC/G,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { ExecutorContext } from '@nx/devkit';\nimport runNewMethodsExecutor from '../validate-new-methods/executor';\nimport runModifiedMethodsExecutor from '../validate-modified-methods/executor';\nimport runModifiedFilesExecutor from '../validate-modified-files/executor';\nimport runReturnTypesExecutor, { ReturnTypeMode } from '../validate-return-types/executor';\nimport runNoInlineTypesExecutor, { NoInlineTypesMode } from '../validate-no-inline-types/executor';\nimport runNoAnyUnknownExecutor, { NoAnyUnknownMode } from '../validate-no-any-unknown/executor';\nimport runValidateDtosExecutor, { ValidateDtosMode } from '../validate-dtos/executor';\nimport runPrismaConvertersExecutor, { PrismaConverterMode } from '../validate-prisma-converters/executor';\nimport runNoDestructureExecutor, { NoDestructureMode } from '../validate-no-destructure/executor';\nimport runNoDirectApiResolverExecutor, { NoDirectApiResolverMode } from '../validate-no-direct-api-resolver/executor';\n\nexport type MethodMaxLimitMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';\nexport type FileMaxLimitMode = 'OFF' | 'MODIFIED_FILES';\n\nexport interface MethodMaxLimitConfig {\n limit?: number;\n mode?: MethodMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface FileMaxLimitConfig {\n limit?: number;\n mode?: FileMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface RequireReturnTypeConfig {\n mode?: ReturnTypeMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoInlineTypeLiteralsConfig {\n mode?: NoInlineTypesMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoAnyUnknownConfig {\n mode?: NoAnyUnknownMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface ValidateDtosConfig {\n mode?: ValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface PrismaConverterConfig {\n mode?: PrismaConverterMode;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDestructureConfig {\n mode?: NoDestructureMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDirectApiResolverConfig {\n mode?: NoDirectApiResolverMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n enforcePaths?: string[];\n}\n\nexport interface ValidateCodeOptions {\n methodMaxLimit?: MethodMaxLimitConfig;\n fileMaxLimit?: FileMaxLimitConfig;\n requireReturnType?: RequireReturnTypeConfig;\n noInlineTypeLiterals?: NoInlineTypeLiteralsConfig;\n noAnyUnknown?: NoAnyUnknownConfig;\n validateDtos?: ValidateDtosConfig;\n prismaConverter?: PrismaConverterConfig;\n noDestructure?: NoDestructureConfig;\n noDirectApiInResolver?: NoDirectApiResolverConfig;\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface OverrideInfo {\n active: boolean;\n normalMode: string;\n expiresDate: string;\n}\n\ninterface ParsedConfig {\n methodLimit: number;\n methodMode: MethodMaxLimitMode;\n methodDisableAllowed: boolean;\n methodOverride: OverrideInfo | undefined;\n fileLimit: number;\n fileMode: FileMaxLimitMode;\n fileDisableAllowed: boolean;\n fileOverride: OverrideInfo | undefined;\n returnTypeMode: ReturnTypeMode;\n returnTypeDisableAllowed: boolean;\n returnTypeIgnoreEpoch: number | undefined;\n noInlineTypesMode: NoInlineTypesMode;\n noInlineTypesDisableAllowed: boolean;\n noInlineTypesIgnoreEpoch: number | undefined;\n noAnyUnknownMode: NoAnyUnknownMode;\n noAnyUnknownDisableAllowed: boolean;\n noAnyUnknownIgnoreEpoch: number | undefined;\n validateDtosMode: ValidateDtosMode;\n validateDtosDisableAllowed: boolean;\n validateDtosPrismaPath: string | undefined;\n validateDtosSrcPaths: string[];\n validateDtosIgnoreEpoch: number | undefined;\n prismaConverterMode: PrismaConverterMode;\n prismaConverterDisableAllowed: boolean;\n prismaConverterSchemaPath: string | undefined;\n prismaConverterConvertersPaths: string[];\n prismaConverterEnforcePaths: string[];\n prismaConverterIgnoreEpoch: number | undefined;\n noDestructureMode: NoDestructureMode;\n noDestructureDisableAllowed: boolean;\n noDestructureIgnoreEpoch: number | undefined;\n noDirectApiResolverMode: NoDirectApiResolverMode;\n noDirectApiResolverDisableAllowed: boolean;\n noDirectApiResolverIgnoreEpoch: number | undefined;\n noDirectApiResolverEnforcePaths: string[];\n}\n\ninterface ResolvedMethodMode {\n mode: MethodMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\ninterface ResolvedFileMode {\n mode: FileMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\nconst VALID_MODES: Record<string, string[]> = {\n methodMaxLimit: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n fileMaxLimit: ['OFF', 'MODIFIED_FILES'],\n requireReturnType: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noInlineTypeLiterals: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noAnyUnknown: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n validateDtos: ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'],\n prismaConverter: ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noDestructure: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n};\n\n/**\n * Validate that all configured modes are valid. Produces clear error messages naming the rule.\n */\nfunction validateModes(options: ValidateCodeOptions): string[] {\n const errors: string[] = [];\n\n type ModeEntry = [string, string | undefined];\n const modeEntries: ModeEntry[] = [\n ['methodMaxLimit', options.methodMaxLimit?.mode],\n ['fileMaxLimit', options.fileMaxLimit?.mode],\n ['requireReturnType', options.requireReturnType?.mode],\n ['noInlineTypeLiterals', options.noInlineTypeLiterals?.mode],\n ['noAnyUnknown', options.noAnyUnknown?.mode],\n ['validateDtos', options.validateDtos?.mode],\n ['prismaConverter', options.prismaConverter?.mode],\n ['noDestructure', options.noDestructure?.mode],\n ['noDirectApiInResolver', options.noDirectApiInResolver?.mode],\n ];\n\n for (const [ruleName, modeValue] of modeEntries) {\n if (modeValue === undefined) continue;\n const validModes = VALID_MODES[ruleName];\n if (!validModes.includes(modeValue)) {\n errors.push(`${ruleName}.mode = '${modeValue}' is invalid. Valid modes: ${validModes.join(', ')}`);\n }\n }\n\n return errors;\n}\n\nfunction formatEpochDate(epoch: number): string {\n return new Date(epoch * 1000).toISOString().split('T')[0];\n}\n\nfunction resolveMethodMode(\n normalMode: MethodMaxLimitMode, epoch: number | undefined\n): ResolvedMethodMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: downgrade to skip modified checking\n const downgraded: MethodMaxLimitMode =\n normalMode === 'OFF' ? 'OFF' : 'NEW_METHODS';\n return {\n mode: downgraded,\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction resolveFileMode(\n normalMode: FileMaxLimitMode, epoch: number | undefined\n): ResolvedFileMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: file checking is inherently about modified files, so skip entirely\n return {\n mode: 'OFF',\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction parseConfig(options: ValidateCodeOptions): ParsedConfig {\n const methodConfig: MethodMaxLimitConfig = options.methodMaxLimit ?? {};\n const fileConfig: FileMaxLimitConfig = options.fileMaxLimit ?? {};\n\n const normalMethodMode = methodConfig.mode ?? 'NEW_AND_MODIFIED_METHODS';\n const normalFileMode = fileConfig.mode ?? 'MODIFIED_FILES';\n\n const methodResolved = resolveMethodMode(normalMethodMode, methodConfig.ignoreModifiedUntilEpoch);\n const fileResolved = resolveFileMode(normalFileMode, fileConfig.ignoreModifiedUntilEpoch);\n\n return {\n methodLimit: methodConfig.limit ?? 80,\n methodMode: methodResolved.mode,\n methodDisableAllowed: methodConfig.disableAllowed ?? true,\n methodOverride: methodResolved.override,\n fileLimit: fileConfig.limit ?? 900,\n fileMode: fileResolved.mode,\n fileDisableAllowed: fileConfig.disableAllowed ?? true,\n fileOverride: fileResolved.override,\n returnTypeMode: options.requireReturnType?.mode ?? 'OFF',\n returnTypeDisableAllowed: options.requireReturnType?.disableAllowed ?? true,\n returnTypeIgnoreEpoch: options.requireReturnType?.ignoreModifiedUntilEpoch,\n noInlineTypesMode: options.noInlineTypeLiterals?.mode ?? 'OFF',\n noInlineTypesDisableAllowed: options.noInlineTypeLiterals?.disableAllowed ?? true,\n noInlineTypesIgnoreEpoch: options.noInlineTypeLiterals?.ignoreModifiedUntilEpoch,\n noAnyUnknownMode: options.noAnyUnknown?.mode ?? 'OFF',\n noAnyUnknownDisableAllowed: options.noAnyUnknown?.disableAllowed ?? true,\n noAnyUnknownIgnoreEpoch: options.noAnyUnknown?.ignoreModifiedUntilEpoch,\n validateDtosMode: options.validateDtos?.mode ?? 'OFF',\n validateDtosDisableAllowed: options.validateDtos?.disableAllowed ?? true,\n validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,\n validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],\n validateDtosIgnoreEpoch: options.validateDtos?.ignoreModifiedUntilEpoch,\n prismaConverterMode: options.prismaConverter?.mode ?? 'OFF',\n prismaConverterDisableAllowed: options.prismaConverter?.disableAllowed ?? true,\n prismaConverterSchemaPath: options.prismaConverter?.schemaPath,\n prismaConverterConvertersPaths: options.prismaConverter?.convertersPaths ?? [],\n prismaConverterEnforcePaths: options.prismaConverter?.enforcePaths ?? [],\n prismaConverterIgnoreEpoch: options.prismaConverter?.ignoreModifiedUntilEpoch,\n noDestructureMode: options.noDestructure?.mode ?? 'OFF',\n noDestructureDisableAllowed: options.noDestructure?.disableAllowed ?? true,\n noDestructureIgnoreEpoch: options.noDestructure?.ignoreModifiedUntilEpoch,\n noDirectApiResolverMode: options.noDirectApiInResolver?.mode ?? 'OFF',\n noDirectApiResolverDisableAllowed: options.noDirectApiInResolver?.disableAllowed ?? true,\n noDirectApiResolverIgnoreEpoch: options.noDirectApiInResolver?.ignoreModifiedUntilEpoch,\n noDirectApiResolverEnforcePaths: options.noDirectApiInResolver?.enforcePaths ?? [],\n };\n}\n\nfunction formatOverride(override: OverrideInfo | undefined): string {\n if (!override) {\n return '';\n }\n return ` (override active, normal: ${override.normalMode}, expires: ${override.expiresDate})`;\n}\n\nfunction logConfig(config: ParsedConfig): void {\n console.log('\\n\\ud83d\\udccf Running Code Validations\\n');\n console.log(` Method limits: mode=${config.methodMode}${formatOverride(config.methodOverride)}, limit=${config.methodLimit}, disableAllowed=${config.methodDisableAllowed}`);\n console.log(` File limits: mode=${config.fileMode}${formatOverride(config.fileOverride)}, limit=${config.fileLimit}, disableAllowed=${config.fileDisableAllowed}`);\n console.log(` Require return types: mode=${config.returnTypeMode}, disableAllowed=${config.returnTypeDisableAllowed}`);\n console.log(` No inline type literals: mode=${config.noInlineTypesMode}, disableAllowed=${config.noInlineTypesDisableAllowed}`);\n console.log(` No any/unknown: mode=${config.noAnyUnknownMode}, disableAllowed=${config.noAnyUnknownDisableAllowed}`);\n console.log(` Validate DTOs: mode=${config.validateDtosMode}, disableAllowed=${config.validateDtosDisableAllowed}`);\n console.log(` Prisma converters: mode=${config.prismaConverterMode}, disableAllowed=${config.prismaConverterDisableAllowed}`);\n console.log(` No destructure: mode=${config.noDestructureMode}, disableAllowed=${config.noDestructureDisableAllowed}`);\n console.log(` No direct API in resolver: mode=${config.noDirectApiResolverMode}, disableAllowed=${config.noDirectApiResolverDisableAllowed}`);\n console.log('');\n}\n\nfunction isAllOff(config: ParsedConfig): boolean {\n return config.methodMode === 'OFF' && config.fileMode === 'OFF' &&\n config.returnTypeMode === 'OFF' && config.noInlineTypesMode === 'OFF' &&\n config.noAnyUnknownMode === 'OFF' && config.validateDtosMode === 'OFF' &&\n config.prismaConverterMode === 'OFF' && config.noDestructureMode === 'OFF' &&\n config.noDirectApiResolverMode === 'OFF';\n}\n\nasync function runMethodValidators(config: ParsedConfig, context: ExecutorContext): Promise<ExecutorResult[]> {\n const results: ExecutorResult[] = [];\n const runNew = config.methodMode === 'NEW_METHODS' || config.methodMode === 'NEW_AND_MODIFIED_METHODS';\n const runModified = config.methodMode === 'NEW_AND_MODIFIED_METHODS' || config.methodMode === 'MODIFIED_FILES';\n\n if (runNew) {\n results.push(await runNewMethodsExecutor({\n limit: config.methodLimit,\n mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, context));\n }\n if (runModified) {\n results.push(await runModifiedMethodsExecutor({\n limit: config.methodLimit, mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, context));\n }\n return results;\n}\n\nexport default async function runExecutor(\n options: ValidateCodeOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const modeErrors = validateModes(options);\n if (modeErrors.length > 0) {\n console.error('');\n for (const err of modeErrors) {\n console.error(`❌ ${err}`);\n }\n console.error('');\n return { success: false };\n }\n\n const config = parseConfig(options);\n\n if (isAllOff(config)) {\n console.log('\\n\\u23ed\\ufe0f Skipping all code validations (all modes: OFF)\\n');\n return { success: true };\n }\n\n logConfig(config);\n\n const methodResults = await runMethodValidators(config, context);\n const fileResult = await runModifiedFilesExecutor({\n limit: config.fileLimit, mode: config.fileMode, disableAllowed: config.fileDisableAllowed,\n }, context);\n const returnTypesResult = await runReturnTypesExecutor({\n mode: config.returnTypeMode,\n disableAllowed: config.returnTypeDisableAllowed,\n ignoreModifiedUntilEpoch: config.returnTypeIgnoreEpoch,\n }, context);\n const noInlineTypesResult = await runNoInlineTypesExecutor({\n mode: config.noInlineTypesMode,\n disableAllowed: config.noInlineTypesDisableAllowed,\n ignoreModifiedUntilEpoch: config.noInlineTypesIgnoreEpoch,\n }, context);\n const noAnyUnknownResult = await runNoAnyUnknownExecutor({\n mode: config.noAnyUnknownMode,\n disableAllowed: config.noAnyUnknownDisableAllowed,\n ignoreModifiedUntilEpoch: config.noAnyUnknownIgnoreEpoch,\n }, context);\n const validateDtosResult = await runValidateDtosExecutor({\n mode: config.validateDtosMode,\n disableAllowed: config.validateDtosDisableAllowed,\n prismaSchemaPath: config.validateDtosPrismaPath,\n dtoSourcePaths: config.validateDtosSrcPaths,\n ignoreModifiedUntilEpoch: config.validateDtosIgnoreEpoch,\n }, context);\n const prismaConverterResult = await runPrismaConvertersExecutor({\n mode: config.prismaConverterMode,\n disableAllowed: config.prismaConverterDisableAllowed,\n schemaPath: config.prismaConverterSchemaPath,\n convertersPaths: config.prismaConverterConvertersPaths,\n enforcePaths: config.prismaConverterEnforcePaths,\n ignoreModifiedUntilEpoch: config.prismaConverterIgnoreEpoch,\n }, context);\n const noDestructureResult = await runNoDestructureExecutor({\n mode: config.noDestructureMode,\n disableAllowed: config.noDestructureDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDestructureIgnoreEpoch,\n }, context);\n const noDirectApiResolverResult = await runNoDirectApiResolverExecutor({\n mode: config.noDirectApiResolverMode,\n disableAllowed: config.noDirectApiResolverDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDirectApiResolverIgnoreEpoch,\n enforcePaths: config.noDirectApiResolverEnforcePaths,\n }, context);\n\n const allSuccess = methodResults.every((r) => r.success) &&\n fileResult.success && returnTypesResult.success &&\n noInlineTypesResult.success && noAnyUnknownResult.success &&\n validateDtosResult.success && prismaConverterResult.success &&\n noDestructureResult.success && noDirectApiResolverResult.success;\n\n console.log(allSuccess ? '\\n\\u2705 All code validations passed\\n' : '\\n\\u274c Some code validations failed\\n');\n return { success: allSuccess };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-code/executor.ts"],"names":[],"mappings":";;AAwUA,8BA6EC;;AApZD,wFAAqE;AACrE,6FAA+E;AAC/E,2FAA2E;AAC3E,yFAA2F;AAC3F,4FAAmG;AACnG,2FAAgG;AAChG,iFAAsF;AACtF,8FAA0G;AAC1G,2FAAkG;AAClG,oGAAsH;AAyItH,MAAM,WAAW,GAA6B;IAC1C,cAAc,EAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC1F,YAAY,EAAU,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAC/C,iBAAiB,EAAK,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC1F,oBAAoB,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC1F,YAAY,EAAU,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAC;IAChE,YAAY,EAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,CAAC;IACjE,eAAe,EAAO,CAAC,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;IAC3E,aAAa,EAAS,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAC;IAChE,qBAAqB,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,gBAAgB,CAAC;CAChG,CAAC;AAEF;;GAEG;AACH,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BAAwB,EAAE,MAAM,CAAC,wBAAwB;KAC5D,EAAE,OAAO,CAAC,CAAC;IACZ,MAAM,yBAAyB,GAAG,MAAM,IAAA,mBAA8B,EAAC;QACnE,IAAI,EAAE,MAAM,CAAC,uBAAuB;QACpC,cAAc,EAAE,MAAM,CAAC,iCAAiC;QACxD,wBAAwB,EAAE,MAAM,CAAC,8BAA8B;QAC/D,YAAY,EAAE,MAAM,CAAC,+BAA+B;KACvD,EAAE,OAAO,CAAC,CAAC;IAEZ,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACpD,UAAU,CAAC,OAAO,IAAI,iBAAiB,CAAC,OAAO;QAC/C,mBAAmB,CAAC,OAAO,IAAI,kBAAkB,CAAC,OAAO;QACzD,kBAAkB,CAAC,OAAO,IAAI,qBAAqB,CAAC,OAAO;QAC3D,mBAAmB,CAAC,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC;IAErE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,yCAAyC,CAAC,CAAC;IAC/G,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { ExecutorContext } from '@nx/devkit';\nimport runNewMethodsExecutor from '../validate-new-methods/executor';\nimport runModifiedMethodsExecutor from '../validate-modified-methods/executor';\nimport runModifiedFilesExecutor from '../validate-modified-files/executor';\nimport runReturnTypesExecutor, { ReturnTypeMode } from '../validate-return-types/executor';\nimport runNoInlineTypesExecutor, { NoInlineTypesMode } from '../validate-no-inline-types/executor';\nimport runNoAnyUnknownExecutor, { NoAnyUnknownMode } from '../validate-no-any-unknown/executor';\nimport runValidateDtosExecutor, { ValidateDtosMode } from '../validate-dtos/executor';\nimport runPrismaConvertersExecutor, { PrismaConverterMode } from '../validate-prisma-converters/executor';\nimport runNoDestructureExecutor, { NoDestructureMode } from '../validate-no-destructure/executor';\nimport runNoDirectApiResolverExecutor, { NoDirectApiResolverMode } from '../validate-no-direct-api-resolver/executor';\n\nexport type MethodMaxLimitMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';\nexport type FileMaxLimitMode = 'OFF' | 'MODIFIED_FILES';\n\nexport interface MethodMaxLimitConfig {\n limit?: number;\n mode?: MethodMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface FileMaxLimitConfig {\n limit?: number;\n mode?: FileMaxLimitMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface RequireReturnTypeConfig {\n mode?: ReturnTypeMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoInlineTypeLiteralsConfig {\n mode?: NoInlineTypesMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoAnyUnknownConfig {\n mode?: NoAnyUnknownMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface ValidateDtosConfig {\n mode?: ValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface PrismaConverterConfig {\n mode?: PrismaConverterMode;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDestructureConfig {\n mode?: NoDestructureMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface NoDirectApiResolverConfig {\n mode?: NoDirectApiResolverMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n enforcePaths?: string[];\n}\n\nexport interface ValidateCodeOptions {\n methodMaxLimit?: MethodMaxLimitConfig;\n fileMaxLimit?: FileMaxLimitConfig;\n requireReturnType?: RequireReturnTypeConfig;\n noInlineTypeLiterals?: NoInlineTypeLiteralsConfig;\n noAnyUnknown?: NoAnyUnknownConfig;\n validateDtos?: ValidateDtosConfig;\n prismaConverter?: PrismaConverterConfig;\n noDestructure?: NoDestructureConfig;\n noDirectApiInResolver?: NoDirectApiResolverConfig;\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface OverrideInfo {\n active: boolean;\n normalMode: string;\n expiresDate: string;\n}\n\ninterface ParsedConfig {\n methodLimit: number;\n methodMode: MethodMaxLimitMode;\n methodDisableAllowed: boolean;\n methodOverride: OverrideInfo | undefined;\n fileLimit: number;\n fileMode: FileMaxLimitMode;\n fileDisableAllowed: boolean;\n fileOverride: OverrideInfo | undefined;\n returnTypeMode: ReturnTypeMode;\n returnTypeDisableAllowed: boolean;\n returnTypeIgnoreEpoch: number | undefined;\n noInlineTypesMode: NoInlineTypesMode;\n noInlineTypesDisableAllowed: boolean;\n noInlineTypesIgnoreEpoch: number | undefined;\n noAnyUnknownMode: NoAnyUnknownMode;\n noAnyUnknownDisableAllowed: boolean;\n noAnyUnknownIgnoreEpoch: number | undefined;\n validateDtosMode: ValidateDtosMode;\n validateDtosDisableAllowed: boolean;\n validateDtosPrismaPath: string | undefined;\n validateDtosSrcPaths: string[];\n validateDtosIgnoreEpoch: number | undefined;\n prismaConverterMode: PrismaConverterMode;\n prismaConverterDisableAllowed: boolean;\n prismaConverterSchemaPath: string | undefined;\n prismaConverterConvertersPaths: string[];\n prismaConverterEnforcePaths: string[];\n prismaConverterIgnoreEpoch: number | undefined;\n noDestructureMode: NoDestructureMode;\n noDestructureDisableAllowed: boolean;\n noDestructureIgnoreEpoch: number | undefined;\n noDirectApiResolverMode: NoDirectApiResolverMode;\n noDirectApiResolverDisableAllowed: boolean;\n noDirectApiResolverIgnoreEpoch: number | undefined;\n noDirectApiResolverEnforcePaths: string[];\n}\n\ninterface ResolvedMethodMode {\n mode: MethodMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\ninterface ResolvedFileMode {\n mode: FileMaxLimitMode;\n override: OverrideInfo | undefined;\n}\n\nconst VALID_MODES: Record<string, string[]> = {\n methodMaxLimit: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n fileMaxLimit: ['OFF', 'MODIFIED_FILES'],\n requireReturnType: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noInlineTypeLiterals: ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noAnyUnknown: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n validateDtos: ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'],\n prismaConverter: ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n noDestructure: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],\n noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],\n};\n\n/**\n * Validate that all configured modes are valid. Produces clear error messages naming the rule.\n */\nfunction validateModes(options: ValidateCodeOptions): string[] {\n const errors: string[] = [];\n\n type ModeEntry = [string, string | undefined];\n const modeEntries: ModeEntry[] = [\n ['methodMaxLimit', options.methodMaxLimit?.mode],\n ['fileMaxLimit', options.fileMaxLimit?.mode],\n ['requireReturnType', options.requireReturnType?.mode],\n ['noInlineTypeLiterals', options.noInlineTypeLiterals?.mode],\n ['noAnyUnknown', options.noAnyUnknown?.mode],\n ['validateDtos', options.validateDtos?.mode],\n ['prismaConverter', options.prismaConverter?.mode],\n ['noDestructure', options.noDestructure?.mode],\n ['noDirectApiInResolver', options.noDirectApiInResolver?.mode],\n ];\n\n for (const [ruleName, modeValue] of modeEntries) {\n if (modeValue === undefined) continue;\n const validModes = VALID_MODES[ruleName];\n if (!validModes.includes(modeValue)) {\n errors.push(`${ruleName}.mode = '${modeValue}' is invalid. Valid modes: ${validModes.join(', ')}`);\n }\n }\n\n return errors;\n}\n\nfunction formatEpochDate(epoch: number): string {\n return new Date(epoch * 1000).toISOString().split('T')[0];\n}\n\nfunction resolveMethodMode(\n normalMode: MethodMaxLimitMode, epoch: number | undefined\n): ResolvedMethodMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: downgrade to skip modified checking\n const downgraded: MethodMaxLimitMode =\n normalMode === 'OFF' ? 'OFF' : 'NEW_METHODS';\n return {\n mode: downgraded,\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction resolveFileMode(\n normalMode: FileMaxLimitMode, epoch: number | undefined\n): ResolvedFileMode {\n if (epoch === undefined) {\n return { mode: normalMode, override: undefined };\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n // Active: file checking is inherently about modified files, so skip entirely\n return {\n mode: 'OFF',\n override: { active: true, normalMode, expiresDate: formatEpochDate(epoch) },\n };\n }\n // Expired\n return { mode: normalMode, override: undefined };\n}\n\nfunction parseConfig(options: ValidateCodeOptions): ParsedConfig {\n const methodConfig: MethodMaxLimitConfig = options.methodMaxLimit ?? {};\n const fileConfig: FileMaxLimitConfig = options.fileMaxLimit ?? {};\n\n const normalMethodMode = methodConfig.mode ?? 'NEW_AND_MODIFIED_METHODS';\n const normalFileMode = fileConfig.mode ?? 'MODIFIED_FILES';\n\n const methodResolved = resolveMethodMode(normalMethodMode, methodConfig.ignoreModifiedUntilEpoch);\n const fileResolved = resolveFileMode(normalFileMode, fileConfig.ignoreModifiedUntilEpoch);\n\n return {\n methodLimit: methodConfig.limit ?? 80,\n methodMode: methodResolved.mode,\n methodDisableAllowed: methodConfig.disableAllowed ?? true,\n methodOverride: methodResolved.override,\n fileLimit: fileConfig.limit ?? 900,\n fileMode: fileResolved.mode,\n fileDisableAllowed: fileConfig.disableAllowed ?? true,\n fileOverride: fileResolved.override,\n returnTypeMode: options.requireReturnType?.mode ?? 'OFF',\n returnTypeDisableAllowed: options.requireReturnType?.disableAllowed ?? true,\n returnTypeIgnoreEpoch: options.requireReturnType?.ignoreModifiedUntilEpoch,\n noInlineTypesMode: options.noInlineTypeLiterals?.mode ?? 'OFF',\n noInlineTypesDisableAllowed: options.noInlineTypeLiterals?.disableAllowed ?? true,\n noInlineTypesIgnoreEpoch: options.noInlineTypeLiterals?.ignoreModifiedUntilEpoch,\n noAnyUnknownMode: options.noAnyUnknown?.mode ?? 'OFF',\n noAnyUnknownDisableAllowed: options.noAnyUnknown?.disableAllowed ?? true,\n noAnyUnknownIgnoreEpoch: options.noAnyUnknown?.ignoreModifiedUntilEpoch,\n validateDtosMode: options.validateDtos?.mode ?? 'OFF',\n validateDtosDisableAllowed: options.validateDtos?.disableAllowed ?? true,\n validateDtosPrismaPath: options.validateDtos?.prismaSchemaPath,\n validateDtosSrcPaths: options.validateDtos?.dtoSourcePaths ?? [],\n validateDtosIgnoreEpoch: options.validateDtos?.ignoreModifiedUntilEpoch,\n prismaConverterMode: options.prismaConverter?.mode ?? 'OFF',\n prismaConverterDisableAllowed: options.prismaConverter?.disableAllowed ?? true,\n prismaConverterSchemaPath: options.prismaConverter?.schemaPath,\n prismaConverterConvertersPaths: options.prismaConverter?.convertersPaths ?? [],\n prismaConverterEnforcePaths: options.prismaConverter?.enforcePaths ?? [],\n prismaConverterIgnoreEpoch: options.prismaConverter?.ignoreModifiedUntilEpoch,\n noDestructureMode: options.noDestructure?.mode ?? 'OFF',\n noDestructureDisableAllowed: options.noDestructure?.disableAllowed ?? true,\n noDestructureIgnoreEpoch: options.noDestructure?.ignoreModifiedUntilEpoch,\n noDirectApiResolverMode: options.noDirectApiInResolver?.mode ?? 'OFF',\n noDirectApiResolverDisableAllowed: options.noDirectApiInResolver?.disableAllowed ?? true,\n noDirectApiResolverIgnoreEpoch: options.noDirectApiInResolver?.ignoreModifiedUntilEpoch,\n noDirectApiResolverEnforcePaths: options.noDirectApiInResolver?.enforcePaths ?? [],\n };\n}\n\nfunction formatOverride(override: OverrideInfo | undefined): string {\n if (!override) {\n return '';\n }\n return ` (override active, normal: ${override.normalMode}, expires: ${override.expiresDate})`;\n}\n\nfunction logConfig(config: ParsedConfig): void {\n console.log('\\n\\ud83d\\udccf Running Code Validations\\n');\n console.log(` Method limits: mode=${config.methodMode}${formatOverride(config.methodOverride)}, limit=${config.methodLimit}, disableAllowed=${config.methodDisableAllowed}`);\n console.log(` File limits: mode=${config.fileMode}${formatOverride(config.fileOverride)}, limit=${config.fileLimit}, disableAllowed=${config.fileDisableAllowed}`);\n console.log(` Require return types: mode=${config.returnTypeMode}, disableAllowed=${config.returnTypeDisableAllowed}`);\n console.log(` No inline type literals: mode=${config.noInlineTypesMode}, disableAllowed=${config.noInlineTypesDisableAllowed}`);\n console.log(` No any/unknown: mode=${config.noAnyUnknownMode}, disableAllowed=${config.noAnyUnknownDisableAllowed}`);\n console.log(` Validate DTOs: mode=${config.validateDtosMode}, disableAllowed=${config.validateDtosDisableAllowed}`);\n console.log(` Prisma converters: mode=${config.prismaConverterMode}, disableAllowed=${config.prismaConverterDisableAllowed}`);\n console.log(` No destructure: mode=${config.noDestructureMode}, disableAllowed=${config.noDestructureDisableAllowed}`);\n console.log(` No direct API in resolver: mode=${config.noDirectApiResolverMode}, disableAllowed=${config.noDirectApiResolverDisableAllowed}`);\n console.log('');\n}\n\nfunction isAllOff(config: ParsedConfig): boolean {\n return config.methodMode === 'OFF' && config.fileMode === 'OFF' &&\n config.returnTypeMode === 'OFF' && config.noInlineTypesMode === 'OFF' &&\n config.noAnyUnknownMode === 'OFF' && config.validateDtosMode === 'OFF' &&\n config.prismaConverterMode === 'OFF' && config.noDestructureMode === 'OFF' &&\n config.noDirectApiResolverMode === 'OFF';\n}\n\nasync function runMethodValidators(config: ParsedConfig, context: ExecutorContext): Promise<ExecutorResult[]> {\n const results: ExecutorResult[] = [];\n const runNew = config.methodMode === 'NEW_METHODS' || config.methodMode === 'NEW_AND_MODIFIED_METHODS';\n const runModified = config.methodMode === 'NEW_AND_MODIFIED_METHODS' || config.methodMode === 'MODIFIED_FILES';\n\n if (runNew) {\n results.push(await runNewMethodsExecutor({\n limit: config.methodLimit,\n mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, context));\n }\n if (runModified) {\n results.push(await runModifiedMethodsExecutor({\n limit: config.methodLimit, mode: config.methodMode, disableAllowed: config.methodDisableAllowed,\n }, context));\n }\n return results;\n}\n\nexport default async function runExecutor(\n options: ValidateCodeOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const modeErrors = validateModes(options);\n if (modeErrors.length > 0) {\n console.error('');\n for (const err of modeErrors) {\n console.error(`❌ ${err}`);\n }\n console.error('');\n return { success: false };\n }\n\n const config = parseConfig(options);\n\n if (isAllOff(config)) {\n console.log('\\n\\u23ed\\ufe0f Skipping all code validations (all modes: OFF)\\n');\n return { success: true };\n }\n\n logConfig(config);\n\n const methodResults = await runMethodValidators(config, context);\n const fileResult = await runModifiedFilesExecutor({\n limit: config.fileLimit, mode: config.fileMode, disableAllowed: config.fileDisableAllowed,\n }, context);\n const returnTypesResult = await runReturnTypesExecutor({\n mode: config.returnTypeMode,\n disableAllowed: config.returnTypeDisableAllowed,\n ignoreModifiedUntilEpoch: config.returnTypeIgnoreEpoch,\n }, context);\n const noInlineTypesResult = await runNoInlineTypesExecutor({\n mode: config.noInlineTypesMode,\n disableAllowed: config.noInlineTypesDisableAllowed,\n ignoreModifiedUntilEpoch: config.noInlineTypesIgnoreEpoch,\n }, context);\n const noAnyUnknownResult = await runNoAnyUnknownExecutor({\n mode: config.noAnyUnknownMode,\n disableAllowed: config.noAnyUnknownDisableAllowed,\n ignoreModifiedUntilEpoch: config.noAnyUnknownIgnoreEpoch,\n }, context);\n const validateDtosResult = await runValidateDtosExecutor({\n mode: config.validateDtosMode,\n disableAllowed: config.validateDtosDisableAllowed,\n prismaSchemaPath: config.validateDtosPrismaPath,\n dtoSourcePaths: config.validateDtosSrcPaths,\n ignoreModifiedUntilEpoch: config.validateDtosIgnoreEpoch,\n }, context);\n const prismaConverterResult = await runPrismaConvertersExecutor({\n mode: config.prismaConverterMode,\n disableAllowed: config.prismaConverterDisableAllowed,\n schemaPath: config.prismaConverterSchemaPath,\n convertersPaths: config.prismaConverterConvertersPaths,\n enforcePaths: config.prismaConverterEnforcePaths,\n ignoreModifiedUntilEpoch: config.prismaConverterIgnoreEpoch,\n }, context);\n const noDestructureResult = await runNoDestructureExecutor({\n mode: config.noDestructureMode,\n disableAllowed: config.noDestructureDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDestructureIgnoreEpoch,\n }, context);\n const noDirectApiResolverResult = await runNoDirectApiResolverExecutor({\n mode: config.noDirectApiResolverMode,\n disableAllowed: config.noDirectApiResolverDisableAllowed,\n ignoreModifiedUntilEpoch: config.noDirectApiResolverIgnoreEpoch,\n enforcePaths: config.noDirectApiResolverEnforcePaths,\n }, context);\n\n const allSuccess = methodResults.every((r) => r.success) &&\n fileResult.success && returnTypesResult.success &&\n noInlineTypesResult.success && noAnyUnknownResult.success &&\n validateDtosResult.success && prismaConverterResult.success &&\n noDestructureResult.success && noDirectApiResolverResult.success;\n\n console.log(allSuccess ? '\\n\\u2705 All code validations passed\\n' : '\\n\\u274c Some code validations failed\\n');\n return { success: allSuccess };\n}\n"]}
|
|
@@ -154,7 +154,7 @@ const VALID_MODES: Record<string, string[]> = {
|
|
|
154
154
|
validateDtos: ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'],
|
|
155
155
|
prismaConverter: ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],
|
|
156
156
|
noDestructure: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],
|
|
157
|
-
noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'],
|
|
157
|
+
noDirectApiInResolver: ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'],
|
|
158
158
|
};
|
|
159
159
|
|
|
160
160
|
/**
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
"properties": {
|
|
204
204
|
"mode": {
|
|
205
205
|
"type": "string",
|
|
206
|
-
"description": "OFF: skip validation. MODIFIED_CODE: only changed lines in diff. MODIFIED_FILES: all in modified files.",
|
|
206
|
+
"description": "OFF: skip validation. MODIFIED_CODE: only changed lines in diff. NEW_AND_MODIFIED_METHODS: violations in new/modified method/route scopes. MODIFIED_FILES: all in modified files.",
|
|
207
207
|
"default": "OFF"
|
|
208
208
|
},
|
|
209
209
|
"disableAllowed": {
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
* ============================================================================
|
|
22
22
|
* MODES (LINE-BASED)
|
|
23
23
|
* ============================================================================
|
|
24
|
-
* - OFF:
|
|
25
|
-
* - MODIFIED_CODE:
|
|
26
|
-
* -
|
|
24
|
+
* - OFF: Skip validation entirely
|
|
25
|
+
* - MODIFIED_CODE: Flag violations on changed lines (lines in diff hunks)
|
|
26
|
+
* - NEW_AND_MODIFIED_METHODS: Flag violations in new/modified method/route scopes
|
|
27
|
+
* - MODIFIED_FILES: Flag ALL violations in files that were modified
|
|
27
28
|
*
|
|
28
29
|
* ============================================================================
|
|
29
30
|
* ESCAPE HATCH
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
* const myApi = inject(MyApi);
|
|
34
35
|
*/
|
|
35
36
|
import type { ExecutorContext } from '@nx/devkit';
|
|
36
|
-
export type NoDirectApiResolverMode = 'OFF' | 'MODIFIED_CODE' | 'MODIFIED_FILES';
|
|
37
|
+
export type NoDirectApiResolverMode = 'OFF' | 'MODIFIED_CODE' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';
|
|
37
38
|
export interface ValidateNoDirectApiResolverOptions {
|
|
38
39
|
mode?: NoDirectApiResolverMode;
|
|
39
40
|
disableAllowed?: boolean;
|
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
* ============================================================================
|
|
23
23
|
* MODES (LINE-BASED)
|
|
24
24
|
* ============================================================================
|
|
25
|
-
* - OFF:
|
|
26
|
-
* - MODIFIED_CODE:
|
|
27
|
-
* -
|
|
25
|
+
* - OFF: Skip validation entirely
|
|
26
|
+
* - MODIFIED_CODE: Flag violations on changed lines (lines in diff hunks)
|
|
27
|
+
* - NEW_AND_MODIFIED_METHODS: Flag violations in new/modified method/route scopes
|
|
28
|
+
* - MODIFIED_FILES: Flag ALL violations in files that were modified
|
|
28
29
|
*
|
|
29
30
|
* ============================================================================
|
|
30
31
|
* ESCAPE HATCH
|
|
@@ -280,6 +281,166 @@ function findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllo
|
|
|
280
281
|
}
|
|
281
282
|
return violations;
|
|
282
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Find route object ranges in *.routes.ts files.
|
|
286
|
+
* A route object is an ObjectLiteralExpression that contains (directly or in descendants)
|
|
287
|
+
* a `resolve` property. Returns the line range of each such top-level route object.
|
|
288
|
+
*/
|
|
289
|
+
function findRouteObjectRanges(filePath, workspaceRoot) {
|
|
290
|
+
const fullPath = path.join(workspaceRoot, filePath);
|
|
291
|
+
if (!fs.existsSync(fullPath))
|
|
292
|
+
return [];
|
|
293
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
294
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
295
|
+
const ranges = [];
|
|
296
|
+
function hasResolveProperty(node) {
|
|
297
|
+
if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && node.name.text === 'resolve') {
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
let found = false;
|
|
301
|
+
ts.forEachChild(node, (child) => {
|
|
302
|
+
if (hasResolveProperty(child)) {
|
|
303
|
+
found = true;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
return found;
|
|
307
|
+
}
|
|
308
|
+
function visitTopLevel(node) {
|
|
309
|
+
if (ts.isObjectLiteralExpression(node) && hasResolveProperty(node)) {
|
|
310
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
311
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
312
|
+
ranges.push({
|
|
313
|
+
name: `route@${start.line + 1}`,
|
|
314
|
+
startLine: start.line + 1,
|
|
315
|
+
endLine: end.line + 1,
|
|
316
|
+
});
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
ts.forEachChild(node, visitTopLevel);
|
|
320
|
+
}
|
|
321
|
+
visitTopLevel(sourceFile);
|
|
322
|
+
return ranges;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Find method/function ranges in *.component.ts files.
|
|
326
|
+
* Returns ranges for class methods, function declarations, and arrow functions in variable declarations.
|
|
327
|
+
*/
|
|
328
|
+
function findMethodRanges(filePath, workspaceRoot) {
|
|
329
|
+
const fullPath = path.join(workspaceRoot, filePath);
|
|
330
|
+
if (!fs.existsSync(fullPath))
|
|
331
|
+
return [];
|
|
332
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
333
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
334
|
+
const ranges = [];
|
|
335
|
+
function visit(node) {
|
|
336
|
+
let methodName;
|
|
337
|
+
let startLine;
|
|
338
|
+
let endLine;
|
|
339
|
+
if (ts.isMethodDeclaration(node) && node.name) {
|
|
340
|
+
methodName = node.name.getText(sourceFile);
|
|
341
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
342
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
343
|
+
startLine = start.line + 1;
|
|
344
|
+
endLine = end.line + 1;
|
|
345
|
+
}
|
|
346
|
+
else if (ts.isFunctionDeclaration(node) && node.name) {
|
|
347
|
+
methodName = node.name.getText(sourceFile);
|
|
348
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
349
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
350
|
+
startLine = start.line + 1;
|
|
351
|
+
endLine = end.line + 1;
|
|
352
|
+
}
|
|
353
|
+
else if (ts.isArrowFunction(node)) {
|
|
354
|
+
if (ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name)) {
|
|
355
|
+
methodName = node.parent.name.getText(sourceFile);
|
|
356
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
357
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
358
|
+
startLine = start.line + 1;
|
|
359
|
+
endLine = end.line + 1;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
if (methodName && startLine !== undefined && endLine !== undefined) {
|
|
363
|
+
ranges.push({ name: methodName, startLine, endLine });
|
|
364
|
+
}
|
|
365
|
+
ts.forEachChild(node, visit);
|
|
366
|
+
}
|
|
367
|
+
visit(sourceFile);
|
|
368
|
+
return ranges;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* NEW_AND_MODIFIED_METHODS mode: Flag violations in new/modified method/route scopes.
|
|
372
|
+
* - For *.routes.ts: If any line in a route object is changed, flag all inject(XxxApi) violations in that route
|
|
373
|
+
* - For *.component.ts: If a method is new/modified, flag all snapshot.data violations in that method
|
|
374
|
+
*/
|
|
375
|
+
// webpieces-disable max-lines-new-methods -- Method-scoped validation with route objects and component methods
|
|
376
|
+
function findViolationsForModifiedMethods(workspaceRoot, changedFiles, base, head, disableAllowed) {
|
|
377
|
+
const violations = [];
|
|
378
|
+
for (const file of changedFiles) {
|
|
379
|
+
const diff = (0, diff_utils_1.getFileDiff)(workspaceRoot, file, base, head);
|
|
380
|
+
const changedLines = (0, diff_utils_1.getChangedLineNumbers)(diff);
|
|
381
|
+
const newMethodNames = (0, diff_utils_1.findNewMethodSignaturesInDiff)(diff);
|
|
382
|
+
if (changedLines.size === 0 && newMethodNames.size === 0)
|
|
383
|
+
continue;
|
|
384
|
+
if (file.endsWith('.routes.ts')) {
|
|
385
|
+
const routeRanges = findRouteObjectRanges(file, workspaceRoot);
|
|
386
|
+
const allViolations = findDirectApiInjections(file, workspaceRoot, disableAllowed);
|
|
387
|
+
for (const range of routeRanges) {
|
|
388
|
+
let rangeHasChanges = false;
|
|
389
|
+
for (let line = range.startLine; line <= range.endLine; line++) {
|
|
390
|
+
if (changedLines.has(line)) {
|
|
391
|
+
rangeHasChanges = true;
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (!rangeHasChanges)
|
|
396
|
+
continue;
|
|
397
|
+
for (const v of allViolations) {
|
|
398
|
+
if (disableAllowed && v.hasDisableComment)
|
|
399
|
+
continue;
|
|
400
|
+
if (v.line >= range.startLine && v.line <= range.endLine) {
|
|
401
|
+
violations.push({
|
|
402
|
+
file,
|
|
403
|
+
line: v.line,
|
|
404
|
+
column: v.column,
|
|
405
|
+
context: v.context,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else if (file.endsWith('.component.ts')) {
|
|
412
|
+
const methodRanges = findMethodRanges(file, workspaceRoot);
|
|
413
|
+
const allViolations = findSnapshotDataAccess(file, workspaceRoot, disableAllowed);
|
|
414
|
+
for (const range of methodRanges) {
|
|
415
|
+
const isNewMethod = newMethodNames.has(range.name);
|
|
416
|
+
let rangeHasChanges = false;
|
|
417
|
+
if (!isNewMethod) {
|
|
418
|
+
for (let line = range.startLine; line <= range.endLine; line++) {
|
|
419
|
+
if (changedLines.has(line)) {
|
|
420
|
+
rangeHasChanges = true;
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (!isNewMethod && !rangeHasChanges)
|
|
426
|
+
continue;
|
|
427
|
+
for (const v of allViolations) {
|
|
428
|
+
if (disableAllowed && v.hasDisableComment)
|
|
429
|
+
continue;
|
|
430
|
+
if (v.line >= range.startLine && v.line <= range.endLine) {
|
|
431
|
+
violations.push({
|
|
432
|
+
file,
|
|
433
|
+
line: v.line,
|
|
434
|
+
column: v.column,
|
|
435
|
+
context: v.context,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return violations;
|
|
443
|
+
}
|
|
283
444
|
/**
|
|
284
445
|
* Report violations to console.
|
|
285
446
|
*/
|
|
@@ -389,6 +550,9 @@ async function runExecutor(options, context) {
|
|
|
389
550
|
if (mode === 'MODIFIED_CODE') {
|
|
390
551
|
violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
391
552
|
}
|
|
553
|
+
else if (mode === 'NEW_AND_MODIFIED_METHODS') {
|
|
554
|
+
violations = findViolationsForModifiedMethods(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
555
|
+
}
|
|
392
556
|
else if (mode === 'MODIFIED_FILES') {
|
|
393
557
|
violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);
|
|
394
558
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-no-direct-api-resolver/executor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;AA+XH,8BA6DC;;AAzbD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AACjC,8CAAmE;AA6BnE;;GAEG;AACH,oHAAoH;AACpH,SAAS,yBAAyB,CAAC,aAAqB,EAAE,IAAY,EAAE,IAAa;IACjF,IAAI,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACnD,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,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C;IACxG,CAAC;SAAM,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACnC,UAAU,GAAG,8BAA8B,CAAC,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IAC7F,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QAC5D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,UAAU,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * Validate No Direct API in Resolver Executor\n *\n * Validates two Angular anti-patterns using LINE-BASED detection:\n *\n * ============================================================================\n * VIOLATIONS (BAD) - These patterns are flagged:\n * ============================================================================\n *\n * 1. In *.routes.ts files: inject(XxxApi) — resolvers should inject services, not APIs directly\n * 2. In *.component.ts files: this.<field>.snapshot.data — components should subscribe to\n * service BehaviorSubjects, not read route snapshot data\n *\n * ============================================================================\n * CORRECT PATTERNS (GOOD)\n * ============================================================================\n *\n * 1. In resolvers: inject(XxxService) which calls the API internally\n * 2. In components: this.myService.someObservable$ (subscribe to service BehaviorSubjects)\n *\n * ============================================================================\n * MODES (LINE-BASED)\n * ============================================================================\n * - OFF: Skip validation entirely\n * - MODIFIED_CODE: Flag violations on changed lines (lines in diff hunks)\n * - MODIFIED_FILES: Flag ALL violations in files that were modified\n *\n * ============================================================================\n * ESCAPE HATCH\n * ============================================================================\n * Add comment above the violation:\n * // webpieces-disable no-direct-api-resolver -- [your justification]\n * const myApi = inject(MyApi);\n */\n\nimport type { ExecutorContext } from '@nx/devkit';\nimport { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { getFileDiff, getChangedLineNumbers } from '../diff-utils';\n\nexport type NoDirectApiResolverMode = 'OFF' | 'MODIFIED_CODE' | 'MODIFIED_FILES';\n\nexport interface ValidateNoDirectApiResolverOptions {\n mode?: NoDirectApiResolverMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n enforcePaths?: string[];\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface Violation {\n file: string;\n line: number;\n column: number;\n context: string;\n}\n\ninterface ViolationInfo {\n line: number;\n column: number;\n context: string;\n hasDisableComment: boolean;\n}\n\n/**\n * Get changed TypeScript files between base and head (or working tree if head not specified).\n */\n// webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths\nfunction getChangedTypeScriptFiles(workspaceRoot: string, base: string, head?: string): string[] {\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const output = execSync(`git diff --name-only ${diffTarget} -- '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const changedFiles = output\n .trim()\n .split('\\n')\n .filter((f) => f && !f.includes('.spec.ts') && !f.includes('.test.ts'));\n\n if (!head) {\n try {\n const untrackedOutput = execSync(`git ls-files --others --exclude-standard '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const untrackedFiles = untrackedOutput\n .trim()\n .split('\\n')\n .filter((f) => f && !f.includes('.spec.ts') && !f.includes('.test.ts'));\n const allFiles = new Set([...changedFiles, ...untrackedFiles]);\n return Array.from(allFiles);\n } catch {\n return changedFiles;\n }\n }\n\n return changedFiles;\n } catch {\n return [];\n }\n}\n\n/**\n * Check if a line contains a webpieces-disable comment for no-direct-api-resolver.\n */\nfunction hasDisableComment(lines: string[], lineNumber: number): boolean {\n const startCheck = Math.max(0, lineNumber - 5);\n for (let i = lineNumber - 2; i >= startCheck; i--) {\n const line = lines[i]?.trim() ?? '';\n if (line.startsWith('function ') || line.startsWith('class ') || line.endsWith('}')) {\n break;\n }\n if (line.includes('webpieces-disable') && line.includes('no-direct-api-resolver')) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Auto-detect the base branch by finding the merge-base with origin/main.\n */\nfunction detectBase(workspaceRoot: string): string | null {\n try {\n const mergeBase = execSync('git merge-base HEAD origin/main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n } catch {\n try {\n const mergeBase = execSync('git merge-base HEAD main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n } catch {\n // Ignore\n }\n }\n return null;\n}\n\n/**\n * Find inject(XxxApi) calls in *.routes.ts files.\n * Flags any CallExpression where callee is `inject` and the first argument is an identifier ending with `Api`.\n */\nfunction findDirectApiInjections(filePath: string, workspaceRoot: string, disableAllowed: boolean): ViolationInfo[] {\n if (!filePath.endsWith('.routes.ts')) return [];\n\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const violations: ViolationInfo[] = [];\n\n function visit(node: ts.Node): void {\n try {\n if (ts.isCallExpression(node)) {\n const callee = node.expression;\n if (ts.isIdentifier(callee) && callee.text === 'inject') {\n const firstArg = node.arguments[0];\n if (firstArg && ts.isIdentifier(firstArg) && firstArg.text.endsWith('Api')) {\n const startPos = node.getStart(sourceFile);\n if (startPos >= 0) {\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const column = pos.character + 1;\n const disabled = hasDisableComment(fileLines, line);\n\n if (!disableAllowed && disabled) {\n violations.push({ line, column, context: `inject(${firstArg.text}) in route resolver`, hasDisableComment: false });\n } else {\n violations.push({ line, column, context: `inject(${firstArg.text}) in route resolver`, hasDisableComment: disabled });\n }\n }\n }\n }\n }\n } catch {\n // Skip nodes that cause errors during analysis\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\n/**\n * Find this.<field>.snapshot.data access patterns in *.component.ts files.\n * Flags PropertyAccessExpression chains: this.<anything>.snapshot.data\n */\nfunction findSnapshotDataAccess(filePath: string, workspaceRoot: string, disableAllowed: boolean): ViolationInfo[] {\n if (!filePath.endsWith('.component.ts')) return [];\n\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const violations: ViolationInfo[] = [];\n\n function visit(node: ts.Node): void {\n try {\n // Looking for: this.<field>.snapshot.data\n // AST shape: PropertyAccessExpression(.data) -> PropertyAccessExpression(.snapshot) -> PropertyAccessExpression(.<field>) -> this\n if (ts.isPropertyAccessExpression(node) && node.name.text === 'data') {\n const snapshotAccess = node.expression;\n if (ts.isPropertyAccessExpression(snapshotAccess) && snapshotAccess.name.text === 'snapshot') {\n const fieldAccess = snapshotAccess.expression;\n if (ts.isPropertyAccessExpression(fieldAccess)) {\n const receiver = fieldAccess.expression;\n if (receiver.kind === ts.SyntaxKind.ThisKeyword) {\n const fieldName = fieldAccess.name.text;\n const startPos = node.getStart(sourceFile);\n if (startPos >= 0) {\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const column = pos.character + 1;\n const disabled = hasDisableComment(fileLines, line);\n\n if (!disableAllowed && disabled) {\n violations.push({ line, column, context: `this.${fieldName}.snapshot.data in component`, hasDisableComment: false });\n } else {\n violations.push({ line, column, context: `this.${fieldName}.snapshot.data in component`, hasDisableComment: disabled });\n }\n }\n }\n }\n }\n }\n } catch {\n // Skip nodes that cause errors during analysis\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\n/**\n * Find all violations in a file (both inject(Api) and snapshot.data patterns).\n */\nfunction findViolationsInFile(filePath: string, workspaceRoot: string, disableAllowed: boolean): ViolationInfo[] {\n const apiViolations = findDirectApiInjections(filePath, workspaceRoot, disableAllowed);\n const snapshotViolations = findSnapshotDataAccess(filePath, workspaceRoot, disableAllowed);\n return [...apiViolations, ...snapshotViolations];\n}\n\n/**\n * MODIFIED_CODE mode: Flag violations on changed lines in diff hunks.\n */\n// webpieces-disable max-lines-new-methods -- File iteration with diff parsing and line filtering\nfunction findViolationsForModifiedCode(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean\n): Violation[] {\n const violations: Violation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n\n if (changedLines.size === 0) continue;\n\n const allViolations = findViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n // LINE-BASED: Only include if the violation is on a changed line\n if (!changedLines.has(v.line)) continue;\n\n violations.push({\n file,\n line: v.line,\n column: v.column,\n context: v.context,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * MODIFIED_FILES mode: Flag ALL violations in files that were modified.\n */\nfunction findViolationsForModifiedFiles(workspaceRoot: string, changedFiles: string[], disableAllowed: boolean): Violation[] {\n const violations: Violation[] = [];\n\n for (const file of changedFiles) {\n const allViolations = findViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n\n violations.push({\n file,\n line: v.line,\n column: v.column,\n context: v.context,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * Report violations to console.\n */\n// webpieces-disable max-lines-new-methods -- Console output with examples and escape hatch information\nfunction reportViolations(violations: Violation[], mode: NoDirectApiResolverMode, disableAllowed: boolean): void {\n console.error('');\n console.error('\\u274c Direct API usage in resolvers or snapshot.data in components found!');\n console.error('');\n console.error('\\ud83d\\udcda Resolvers should use services, and components should subscribe to service observables:');\n console.error('');\n console.error(' BAD (in *.routes.ts resolver):');\n console.error(' const myApi = inject(MyApi);');\n console.error(' resolve: () => inject(MyApi).fetchData()');\n console.error('');\n console.error(' GOOD (in *.routes.ts resolver):');\n console.error(' const myService = inject(MyService);');\n console.error(' resolve: () => inject(MyService).loadData()');\n console.error('');\n console.error(' BAD (in *.component.ts):');\n console.error(' const data = this.route.snapshot.data;');\n console.error('');\n console.error(' GOOD (in *.component.ts):');\n console.error(' this.myService.data$.subscribe(data => ...)');\n console.error('');\n\n for (const v of violations) {\n console.error(` \\u274c ${v.file}:${v.line}:${v.column}`);\n console.error(` ${v.context}`);\n }\n console.error('');\n\n if (disableAllowed) {\n console.error(' Escape hatch (use sparingly):');\n console.error(' // webpieces-disable no-direct-api-resolver -- [your reason]');\n } else {\n console.error(' Escape hatch: DISABLED (disableAllowed: false)');\n console.error(' Disable comments are ignored. Fix the pattern directly.');\n }\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\n/**\n * Resolve mode considering ignoreModifiedUntilEpoch override.\n * When active, downgrades to OFF. When expired, logs a warning.\n */\nfunction resolveMode(normalMode: NoDirectApiResolverMode, epoch: number | undefined): NoDirectApiResolverMode {\n if (epoch === undefined || normalMode === 'OFF') {\n return normalMode;\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n console.log(`\\n\\u23ed\\ufe0f Skipping no-direct-api-resolver validation (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);\n console.log('');\n return 'OFF';\n }\n return normalMode;\n}\n\n/**\n * Filter changed files to only those under enforcePaths (if configured).\n */\nfunction filterByEnforcePaths(changedFiles: string[], enforcePaths: string[] | undefined): string[] {\n if (!enforcePaths || enforcePaths.length === 0) {\n return changedFiles;\n }\n return changedFiles.filter((file) =>\n enforcePaths.some((prefix) => file.startsWith(prefix))\n );\n}\n\n/**\n * Filter to only relevant Angular files (*.routes.ts and *.component.ts).\n */\nfunction filterRelevantFiles(changedFiles: string[]): string[] {\n return changedFiles.filter((file) =>\n file.endsWith('.routes.ts') || file.endsWith('.component.ts')\n );\n}\n\nexport default async function runExecutor(\n options: ValidateNoDirectApiResolverOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const workspaceRoot = context.root;\n const mode: NoDirectApiResolverMode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);\n const disableAllowed = options.disableAllowed ?? true;\n\n if (mode === 'OFF') {\n console.log('\\n\\u23ed\\ufe0f Skipping no-direct-api-resolver validation (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n console.log('\\n\\ud83d\\udccf Validating No Direct API in Resolver\\n');\n console.log(` Mode: ${mode}`);\n\n let base = process.env['NX_BASE'];\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n base = detectBase(workspaceRoot) ?? undefined;\n\n if (!base) {\n console.log('\\n\\u23ed\\ufe0f Skipping no-direct-api-resolver validation (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const allChangedFiles = getChangedTypeScriptFiles(workspaceRoot, base, head);\n const scopedFiles = filterByEnforcePaths(allChangedFiles, options.enforcePaths);\n const changedFiles = filterRelevantFiles(scopedFiles);\n\n if (changedFiles.length === 0) {\n console.log('\\u2705 No relevant Angular files changed (*.routes.ts, *.component.ts)');\n return { success: true };\n }\n\n console.log(`\\ud83d\\udcc2 Checking ${changedFiles.length} changed file(s)...`);\n\n let violations: Violation[] = [];\n\n if (mode === 'MODIFIED_CODE') {\n violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);\n } else if (mode === 'MODIFIED_FILES') {\n violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);\n }\n\n if (violations.length === 0) {\n console.log('\\u2705 No direct API resolver patterns found');\n return { success: true };\n }\n\n reportViolations(violations, mode, disableAllowed);\n\n return { success: false };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-no-direct-api-resolver/executor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;AAwjBH,8BA+DC;;AApnBD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AACjC,8CAAkG;AA6BlG;;GAEG;AACH,oHAAoH;AACpH,SAAS,yBAAyB,CAAC,aAAqB,EAAE,IAAY,EAAE,IAAa;IACjF,IAAI,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACnD,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,wBAAwB,UAAU,oBAAoB,EAAE;YAC5E,GAAG,EAAE,aAAa;YAClB,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,MAAM;aACtB,IAAI,EAAE;aACN,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAE5E,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,IAAI,CAAC;gBACD,MAAM,eAAe,GAAG,IAAA,wBAAQ,EAAC,yDAAyD,EAAE;oBACxF,GAAG,EAAE,aAAa;oBAClB,QAAQ,EAAE,OAAO;iBACpB,CAAC,CAAC;gBACH,MAAM,cAAc,GAAG,eAAe;qBACjC,IAAI,EAAE;qBACN,KAAK,CAAC,IAAI,CAAC;qBACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CA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AI,IAAI,KAAK,0BAA0B,EAAE,CAAC;QAC7C,UAAU,GAAG,gCAAgC,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAC3G,CAAC;SAAM,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACnC,UAAU,GAAG,8BAA8B,CAAC,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IAC7F,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QAC5D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,UAAU,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * Validate No Direct API in Resolver Executor\n *\n * Validates two Angular anti-patterns using LINE-BASED detection:\n *\n * ============================================================================\n * VIOLATIONS (BAD) - These patterns are flagged:\n * ============================================================================\n *\n * 1. In *.routes.ts files: inject(XxxApi) — resolvers should inject services, not APIs directly\n * 2. In *.component.ts files: this.<field>.snapshot.data — components should subscribe to\n * service BehaviorSubjects, not read route snapshot data\n *\n * ============================================================================\n * CORRECT PATTERNS (GOOD)\n * ============================================================================\n *\n * 1. In resolvers: inject(XxxService) which calls the API internally\n * 2. In components: this.myService.someObservable$ (subscribe to service BehaviorSubjects)\n *\n * ============================================================================\n * MODES (LINE-BASED)\n * ============================================================================\n * - OFF: Skip validation entirely\n * - MODIFIED_CODE: Flag violations on changed lines (lines in diff hunks)\n * - NEW_AND_MODIFIED_METHODS: Flag violations in new/modified method/route scopes\n * - MODIFIED_FILES: Flag ALL violations in files that were modified\n *\n * ============================================================================\n * ESCAPE HATCH\n * ============================================================================\n * Add comment above the violation:\n * // webpieces-disable no-direct-api-resolver -- [your justification]\n * const myApi = inject(MyApi);\n */\n\nimport type { ExecutorContext } from '@nx/devkit';\nimport { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { getFileDiff, getChangedLineNumbers, findNewMethodSignaturesInDiff } from '../diff-utils';\n\nexport type NoDirectApiResolverMode = 'OFF' | 'MODIFIED_CODE' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';\n\nexport interface ValidateNoDirectApiResolverOptions {\n mode?: NoDirectApiResolverMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n enforcePaths?: string[];\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface Violation {\n file: string;\n line: number;\n column: number;\n context: string;\n}\n\ninterface ViolationInfo {\n line: number;\n column: number;\n context: string;\n hasDisableComment: boolean;\n}\n\n/**\n * Get changed TypeScript files between base and head (or working tree if head not specified).\n */\n// webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths\nfunction getChangedTypeScriptFiles(workspaceRoot: string, base: string, head?: string): string[] {\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const output = execSync(`git diff --name-only ${diffTarget} -- '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const changedFiles = output\n .trim()\n .split('\\n')\n .filter((f) => f && !f.includes('.spec.ts') && !f.includes('.test.ts'));\n\n if (!head) {\n try {\n const untrackedOutput = execSync(`git ls-files --others --exclude-standard '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const untrackedFiles = untrackedOutput\n .trim()\n .split('\\n')\n .filter((f) => f && !f.includes('.spec.ts') && !f.includes('.test.ts'));\n const allFiles = new Set([...changedFiles, ...untrackedFiles]);\n return Array.from(allFiles);\n } catch {\n return changedFiles;\n }\n }\n\n return changedFiles;\n } catch {\n return [];\n }\n}\n\n/**\n * Check if a line contains a webpieces-disable comment for no-direct-api-resolver.\n */\nfunction hasDisableComment(lines: string[], lineNumber: number): boolean {\n const startCheck = Math.max(0, lineNumber - 5);\n for (let i = lineNumber - 2; i >= startCheck; i--) {\n const line = lines[i]?.trim() ?? '';\n if (line.startsWith('function ') || line.startsWith('class ') || line.endsWith('}')) {\n break;\n }\n if (line.includes('webpieces-disable') && line.includes('no-direct-api-resolver')) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Auto-detect the base branch by finding the merge-base with origin/main.\n */\nfunction detectBase(workspaceRoot: string): string | null {\n try {\n const mergeBase = execSync('git merge-base HEAD origin/main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n } catch {\n try {\n const mergeBase = execSync('git merge-base HEAD main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n } catch {\n // Ignore\n }\n }\n return null;\n}\n\n/**\n * Find inject(XxxApi) calls in *.routes.ts files.\n * Flags any CallExpression where callee is `inject` and the first argument is an identifier ending with `Api`.\n */\nfunction findDirectApiInjections(filePath: string, workspaceRoot: string, disableAllowed: boolean): ViolationInfo[] {\n if (!filePath.endsWith('.routes.ts')) return [];\n\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const violations: ViolationInfo[] = [];\n\n function visit(node: ts.Node): void {\n try {\n if (ts.isCallExpression(node)) {\n const callee = node.expression;\n if (ts.isIdentifier(callee) && callee.text === 'inject') {\n const firstArg = node.arguments[0];\n if (firstArg && ts.isIdentifier(firstArg) && firstArg.text.endsWith('Api')) {\n const startPos = node.getStart(sourceFile);\n if (startPos >= 0) {\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const column = pos.character + 1;\n const disabled = hasDisableComment(fileLines, line);\n\n if (!disableAllowed && disabled) {\n violations.push({ line, column, context: `inject(${firstArg.text}) in route resolver`, hasDisableComment: false });\n } else {\n violations.push({ line, column, context: `inject(${firstArg.text}) in route resolver`, hasDisableComment: disabled });\n }\n }\n }\n }\n }\n } catch {\n // Skip nodes that cause errors during analysis\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\n/**\n * Find this.<field>.snapshot.data access patterns in *.component.ts files.\n * Flags PropertyAccessExpression chains: this.<anything>.snapshot.data\n */\nfunction findSnapshotDataAccess(filePath: string, workspaceRoot: string, disableAllowed: boolean): ViolationInfo[] {\n if (!filePath.endsWith('.component.ts')) return [];\n\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const violations: ViolationInfo[] = [];\n\n function visit(node: ts.Node): void {\n try {\n // Looking for: this.<field>.snapshot.data\n // AST shape: PropertyAccessExpression(.data) -> PropertyAccessExpression(.snapshot) -> PropertyAccessExpression(.<field>) -> this\n if (ts.isPropertyAccessExpression(node) && node.name.text === 'data') {\n const snapshotAccess = node.expression;\n if (ts.isPropertyAccessExpression(snapshotAccess) && snapshotAccess.name.text === 'snapshot') {\n const fieldAccess = snapshotAccess.expression;\n if (ts.isPropertyAccessExpression(fieldAccess)) {\n const receiver = fieldAccess.expression;\n if (receiver.kind === ts.SyntaxKind.ThisKeyword) {\n const fieldName = fieldAccess.name.text;\n const startPos = node.getStart(sourceFile);\n if (startPos >= 0) {\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const column = pos.character + 1;\n const disabled = hasDisableComment(fileLines, line);\n\n if (!disableAllowed && disabled) {\n violations.push({ line, column, context: `this.${fieldName}.snapshot.data in component`, hasDisableComment: false });\n } else {\n violations.push({ line, column, context: `this.${fieldName}.snapshot.data in component`, hasDisableComment: disabled });\n }\n }\n }\n }\n }\n }\n } catch {\n // Skip nodes that cause errors during analysis\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return violations;\n}\n\n/**\n * Find all violations in a file (both inject(Api) and snapshot.data patterns).\n */\nfunction findViolationsInFile(filePath: string, workspaceRoot: string, disableAllowed: boolean): ViolationInfo[] {\n const apiViolations = findDirectApiInjections(filePath, workspaceRoot, disableAllowed);\n const snapshotViolations = findSnapshotDataAccess(filePath, workspaceRoot, disableAllowed);\n return [...apiViolations, ...snapshotViolations];\n}\n\n/**\n * MODIFIED_CODE mode: Flag violations on changed lines in diff hunks.\n */\n// webpieces-disable max-lines-new-methods -- File iteration with diff parsing and line filtering\nfunction findViolationsForModifiedCode(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean\n): Violation[] {\n const violations: Violation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n\n if (changedLines.size === 0) continue;\n\n const allViolations = findViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n // LINE-BASED: Only include if the violation is on a changed line\n if (!changedLines.has(v.line)) continue;\n\n violations.push({\n file,\n line: v.line,\n column: v.column,\n context: v.context,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * MODIFIED_FILES mode: Flag ALL violations in files that were modified.\n */\nfunction findViolationsForModifiedFiles(workspaceRoot: string, changedFiles: string[], disableAllowed: boolean): Violation[] {\n const violations: Violation[] = [];\n\n for (const file of changedFiles) {\n const allViolations = findViolationsInFile(file, workspaceRoot, disableAllowed);\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n\n violations.push({\n file,\n line: v.line,\n column: v.column,\n context: v.context,\n });\n }\n }\n\n return violations;\n}\n\ninterface RangeInfo {\n name: string;\n startLine: number;\n endLine: number;\n}\n\n/**\n * Find route object ranges in *.routes.ts files.\n * A route object is an ObjectLiteralExpression that contains (directly or in descendants)\n * a `resolve` property. Returns the line range of each such top-level route object.\n */\nfunction findRouteObjectRanges(filePath: string, workspaceRoot: string): RangeInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const ranges: RangeInfo[] = [];\n\n function hasResolveProperty(node: ts.Node): boolean {\n if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && node.name.text === 'resolve') {\n return true;\n }\n let found = false;\n ts.forEachChild(node, (child) => {\n if (hasResolveProperty(child)) {\n found = true;\n }\n });\n return found;\n }\n\n function visitTopLevel(node: ts.Node): void {\n if (ts.isObjectLiteralExpression(node) && hasResolveProperty(node)) {\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n ranges.push({\n name: `route@${start.line + 1}`,\n startLine: start.line + 1,\n endLine: end.line + 1,\n });\n return;\n }\n ts.forEachChild(node, visitTopLevel);\n }\n\n visitTopLevel(sourceFile);\n return ranges;\n}\n\n/**\n * Find method/function ranges in *.component.ts files.\n * Returns ranges for class methods, function declarations, and arrow functions in variable declarations.\n */\nfunction findMethodRanges(filePath: string, workspaceRoot: string): RangeInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const ranges: RangeInfo[] = [];\n\n function visit(node: ts.Node): void {\n let methodName: string | undefined;\n let startLine: number | undefined;\n let endLine: number | undefined;\n\n if (ts.isMethodDeclaration(node) && node.name) {\n methodName = node.name.getText(sourceFile);\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n startLine = start.line + 1;\n endLine = end.line + 1;\n } else if (ts.isFunctionDeclaration(node) && node.name) {\n methodName = node.name.getText(sourceFile);\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n startLine = start.line + 1;\n endLine = end.line + 1;\n } else if (ts.isArrowFunction(node)) {\n if (ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name)) {\n methodName = node.parent.name.getText(sourceFile);\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n startLine = start.line + 1;\n endLine = end.line + 1;\n }\n }\n\n if (methodName && startLine !== undefined && endLine !== undefined) {\n ranges.push({ name: methodName, startLine, endLine });\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return ranges;\n}\n\n/**\n * NEW_AND_MODIFIED_METHODS mode: Flag violations in new/modified method/route scopes.\n * - For *.routes.ts: If any line in a route object is changed, flag all inject(XxxApi) violations in that route\n * - For *.component.ts: If a method is new/modified, flag all snapshot.data violations in that method\n */\n// webpieces-disable max-lines-new-methods -- Method-scoped validation with route objects and component methods\nfunction findViolationsForModifiedMethods(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean\n): Violation[] {\n const violations: Violation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const changedLines = getChangedLineNumbers(diff);\n const newMethodNames = findNewMethodSignaturesInDiff(diff);\n\n if (changedLines.size === 0 && newMethodNames.size === 0) continue;\n\n if (file.endsWith('.routes.ts')) {\n const routeRanges = findRouteObjectRanges(file, workspaceRoot);\n const allViolations = findDirectApiInjections(file, workspaceRoot, disableAllowed);\n\n for (const range of routeRanges) {\n let rangeHasChanges = false;\n for (let line = range.startLine; line <= range.endLine; line++) {\n if (changedLines.has(line)) {\n rangeHasChanges = true;\n break;\n }\n }\n if (!rangeHasChanges) continue;\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n if (v.line >= range.startLine && v.line <= range.endLine) {\n violations.push({\n file,\n line: v.line,\n column: v.column,\n context: v.context,\n });\n }\n }\n }\n } else if (file.endsWith('.component.ts')) {\n const methodRanges = findMethodRanges(file, workspaceRoot);\n const allViolations = findSnapshotDataAccess(file, workspaceRoot, disableAllowed);\n\n for (const range of methodRanges) {\n const isNewMethod = newMethodNames.has(range.name);\n let rangeHasChanges = false;\n if (!isNewMethod) {\n for (let line = range.startLine; line <= range.endLine; line++) {\n if (changedLines.has(line)) {\n rangeHasChanges = true;\n break;\n }\n }\n }\n if (!isNewMethod && !rangeHasChanges) continue;\n\n for (const v of allViolations) {\n if (disableAllowed && v.hasDisableComment) continue;\n if (v.line >= range.startLine && v.line <= range.endLine) {\n violations.push({\n file,\n line: v.line,\n column: v.column,\n context: v.context,\n });\n }\n }\n }\n }\n }\n\n return violations;\n}\n\n/**\n * Report violations to console.\n */\n// webpieces-disable max-lines-new-methods -- Console output with examples and escape hatch information\nfunction reportViolations(violations: Violation[], mode: NoDirectApiResolverMode, disableAllowed: boolean): void {\n console.error('');\n console.error('\\u274c Direct API usage in resolvers or snapshot.data in components found!');\n console.error('');\n console.error('\\ud83d\\udcda Resolvers should use services, and components should subscribe to service observables:');\n console.error('');\n console.error(' BAD (in *.routes.ts resolver):');\n console.error(' const myApi = inject(MyApi);');\n console.error(' resolve: () => inject(MyApi).fetchData()');\n console.error('');\n console.error(' GOOD (in *.routes.ts resolver):');\n console.error(' const myService = inject(MyService);');\n console.error(' resolve: () => inject(MyService).loadData()');\n console.error('');\n console.error(' BAD (in *.component.ts):');\n console.error(' const data = this.route.snapshot.data;');\n console.error('');\n console.error(' GOOD (in *.component.ts):');\n console.error(' this.myService.data$.subscribe(data => ...)');\n console.error('');\n\n for (const v of violations) {\n console.error(` \\u274c ${v.file}:${v.line}:${v.column}`);\n console.error(` ${v.context}`);\n }\n console.error('');\n\n if (disableAllowed) {\n console.error(' Escape hatch (use sparingly):');\n console.error(' // webpieces-disable no-direct-api-resolver -- [your reason]');\n } else {\n console.error(' Escape hatch: DISABLED (disableAllowed: false)');\n console.error(' Disable comments are ignored. Fix the pattern directly.');\n }\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\n/**\n * Resolve mode considering ignoreModifiedUntilEpoch override.\n * When active, downgrades to OFF. When expired, logs a warning.\n */\nfunction resolveMode(normalMode: NoDirectApiResolverMode, epoch: number | undefined): NoDirectApiResolverMode {\n if (epoch === undefined || normalMode === 'OFF') {\n return normalMode;\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n console.log(`\\n\\u23ed\\ufe0f Skipping no-direct-api-resolver validation (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);\n console.log('');\n return 'OFF';\n }\n return normalMode;\n}\n\n/**\n * Filter changed files to only those under enforcePaths (if configured).\n */\nfunction filterByEnforcePaths(changedFiles: string[], enforcePaths: string[] | undefined): string[] {\n if (!enforcePaths || enforcePaths.length === 0) {\n return changedFiles;\n }\n return changedFiles.filter((file) =>\n enforcePaths.some((prefix) => file.startsWith(prefix))\n );\n}\n\n/**\n * Filter to only relevant Angular files (*.routes.ts and *.component.ts).\n */\nfunction filterRelevantFiles(changedFiles: string[]): string[] {\n return changedFiles.filter((file) =>\n file.endsWith('.routes.ts') || file.endsWith('.component.ts')\n );\n}\n\nexport default async function runExecutor(\n options: ValidateNoDirectApiResolverOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const workspaceRoot = context.root;\n const mode: NoDirectApiResolverMode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);\n const disableAllowed = options.disableAllowed ?? true;\n\n if (mode === 'OFF') {\n console.log('\\n\\u23ed\\ufe0f Skipping no-direct-api-resolver validation (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n console.log('\\n\\ud83d\\udccf Validating No Direct API in Resolver\\n');\n console.log(` Mode: ${mode}`);\n\n let base = process.env['NX_BASE'];\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n base = detectBase(workspaceRoot) ?? undefined;\n\n if (!base) {\n console.log('\\n\\u23ed\\ufe0f Skipping no-direct-api-resolver validation (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const allChangedFiles = getChangedTypeScriptFiles(workspaceRoot, base, head);\n const scopedFiles = filterByEnforcePaths(allChangedFiles, options.enforcePaths);\n const changedFiles = filterRelevantFiles(scopedFiles);\n\n if (changedFiles.length === 0) {\n console.log('\\u2705 No relevant Angular files changed (*.routes.ts, *.component.ts)');\n return { success: true };\n }\n\n console.log(`\\ud83d\\udcc2 Checking ${changedFiles.length} changed file(s)...`);\n\n let violations: Violation[] = [];\n\n if (mode === 'MODIFIED_CODE') {\n violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);\n } else if (mode === 'NEW_AND_MODIFIED_METHODS') {\n violations = findViolationsForModifiedMethods(workspaceRoot, changedFiles, base, head, disableAllowed);\n } else if (mode === 'MODIFIED_FILES') {\n violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);\n }\n\n if (violations.length === 0) {\n console.log('\\u2705 No direct API resolver patterns found');\n return { success: true };\n }\n\n reportViolations(violations, mode, disableAllowed);\n\n return { success: false };\n}\n"]}
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
* ============================================================================
|
|
22
22
|
* MODES (LINE-BASED)
|
|
23
23
|
* ============================================================================
|
|
24
|
-
* - OFF:
|
|
25
|
-
* - MODIFIED_CODE:
|
|
26
|
-
* -
|
|
24
|
+
* - OFF: Skip validation entirely
|
|
25
|
+
* - MODIFIED_CODE: Flag violations on changed lines (lines in diff hunks)
|
|
26
|
+
* - NEW_AND_MODIFIED_METHODS: Flag violations in new/modified method/route scopes
|
|
27
|
+
* - MODIFIED_FILES: Flag ALL violations in files that were modified
|
|
27
28
|
*
|
|
28
29
|
* ============================================================================
|
|
29
30
|
* ESCAPE HATCH
|
|
@@ -38,9 +39,9 @@ import { execSync } from 'child_process';
|
|
|
38
39
|
import * as fs from 'fs';
|
|
39
40
|
import * as path from 'path';
|
|
40
41
|
import * as ts from 'typescript';
|
|
41
|
-
import { getFileDiff, getChangedLineNumbers } from '../diff-utils';
|
|
42
|
+
import { getFileDiff, getChangedLineNumbers, findNewMethodSignaturesInDiff } from '../diff-utils';
|
|
42
43
|
|
|
43
|
-
export type NoDirectApiResolverMode = 'OFF' | 'MODIFIED_CODE' | 'MODIFIED_FILES';
|
|
44
|
+
export type NoDirectApiResolverMode = 'OFF' | 'MODIFIED_CODE' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';
|
|
44
45
|
|
|
45
46
|
export interface ValidateNoDirectApiResolverOptions {
|
|
46
47
|
mode?: NoDirectApiResolverMode;
|
|
@@ -332,6 +333,191 @@ function findViolationsForModifiedFiles(workspaceRoot: string, changedFiles: str
|
|
|
332
333
|
return violations;
|
|
333
334
|
}
|
|
334
335
|
|
|
336
|
+
interface RangeInfo {
|
|
337
|
+
name: string;
|
|
338
|
+
startLine: number;
|
|
339
|
+
endLine: number;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Find route object ranges in *.routes.ts files.
|
|
344
|
+
* A route object is an ObjectLiteralExpression that contains (directly or in descendants)
|
|
345
|
+
* a `resolve` property. Returns the line range of each such top-level route object.
|
|
346
|
+
*/
|
|
347
|
+
function findRouteObjectRanges(filePath: string, workspaceRoot: string): RangeInfo[] {
|
|
348
|
+
const fullPath = path.join(workspaceRoot, filePath);
|
|
349
|
+
if (!fs.existsSync(fullPath)) return [];
|
|
350
|
+
|
|
351
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
352
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
353
|
+
|
|
354
|
+
const ranges: RangeInfo[] = [];
|
|
355
|
+
|
|
356
|
+
function hasResolveProperty(node: ts.Node): boolean {
|
|
357
|
+
if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && node.name.text === 'resolve') {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
let found = false;
|
|
361
|
+
ts.forEachChild(node, (child) => {
|
|
362
|
+
if (hasResolveProperty(child)) {
|
|
363
|
+
found = true;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
return found;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function visitTopLevel(node: ts.Node): void {
|
|
370
|
+
if (ts.isObjectLiteralExpression(node) && hasResolveProperty(node)) {
|
|
371
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
372
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
373
|
+
ranges.push({
|
|
374
|
+
name: `route@${start.line + 1}`,
|
|
375
|
+
startLine: start.line + 1,
|
|
376
|
+
endLine: end.line + 1,
|
|
377
|
+
});
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
ts.forEachChild(node, visitTopLevel);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
visitTopLevel(sourceFile);
|
|
384
|
+
return ranges;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Find method/function ranges in *.component.ts files.
|
|
389
|
+
* Returns ranges for class methods, function declarations, and arrow functions in variable declarations.
|
|
390
|
+
*/
|
|
391
|
+
function findMethodRanges(filePath: string, workspaceRoot: string): RangeInfo[] {
|
|
392
|
+
const fullPath = path.join(workspaceRoot, filePath);
|
|
393
|
+
if (!fs.existsSync(fullPath)) return [];
|
|
394
|
+
|
|
395
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
396
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
397
|
+
|
|
398
|
+
const ranges: RangeInfo[] = [];
|
|
399
|
+
|
|
400
|
+
function visit(node: ts.Node): void {
|
|
401
|
+
let methodName: string | undefined;
|
|
402
|
+
let startLine: number | undefined;
|
|
403
|
+
let endLine: number | undefined;
|
|
404
|
+
|
|
405
|
+
if (ts.isMethodDeclaration(node) && node.name) {
|
|
406
|
+
methodName = node.name.getText(sourceFile);
|
|
407
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
408
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
409
|
+
startLine = start.line + 1;
|
|
410
|
+
endLine = end.line + 1;
|
|
411
|
+
} else if (ts.isFunctionDeclaration(node) && node.name) {
|
|
412
|
+
methodName = node.name.getText(sourceFile);
|
|
413
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
414
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
415
|
+
startLine = start.line + 1;
|
|
416
|
+
endLine = end.line + 1;
|
|
417
|
+
} else if (ts.isArrowFunction(node)) {
|
|
418
|
+
if (ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name)) {
|
|
419
|
+
methodName = node.parent.name.getText(sourceFile);
|
|
420
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
421
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
422
|
+
startLine = start.line + 1;
|
|
423
|
+
endLine = end.line + 1;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
if (methodName && startLine !== undefined && endLine !== undefined) {
|
|
428
|
+
ranges.push({ name: methodName, startLine, endLine });
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
ts.forEachChild(node, visit);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
visit(sourceFile);
|
|
435
|
+
return ranges;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* NEW_AND_MODIFIED_METHODS mode: Flag violations in new/modified method/route scopes.
|
|
440
|
+
* - For *.routes.ts: If any line in a route object is changed, flag all inject(XxxApi) violations in that route
|
|
441
|
+
* - For *.component.ts: If a method is new/modified, flag all snapshot.data violations in that method
|
|
442
|
+
*/
|
|
443
|
+
// webpieces-disable max-lines-new-methods -- Method-scoped validation with route objects and component methods
|
|
444
|
+
function findViolationsForModifiedMethods(
|
|
445
|
+
workspaceRoot: string,
|
|
446
|
+
changedFiles: string[],
|
|
447
|
+
base: string,
|
|
448
|
+
head: string | undefined,
|
|
449
|
+
disableAllowed: boolean
|
|
450
|
+
): Violation[] {
|
|
451
|
+
const violations: Violation[] = [];
|
|
452
|
+
|
|
453
|
+
for (const file of changedFiles) {
|
|
454
|
+
const diff = getFileDiff(workspaceRoot, file, base, head);
|
|
455
|
+
const changedLines = getChangedLineNumbers(diff);
|
|
456
|
+
const newMethodNames = findNewMethodSignaturesInDiff(diff);
|
|
457
|
+
|
|
458
|
+
if (changedLines.size === 0 && newMethodNames.size === 0) continue;
|
|
459
|
+
|
|
460
|
+
if (file.endsWith('.routes.ts')) {
|
|
461
|
+
const routeRanges = findRouteObjectRanges(file, workspaceRoot);
|
|
462
|
+
const allViolations = findDirectApiInjections(file, workspaceRoot, disableAllowed);
|
|
463
|
+
|
|
464
|
+
for (const range of routeRanges) {
|
|
465
|
+
let rangeHasChanges = false;
|
|
466
|
+
for (let line = range.startLine; line <= range.endLine; line++) {
|
|
467
|
+
if (changedLines.has(line)) {
|
|
468
|
+
rangeHasChanges = true;
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if (!rangeHasChanges) continue;
|
|
473
|
+
|
|
474
|
+
for (const v of allViolations) {
|
|
475
|
+
if (disableAllowed && v.hasDisableComment) continue;
|
|
476
|
+
if (v.line >= range.startLine && v.line <= range.endLine) {
|
|
477
|
+
violations.push({
|
|
478
|
+
file,
|
|
479
|
+
line: v.line,
|
|
480
|
+
column: v.column,
|
|
481
|
+
context: v.context,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
} else if (file.endsWith('.component.ts')) {
|
|
487
|
+
const methodRanges = findMethodRanges(file, workspaceRoot);
|
|
488
|
+
const allViolations = findSnapshotDataAccess(file, workspaceRoot, disableAllowed);
|
|
489
|
+
|
|
490
|
+
for (const range of methodRanges) {
|
|
491
|
+
const isNewMethod = newMethodNames.has(range.name);
|
|
492
|
+
let rangeHasChanges = false;
|
|
493
|
+
if (!isNewMethod) {
|
|
494
|
+
for (let line = range.startLine; line <= range.endLine; line++) {
|
|
495
|
+
if (changedLines.has(line)) {
|
|
496
|
+
rangeHasChanges = true;
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (!isNewMethod && !rangeHasChanges) continue;
|
|
502
|
+
|
|
503
|
+
for (const v of allViolations) {
|
|
504
|
+
if (disableAllowed && v.hasDisableComment) continue;
|
|
505
|
+
if (v.line >= range.startLine && v.line <= range.endLine) {
|
|
506
|
+
violations.push({
|
|
507
|
+
file,
|
|
508
|
+
line: v.line,
|
|
509
|
+
column: v.column,
|
|
510
|
+
context: v.context,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return violations;
|
|
519
|
+
}
|
|
520
|
+
|
|
335
521
|
/**
|
|
336
522
|
* Report violations to console.
|
|
337
523
|
*/
|
|
@@ -463,6 +649,8 @@ export default async function runExecutor(
|
|
|
463
649
|
|
|
464
650
|
if (mode === 'MODIFIED_CODE') {
|
|
465
651
|
violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
652
|
+
} else if (mode === 'NEW_AND_MODIFIED_METHODS') {
|
|
653
|
+
violations = findViolationsForModifiedMethods(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
466
654
|
} else if (mode === 'MODIFIED_FILES') {
|
|
467
655
|
violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);
|
|
468
656
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"properties": {
|
|
7
7
|
"mode": {
|
|
8
8
|
"type": "string",
|
|
9
|
-
"enum": ["OFF", "MODIFIED_CODE", "MODIFIED_FILES"],
|
|
10
|
-
"description": "OFF: skip validation. MODIFIED_CODE: only changed lines in diff. MODIFIED_FILES: all in modified files.",
|
|
9
|
+
"enum": ["OFF", "MODIFIED_CODE", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"],
|
|
10
|
+
"description": "OFF: skip validation. MODIFIED_CODE: only changed lines in diff. NEW_AND_MODIFIED_METHODS: violations in new/modified method/route scopes. MODIFIED_FILES: all in modified files.",
|
|
11
11
|
"default": "OFF"
|
|
12
12
|
},
|
|
13
13
|
"disableAllowed": {
|