Skip to content

Commit

Permalink
Address feedback (final)
Browse files Browse the repository at this point in the history
  • Loading branch information
kemmerle committed Oct 5, 2023
1 parent a15964c commit 99a6bed
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ en:
securityIssue: "Security Issue Detected"
configFileTracked: "The HubSpot config file can be tracked by git."
fileName: 'File: "{{ configPath }}"'
remediate: "To remediate:
\n- Move the config file to your home directory: '{{ homeDir }}'
\n- Add gitignore pattern '{{ configPath }}' to a .gitignore file in root of your repository.
\n- Ensure that the config file has not already been pushed to a remote repository."
remediate: "To remediate:"
moveConfig: "- Move the config file to your home directory: '{{ homeDir }}'"
addGitignore: "- Add gitignore pattern '{{ configPath }}' to a .gitignore file in root of your repository."
noRemote: "- Ensure that the config file has not already been pushed to a remote repository."
checkFailed: "Unable to determine if config file is properly ignored by git."
modules:
createModule:
Expand Down
11 changes: 8 additions & 3 deletions lib/loggingUtils/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ export function checkAndWarnGitInclusion(configPath: string): void {
logger.warn(i18n(`${i18nKey}.securityIssue`));
logger.warn(i18n(`${i18nKey}.configFileTracked`));
logger.warn(i18n(`${i18nKey}.fileName`, { configPath }));
logger.warn(i18n(`${i18nKey}.remediate`, { homeDir: os.homedir(), configPath }));
logger.warn(i18n(`${i18nKey}.remediate`));
logger.log('');
logger.warn(i18n(`${i18nKey}.moveConfig`, { homeDir: os.homedir() }));
logger.log('');
logger.warn(i18n(`${i18nKey}.addGitignore`, { configPath }));
logger.log('');
logger.warn(i18n(`${i18nKey}.noRemote`));
} catch (e) {
// fail silently
logger.debug(i18n(`${i18nKey}.checkFailed`));
Expand All @@ -36,8 +42,7 @@ export function checkAndUpdateGitignore(configPath: string): void {
if (!gitignoreFilePath) {
gitignoreFilePath = path.resolve(configPath, GITIGNORE_FILE);

// TODO: Figure out if this ever worked
// fs.writeFileSync(gitignoreFilePath);
fs.writeFileSync(gitignoreFilePath, '');
}

const gitignoreContents = fs.readFileSync(gitignoreFilePath).toString();
Expand Down
1 change: 0 additions & 1 deletion lib/loggingUtils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export function stylize(label: string, style: (...text: unknown[]) => string, ar
return [styledLabel, ...args];
}

// TODO: Eliminate the args parameter; it's too broad.
export class Logger {
error(...args:any[]) {
console.error(...stylize('[ERROR]', Styles.error, args));
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"./github": "./lib/github.js",
"./ignoreRules": "./lib/ignoreRules.js",
"./path": "./lib/path.js",
"./loggingUtils": "./lib/loggingUtils/index.js"
"./loggingUtils": "./lib/loggingUtils/index.js",
"./logger": "./lib/loggingUtils/logger.js"
},
"dependencies": {
"axios": "^1.3.5",
Expand Down

0 comments on commit 99a6bed

Please sign in to comment.