Skip to content

Commit 3776563

Browse files
committed
small fixes
1 parent 07a5a48 commit 3776563

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/core/entropy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function shannonEntropyNormalized(s: string): number {
1414
const p = c / len;
1515
H += -p * Math.log2(p);
1616
}
17-
// Antag alfabet ~72 tegn (A-Za-z0-9+/_- mv.)
17+
// Normalize by the maximum possible entropy for the character set (assuming 72 possible characters)
1818
const maxH = Math.log2(72);
1919
return Math.min(1, H / maxH);
2020
}

src/core/fixEnv.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import fs from 'fs';
22
import path from 'path';
33
import { isEnvIgnoredByGit, isGitRepo, findGitRoot } from '../services/git.js';
44

5-
export type ApplyFixesOptions = {
5+
interface ApplyFixesOptions {
66
envPath: string;
77
examplePath: string;
88
missingKeys: string[];
99
duplicateKeys: string[];
1010
ensureGitignore?: boolean;
11-
};
11+
}
1212

13-
export type FixResult = {
13+
interface FixResult {
1414
removedDuplicates: string[];
1515
addedEnv: string[];
1616
addedExample: string[];
1717
gitignoreUpdated: boolean;
18-
};
18+
}
1919

2020
/**
2121
* Applies fixes to the .env and .env.example files based on the detected issues.
@@ -33,7 +33,7 @@ export function applyFixes(options: ApplyFixesOptions): {
3333
changed: boolean;
3434
result: FixResult;
3535
} {
36-
const { envPath, examplePath, missingKeys, duplicateKeys, ensureGitignore } =
36+
const { envPath, examplePath, missingKeys = [], duplicateKeys = [], ensureGitignore = false } =
3737
options;
3838

3939
const result: FixResult = {

src/core/helpers/resolveFromCwd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import path from 'path';
66
* @param p - Path to resolve
77
* @returns Resolved absolute path
88
*/
9-
export const resolveFromCwd = (cwd: string, p: string) =>
9+
export const resolveFromCwd = (cwd: string, p: string): string =>
1010
path.isAbsolute(p) ? p : path.resolve(cwd, p);

0 commit comments

Comments
 (0)