@@ -14,6 +14,7 @@ import { printComparisonError } from '../ui/scan/printComparisonError.js';
1414import { hasIgnoreComment } from '../core/security/secretDetectors.js' ;
1515import { frameworkValidator } from '../core/frameworks/frameworkValidator.js' ;
1616import { detectSecretsInExample } from '../core/security/exampleSecretDetector.js' ;
17+ import { DEFAULT_EXAMPLE_FILE } from '../config/constants.js' ;
1718
1819/**
1920 * Scans the codebase for environment variable usage and compares it with
@@ -86,7 +87,9 @@ export async function scanUsage(opts: ScanUsageOptions): Promise<ExitResult> {
8687 } else {
8788 scanResult = result . scanResult ;
8889 comparedAgainst = result . comparedAgainst ;
89- duplicatesFound = result . duplicatesFound ;
90+ if ( result . duplicatesFound ) {
91+ duplicatesFound = result . duplicatesFound ;
92+ }
9093 fixApplied = result . fixApplied ;
9194 removedDuplicates = result . removedDuplicates ;
9295 fixedKeys = result . addedEnv ;
@@ -101,7 +104,7 @@ export async function scanUsage(opts: ScanUsageOptions): Promise<ExitResult> {
101104 scanResult . inconsistentNamingWarnings =
102105 result . inconsistentNamingWarnings ;
103106 }
104- if ( result . exampleFull && result . comparedAgainst === '.env.example' ) {
107+ if ( result . exampleFull && result . comparedAgainst === DEFAULT_EXAMPLE_FILE ) {
105108 scanResult . exampleWarnings = detectSecretsInExample ( result . exampleFull ) ;
106109 }
107110 }
@@ -128,7 +131,6 @@ export async function scanUsage(opts: ScanUsageOptions): Promise<ExitResult> {
128131 return {
129132 exitWithError :
130133 scanResult . missing . length > 0 ||
131- duplicatesFound ||
132134 hasHighSeveritySecrets ||
133135 hasHighSeverityExampleWarnings ||
134136 ! ! (
@@ -155,7 +157,7 @@ export async function scanUsage(opts: ScanUsageOptions): Promise<ExitResult> {
155157 gitignoreUpdated,
156158 } ) ;
157159
158- return { exitWithError : result . exitWithError || duplicatesFound } ;
160+ return { exitWithError : result . exitWithError } ;
159161}
160162
161163/**
0 commit comments