Skip to content

Commit

Permalink
Move depth === 0 check to reflect original intent
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Oct 22, 2024
1 parent 42038a1 commit 602f730
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/util/file_reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ async function collectLocalPathBehaviors(
];
}

if (depth === 0) {
logger.warn(
`The provided path "${resolvedPath}" is not a .js file or directory.`,
{},
"behavior",
);
return [];
}

const behaviors: FileSources = [];

if (stat.isDirectory()) {
Expand All @@ -103,6 +94,15 @@ async function collectLocalPathBehaviors(
const newBehaviors = await collectLocalPathBehaviors(file, depth + 1);
behaviors.push(...newBehaviors);
}
} else {
if (depth === 0) {
logger.warn(
`The provided path "${resolvedPath}" is not a .js file or directory.`,
{},
"behavior",
);
return [];
}
}

return behaviors;
Expand Down

0 comments on commit 602f730

Please sign in to comment.