Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,18 @@ export interface ExitResult {
exitWithError: boolean;
}

/**
* Result of applying fixes to environment files.
*/
export interface FixResult {
/** List of removed duplicate keys */
removedDuplicates: string[];
/** List of added environment variables */
addedEnv: string[];
/** Whether the .gitignore file was updated */
gitignoreUpdated: boolean;
}

/**
* Warning about environment variable keys that are not uppercase.
*/
Expand Down
13 changes: 1 addition & 12 deletions src/core/fixEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fs from 'fs';
import path from 'path';
import { isEnvIgnoredByGit, isGitRepo, findGitRoot } from '../services/git.js';
import { DEFAULT_GITIGNORE_ENV_PATTERNS } from '../config/constants.js';
import type { FixResult } from '../config/types.js';

/**
* Options for applying fixes to environment files
Expand All @@ -17,18 +18,6 @@ interface ApplyFixesOptions {
ensureGitignore?: boolean;
}

/**
* Result of applying fixes to environment files
*/
interface FixResult {
/** List of removed duplicate keys */
removedDuplicates: string[];
/** List of added environment variables */
addedEnv: string[];
/** Whether the .gitignore file was updated */
gitignoreUpdated: boolean;
}

/**
* Applies fixes to the .env file based on the detected issues.
*
Expand Down
11 changes: 3 additions & 8 deletions src/services/printScanResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
ScanUsageOptions,
ScanResult,
ExitResult,
FixResult,
} from '../config/types.js';
import { DEFAULT_ENV_FILE } from '../config/constants.js';
import { printHeader } from '../ui/scan/printHeader.js';
Expand All @@ -26,17 +27,11 @@ import { printExpireWarnings } from '../ui/scan/printExpireWarnings.js';
import { printInconsistentNamingWarning } from '../ui/scan/printInconsistentNamingWarning.js';

/**
* Context for auto-fix operations
* Context for auto-fix operations, extending FixResult with applied status
*/
interface FixContext {
interface FixContext extends FixResult {
/** Whether any fixes were applied */
fixApplied: boolean;
/** List of removed duplicate keys */
removedDuplicates: string[];
/** List of added environment variables */
addedEnv: string[];
/** Whether the .gitignore file was updated */
gitignoreUpdated: boolean;
}

/**
Expand Down
Loading