refactor!: change findUp signature, support search root#408
Conversation
🦋 Changeset detectedLatest commit: 0bc4a98 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe update refactors the Changes
Error: Could not generate a valid Mermaid diagram after multiple attempts.
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/core/src/helpers.tsOops! Something went wrong! :( ESLint: 9.28.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.js ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the findUp function signature to support a custom search root and introduces new file type definitions while updating Node engine requirements and GitHub Actions versions.
- Refactored the findUp signature to accept an options object with additional file search parameters.
- Added new types and improved file lookup functions (tryFileStats and tryFile).
- Updated Node.js engine requirements and GitHub Actions checkout versions.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/helpers.ts | Modified file lookup functions and refactored findUp to support a search root. |
| packages/core/package.json | Updated Node engine version requirements. |
| .github/workflows/vercel.yml | Updated checkout action version. |
| .github/workflows/release.yml | Updated checkout action version. |
| .github/workflows/pkg-size.yml | Updated checkout action version. |
| .github/workflows/pkg-pr-new.yml | Updated checkout action version. |
| .github/workflows/ci.yml | Updated checkout action version. |
| .github/workflows/autofix.yml | Updated checkout action version. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #408 +/- ##
=========================================
- Coverage 9.85% 9.13% -0.73%
=========================================
Files 12 12
Lines 426 460 +34
Branches 186 206 +20
=========================================
Hits 42 42
- Misses 384 418 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@pkgr/browser
@pkgr/core
@pkgr/es-modules
@pkgr/imagemin
@pkgr/rollup
@pkgr/umd-globals
@pkgr/utils
commit: |
|
Deploy preview for pkgr ready! ✅ Preview Built with commit 0bc4a98. |
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed everything up to 08ed60d in 2 minutes and 18 seconds. Click for details.
- Reviewed
253lines of code in8files - Skipped
0files when reviewing. - Skipped posting
1draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/core/package.json:11
- Draft comment:
Node engine support was changed by dropping Node 12. Confirm that this breaking change is intentional. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment violates the rule about not asking authors to confirm their intentions. The change is clear and deliberate - they specifically removed Node 12 from the engines field. This is a common type of breaking change when dropping support for older Node versions. There's no ambiguity here that needs confirmation. The comment does point out an important breaking change that could affect users. Maybe it's valuable to highlight this? While breaking changes are important, the rules explicitly state not to ask authors to confirm their intentions. The author clearly made this change deliberately. Delete the comment. Asking for confirmation of an intentional breaking change violates the review rules and adds no value.
Workflow ID: wflow_lciWVpm9vDz0bsAK
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 933debc in 1 minute and 52 seconds. Click for details.
- Reviewed
264lines of code in9files - Skipped
0files when reviewing. - Skipped posting
5draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/core/package.json:11
- Draft comment:
Breaking: Node engine update drops Node 12 support. Ensure consumers are aware and documentation is updated. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =20%<= threshold50%The comment is informative and suggests ensuring that consumers are aware and documentation is updated. It doesn't provide a specific code suggestion or ask for a specific test to be written. It also doesn't ask for confirmation of intention in a specific way. Therefore, it seems to violate the rules.
2. packages/core/src/helpers.ts:37
- Draft comment:
Redundant check for 'type' since it's already defaulted to 'file' in the function signature. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the default parameter prevents undefined, the check !type would also catch false and empty arrays, which are valid FileTypes values. This makes the check actually useful as a way to normalize falsy values to 'file'. The comment is incorrect in assuming the check is redundant just because of the default parameter. Am I sure that normalizing falsy values to 'file' is the intended behavior? Maybe this is actually a bug and falsy values should be handled differently? Given that 'file' is used as both the default parameter and the fallback value in the check, it seems this normalization is intentional design rather than a bug. The comment should be deleted because the check serves a purpose beyond just handling undefined - it normalizes any falsy FileTypes value to 'file'.
3. packages/core/src/helpers.ts:46
- Draft comment:
Dynamic property access on 'stats' may risk runtime errors if an invalid 'type' is passed. Consider validating supported types. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The code is actually well-typed and safe. FileTypeBase type ensures only valid values can be passed. The type casting ensures TypeScript knows it's safe. The capitalization logic matches the fs.Stats method names exactly. The isAnyFileType check provides an escape hatch. This is a common pattern for type-safe dynamic property access. I could be overlooking edge cases where the type parameter could be manipulated at runtime to contain invalid values despite the TypeScript types. Even with runtime manipulation, the code would still only access properties that match the pattern is[Type] where Type is capitalized - these correspond exactly to the fs.Stats methods. The comment should be deleted as the dynamic property access is actually type-safe and well-designed.
4. packages/core/src/helpers.ts:122
- Draft comment:
The loop termination condition in findUp is non-intuitive. Consider revising it (possibly using '&&' instead of '||') for clarity and correctness. - Reason this comment was not posted:
Comment looked like it was already resolved.
5. packages/core/src/helpers.ts:81
- Draft comment:
Breaking change: 'findUp' signature now accepts an options object instead of a simple string. Ensure all consumers are updated and docs reflect the new API. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is informative and suggests ensuring that all consumers are updated and documentation reflects the new API. It doesn't provide a specific code suggestion or ask for a test to be written. It violates the rule against making purely informative comments.
Workflow ID: wflow_aMMiArjuoMWIES98
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (3)
packages/core/src/helpers.ts (3)
74-79: Add documentation for theFindUpOptionsinterface.Please add JSDoc comments to describe each property and their expected usage for better developer experience.
+/** + * Options for the findUp function + * @property {string} [entry] - The starting directory or file path for the search + * @property {string} [filename] - The filename to search for + * @property {FileType} [type] - The expected file type + * @property {string} [stop] - The directory path where the search should stop + */ export interface FindUpOptions { entry?: string filename?: string type?: FileType stop?: string }
37-39:⚠️ Potential issueCheck for
undefinedinstead of falsy values.Using
!typemay override an explicitfalsevalue. Consider checking specifically forundefined.- if (!type) { - type = 'file' - } + if (type === undefined) { + type = 'file' + }🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 38-38: packages/core/src/helpers.ts#L38
Added line #L38 was not covered by tests
122-122:⚠️ Potential issueFix the while loop condition to prevent potential infinite loops.
The current condition has logical issues:
- If
stopis undefined, the loop continues indefinitely due to!stop- The condition continues when
entrystarts with the stop path, which seems backwards- } while (!stop || entry !== stop || entry.startsWith(stop + path.sep)) + } while (!stop || (entry !== stop && entry.startsWith(stop + path.sep)))
🧹 Nitpick comments (1)
.changeset/poor-walls-arrive.md (1)
5-5: Include package scope in the summary.To improve clarity in your changelog and align with Conventional Commits, consider adding the package scope in the summary. For example:
refactor(core)!: change `findUp` signature, support search rootThis makes it explicit which package is affected.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
.changeset/poor-walls-arrive.md(1 hunks).github/workflows/autofix.yml(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/pkg-pr-new.yml(1 hunks).github/workflows/pkg-size.yml(1 hunks).github/workflows/release.yml(1 hunks).github/workflows/vercel.yml(1 hunks)packages/core/package.json(1 hunks)packages/core/src/helpers.ts(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/core/src/helpers.ts (1)
packages/core/src/constants.ts (2)
CWD(5-5)EXTENSIONS(20-20)
🪛 GitHub Check: codecov/patch
packages/core/src/helpers.ts
[warning] 12-12: packages/core/src/helpers.ts#L12
Added line #L12 was not covered by tests
[warning] 27-27: packages/core/src/helpers.ts#L27
Added line #L27 was not covered by tests
[warning] 29-30: packages/core/src/helpers.ts#L29-L30
Added lines #L29 - L30 were not covered by tests
[warning] 32-32: packages/core/src/helpers.ts#L32
Added line #L32 was not covered by tests
[warning] 36-36: packages/core/src/helpers.ts#L36
Added line #L36 was not covered by tests
[warning] 38-38: packages/core/src/helpers.ts#L38
Added line #L38 was not covered by tests
[warning] 43-43: packages/core/src/helpers.ts#L43
Added line #L43 was not covered by tests
[warning] 45-45: packages/core/src/helpers.ts#L45
Added line #L45 was not covered by tests
[warning] 47-47: packages/core/src/helpers.ts#L47
Added line #L47 was not covered by tests
[warning] 51-52: packages/core/src/helpers.ts#L51-L52
Added lines #L51 - L52 were not covered by tests
[warning] 56-56: packages/core/src/helpers.ts#L56
Added line #L56 was not covered by tests
[warning] 58-58: packages/core/src/helpers.ts#L58
Added line #L58 was not covered by tests
[warning] 63-63: packages/core/src/helpers.ts#L63
Added line #L63 was not covered by tests
[warning] 86-86: packages/core/src/helpers.ts#L86
Added line #L86 was not covered by tests
[warning] 95-95: packages/core/src/helpers.ts#L95
Added line #L95 was not covered by tests
[warning] 98-98: packages/core/src/helpers.ts#L98
Added line #L98 was not covered by tests
[warning] 104-104: packages/core/src/helpers.ts#L104
Added line #L104 was not covered by tests
[warning] 107-107: packages/core/src/helpers.ts#L107
Added line #L107 was not covered by tests
[warning] 113-113: packages/core/src/helpers.ts#L113
Added line #L113 was not covered by tests
[warning] 117-118: packages/core/src/helpers.ts#L117-L118
Added lines #L117 - L118 were not covered by tests
[warning] 120-120: packages/core/src/helpers.ts#L120
Added line #L120 was not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (7)
.github/workflows/autofix.yml (1)
19-19: Consistent checkout action version pinning
Theactions/checkoutstep now explicitly annotatesv4.2.2, matching the pinned SHA and aligning with other workflows. Improves clarity on the exact version in use..github/workflows/pkg-size.yml (1)
19-19: Consistent checkout action version pinning
Updated theactions/checkoutstep to annotatev4.2.2alongside the existing SHA, keeping it in sync with the other CI workflows..github/workflows/ci.yml (1)
28-28: Consistent checkout action version pinning
Theactions/checkoutstep now includes the precisev4.2.2tag comment, matching the SHA and other workflows for consistency..github/workflows/pkg-pr-new.yml (1)
16-16: Consistent checkout action version pinning
Changed the checkout step’s comment tov4.2.2to reflect the exact sub-version being used, in line with the repository’s workflow standards..github/workflows/release.yml (1)
23-23: Consistent checkout action version pinning
Theactions/checkoutstep now clearly referencesv4.2.2in its comment, mirroring the pinned SHA and matching other workflows..github/workflows/vercel.yml (1)
18-18: LGTM! Documentation improvement.Good practice to specify the exact version tag in the comment for better clarity and traceability.
packages/core/package.json (1)
11-12: Breaking change acknowledged - Node 12 support dropped.This change drops support for Node.js 12.x, which aligns with the breaking refactor of the
findUpfunction. Since Node 12 reached end-of-life in April 2022, this is a reasonable update.Ensure this breaking change is properly documented in the changelog and release notes.
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed 52bbbaa in 2 minutes and 2 seconds. Click for details.
- Reviewed
261lines of code in9files - Skipped
0files when reviewing. - Skipped posting
4draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/autofix.yml:19
- Draft comment:
Good update: the checkout action is now pinned to v4.2.2 for consistency. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. packages/core/package.json:11
- Draft comment:
Node v12 support was removed. Ensure that documentation and release notes clearly communicate this breaking change. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is asking the PR author to ensure that documentation and release notes communicate a breaking change. This falls under the rule of not asking the author to update the PR description or ensure certain things are communicated, which is not allowed.
3. packages/core/src/helpers.ts:108
- Draft comment:
The while loop's termination condition 'while (!stop || entry !== stop)' in findUp is a bit unintuitive. Consider adding comments or refactoring for clarity when a 'stop' parameter is provided. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The condition is actually logical - it continues while either there's no stop directory specified (!stop) OR we haven't reached the stop directory yet (entry !== stop). While not immediately obvious, it's a valid implementation. The comment suggests adding documentation but doesn't propose a specific better implementation. Comments requesting documentation without specific suggestions are generally not actionable enough. The condition could be confusing to future maintainers. The logic for handling the stop directory is a key part of the function's behavior. While the code could be more clear, the comment doesn't provide concrete suggestions for improvement. The logic, while terse, is correct and follows common patterns for directory traversal. Delete the comment as it doesn't provide specific, actionable feedback for improving the code. The logic, while compact, is correct and follows standard patterns.
4. packages/core/src/helpers.ts:81
- Draft comment:
Consider renaming the 'entry' parameter (and its derived variable) to something like 'startDir' for improved clarity in the findUp function. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_5gfnwef0BpoY1cWo
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (3)
packages/core/src/helpers.ts (3)
37-39: Fix type checking logic to handle explicit boolean values correctly.This issue was previously identified but remains unresolved. The current logic
if (!type)will incorrectly treat an explicitfalsevalue as falsy and default to'file', which may not be the intended behavior.Apply this fix to handle undefined values explicitly:
- if (!type) { - type = 'file' - } + if (type === undefined) { + type = 'file' + }🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 38-38: packages/core/src/helpers.ts#L38
Added line #L38 was not covered by tests
74-81: Add comprehensive documentation for the FindUpOptions interface.The interface lacks documentation describing the purpose and expected usage of each property, making it difficult for consumers to understand the API.
Add JSDoc comments to document each property:
+/** + * Options for configuring the findUp function behavior + */ export interface FindUpOptions { + /** Starting directory or file path for the search */ entry?: string + /** Target filename or pattern to search for */ search?: string + /** Expected file type (file, directory, etc.) */ type?: FileType + /** Directory path where the search should stop */ stop?: string + /** Whether to throw an error if the stop path is not found */ throwOnStopNotFound?: boolean + /** Whether to throw an error if the stop path is invalid */ throwOnInvalidStop?: boolean }
32-157: Critical: Add comprehensive test coverage for the refactored functions.The static analysis shows extensive gaps in test coverage for the new and refactored functions. Given this is a breaking change with complex validation logic, comprehensive tests are essential.
Let me verify the current test coverage:
#!/bin/bash # Check for existing tests related to the helper functions rg -n "tryFileStats|tryFile|findUp" --glob "*.test.*" --glob "*.spec.*" -A 3 -B 3 # Check for test files in the core package fd -e test.ts -e test.js -e spec.ts -e spec.js . packages/core/🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 32-32: packages/core/src/helpers.ts#L32
Added line #L32 was not covered by tests
[warning] 36-36: packages/core/src/helpers.ts#L36
Added line #L36 was not covered by tests
[warning] 38-38: packages/core/src/helpers.ts#L38
Added line #L38 was not covered by tests
[warning] 43-43: packages/core/src/helpers.ts#L43
Added line #L43 was not covered by tests
[warning] 45-45: packages/core/src/helpers.ts#L45
Added line #L45 was not covered by tests
[warning] 47-47: packages/core/src/helpers.ts#L47
Added line #L47 was not covered by tests
[warning] 51-52: packages/core/src/helpers.ts#L51-L52
Added lines #L51 - L52 were not covered by tests
[warning] 56-56: packages/core/src/helpers.ts#L56
Added line #L56 was not covered by tests
[warning] 58-58: packages/core/src/helpers.ts#L58
Added line #L58 was not covered by tests
[warning] 63-63: packages/core/src/helpers.ts#L63
Added line #L63 was not covered by tests
[warning] 89-89: packages/core/src/helpers.ts#L89
Added line #L89 was not covered by tests
[warning] 105-105: packages/core/src/helpers.ts#L105
Added line #L105 was not covered by tests
[warning] 109-109: packages/core/src/helpers.ts#L109
Added line #L109 was not covered by tests
[warning] 111-111: packages/core/src/helpers.ts#L111
Added line #L111 was not covered by tests
[warning] 113-113: packages/core/src/helpers.ts#L113
Added line #L113 was not covered by tests
[warning] 115-115: packages/core/src/helpers.ts#L115
Added line #L115 was not covered by tests
[warning] 117-117: packages/core/src/helpers.ts#L117
Added line #L117 was not covered by tests
[warning] 120-121: packages/core/src/helpers.ts#L120-L121
Added lines #L120 - L121 were not covered by tests
[warning] 124-124: packages/core/src/helpers.ts#L124
Added line #L124 was not covered by tests
[warning] 126-126: packages/core/src/helpers.ts#L126
Added line #L126 was not covered by tests
[warning] 128-128: packages/core/src/helpers.ts#L128
Added line #L128 was not covered by tests
[warning] 130-130: packages/core/src/helpers.ts#L130
Added line #L130 was not covered by tests
[warning] 134-134: packages/core/src/helpers.ts#L134
Added line #L134 was not covered by tests
[warning] 137-137: packages/core/src/helpers.ts#L137
Added line #L137 was not covered by tests
[warning] 141-142: packages/core/src/helpers.ts#L141-L142
Added lines #L141 - L142 were not covered by tests
[warning] 145-145: packages/core/src/helpers.ts#L145
Added line #L145 was not covered by tests
[warning] 149-150: packages/core/src/helpers.ts#L149-L150
Added lines #L149 - L150 were not covered by tests
🧹 Nitpick comments (2)
packages/core/src/helpers.ts (2)
45-52: Complex type checking logic needs simplification and documentation.The nested ternary and type checking logic is hard to read and understand. Consider extracting this into a helper function for better maintainability.
Extract the type checking logic into a helper function:
+const isFileTypeMatch = (stats: Stats, type: FileTypes): boolean => { + if (isAnyFileType(type)) { + return true + } + const types = Array.isArray(type) ? type : [type] + return types.some(t => + stats[`is${t[0].toUpperCase()}${t.slice(1)}` as `is${Capitalize<FileTypeBase>}`]() + ) +} - return stats && - (isAnyFileType(type) || - (Array.isArray(type) ? type : [type]).some(type => - stats[ - `is${type[0].toUpperCase()}${type.slice(1)}` as `is${Capitalize<FileTypeBase>}` - ](), - )) - ? { filepath, stats } - : undefined + return stats && isFileTypeMatch(stats, type) + ? { filepath, stats } + : undefined🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 45-45: packages/core/src/helpers.ts#L45
Added line #L45 was not covered by tests
[warning] 47-47: packages/core/src/helpers.ts#L47
Added line #L47 was not covered by tests
[warning] 51-52: packages/core/src/helpers.ts#L51-L52
Added lines #L51 - L52 were not covered by tests
108-132: Stop path validation logic is robust but could benefit from extracted functions.The stop path validation logic is comprehensive and handles edge cases well, but the complexity makes it hard to follow. Consider extracting validation functions.
Extract validation logic into helper functions:
+const validateStopPath = (stop: string, throwOnNotFound?: boolean) => { + const stopStats = tryFileStats(stop, ['file', 'directory']) + if (!stopStats) { + const message = `Cannot find stop path: ${stop}` + if (throwOnNotFound) { + throw new Error(message) + } else if (throwOnNotFound !== false) { + console.warn(message) + } + return null + } + return stopStats.stats.isDirectory() + ? stopStats.filepath + : path.dirname(stopStats.filepath) +} + +const validateStopIsParent = (entry: string, stop: string, throwOnInvalid?: boolean) => { + if (entry !== stop && !entry.startsWith(stop + path.sep)) { + const message = `Invalid stop path: ${stop} is not a parent of ${entry}` + if (throwOnInvalid) { + throw new Error(message) + } else if (throwOnInvalid !== false) { + console.warn(message) + } + return false + } + return true +}🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 109-109: packages/core/src/helpers.ts#L109
Added line #L109 was not covered by tests
[warning] 111-111: packages/core/src/helpers.ts#L111
Added line #L111 was not covered by tests
[warning] 113-113: packages/core/src/helpers.ts#L113
Added line #L113 was not covered by tests
[warning] 115-115: packages/core/src/helpers.ts#L115
Added line #L115 was not covered by tests
[warning] 117-117: packages/core/src/helpers.ts#L117
Added line #L117 was not covered by tests
[warning] 120-121: packages/core/src/helpers.ts#L120-L121
Added lines #L120 - L121 were not covered by tests
[warning] 124-124: packages/core/src/helpers.ts#L124
Added line #L124 was not covered by tests
[warning] 126-126: packages/core/src/helpers.ts#L126
Added line #L126 was not covered by tests
[warning] 128-128: packages/core/src/helpers.ts#L128
Added line #L128 was not covered by tests
[warning] 130-130: packages/core/src/helpers.ts#L130
Added line #L130 was not covered by tests
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
.changeset/poor-walls-arrive.md(1 hunks).github/workflows/autofix.yml(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/pkg-pr-new.yml(1 hunks).github/workflows/pkg-size.yml(1 hunks).github/workflows/release.yml(1 hunks).github/workflows/vercel.yml(1 hunks)packages/core/package.json(1 hunks)packages/core/src/helpers.ts(2 hunks)
✅ Files skipped from review due to trivial changes (5)
- .github/workflows/ci.yml
- .github/workflows/vercel.yml
- .github/workflows/release.yml
- packages/core/package.json
- .github/workflows/pkg-size.yml
🚧 Files skipped from review as they are similar to previous changes (3)
- .github/workflows/autofix.yml
- .github/workflows/pkg-pr-new.yml
- .changeset/poor-walls-arrive.md
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/core/src/helpers.ts (1)
packages/core/src/constants.ts (2)
CWD(5-5)EXTENSIONS(20-20)
🪛 GitHub Check: codecov/patch
packages/core/src/helpers.ts
[warning] 12-12: packages/core/src/helpers.ts#L12
Added line #L12 was not covered by tests
[warning] 27-27: packages/core/src/helpers.ts#L27
Added line #L27 was not covered by tests
[warning] 29-30: packages/core/src/helpers.ts#L29-L30
Added lines #L29 - L30 were not covered by tests
[warning] 32-32: packages/core/src/helpers.ts#L32
Added line #L32 was not covered by tests
[warning] 36-36: packages/core/src/helpers.ts#L36
Added line #L36 was not covered by tests
[warning] 38-38: packages/core/src/helpers.ts#L38
Added line #L38 was not covered by tests
[warning] 43-43: packages/core/src/helpers.ts#L43
Added line #L43 was not covered by tests
[warning] 45-45: packages/core/src/helpers.ts#L45
Added line #L45 was not covered by tests
[warning] 47-47: packages/core/src/helpers.ts#L47
Added line #L47 was not covered by tests
[warning] 51-52: packages/core/src/helpers.ts#L51-L52
Added lines #L51 - L52 were not covered by tests
[warning] 56-56: packages/core/src/helpers.ts#L56
Added line #L56 was not covered by tests
[warning] 58-58: packages/core/src/helpers.ts#L58
Added line #L58 was not covered by tests
[warning] 63-63: packages/core/src/helpers.ts#L63
Added line #L63 was not covered by tests
[warning] 89-89: packages/core/src/helpers.ts#L89
Added line #L89 was not covered by tests
[warning] 105-105: packages/core/src/helpers.ts#L105
Added line #L105 was not covered by tests
[warning] 109-109: packages/core/src/helpers.ts#L109
Added line #L109 was not covered by tests
[warning] 111-111: packages/core/src/helpers.ts#L111
Added line #L111 was not covered by tests
[warning] 113-113: packages/core/src/helpers.ts#L113
Added line #L113 was not covered by tests
[warning] 115-115: packages/core/src/helpers.ts#L115
Added line #L115 was not covered by tests
[warning] 117-117: packages/core/src/helpers.ts#L117
Added line #L117 was not covered by tests
[warning] 120-121: packages/core/src/helpers.ts#L120-L121
Added lines #L120 - L121 were not covered by tests
[warning] 124-124: packages/core/src/helpers.ts#L124
Added line #L124 was not covered by tests
[warning] 126-126: packages/core/src/helpers.ts#L126
Added line #L126 was not covered by tests
[warning] 128-128: packages/core/src/helpers.ts#L128
Added line #L128 was not covered by tests
[warning] 130-130: packages/core/src/helpers.ts#L130
Added line #L130 was not covered by tests
[warning] 134-134: packages/core/src/helpers.ts#L134
Added line #L134 was not covered by tests
[warning] 137-137: packages/core/src/helpers.ts#L137
Added line #L137 was not covered by tests
[warning] 141-142: packages/core/src/helpers.ts#L141-L142
Added lines #L141 - L142 were not covered by tests
[warning] 145-145: packages/core/src/helpers.ts#L145
Added line #L145 was not covered by tests
[warning] 149-150: packages/core/src/helpers.ts#L149-L150
Added lines #L149 - L150 were not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
packages/core/src/helpers.ts (1)
149-154: Improved loop termination logic prevents infinite loops.The addition of
lastEntrytracking and the break condition whenentry === lastEntryis a good improvement that prevents infinite loops when reaching the filesystem root.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 149-150: packages/core/src/helpers.ts#L149-L150
Added lines #L149 - L150 were not covered by tests
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed 0bc4a98 in 2 minutes and 9 seconds. Click for details.
- Reviewed
297lines of code in9files - Skipped
0files when reviewing. - Skipped posting
5draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/core/src/helpers.ts:46
- Draft comment:
Potential bug: if 'type' is boolean false, then wrapping it in an array causes false[0] and false.slice(1) to error. Consider constraining FileTypes to avoid false. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. packages/core/src/helpers.ts:95
- Draft comment:
Consider renaming the 'entry' parameter (and corresponding option) to a more descriptive name (e.g. 'startDir') to clarify its role as the search starting directory. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. packages/core/src/helpers.ts:144
- Draft comment:
The do-while loop termination condition (!stop || entry !== stop) is a bit non‐obvious. Consider refactoring or adding a comment to explain the exit logic. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
4. packages/core/src/helpers.ts:110
- Draft comment:
The error handling for the 'stop' option uses flags (throwOnStopNotFound/throwOnInvalidStop) in a non-explicit way. Consider defaulting these flags explicitly or clarifying their intended behavior. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
5. packages/core/package.json:11
- Draft comment:
Node.js engine version update: Dropping Node 12 support. Ensure documentation and changelogs clearly communicate this breaking change. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
Workflow ID: wflow_BEDoDUoGr9thvFHW
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Important
Refactor
findUpinhelpers.tsfor flexible file searching, update Node.js requirements, and modify workflows for specific action versions.findUpfunction signature inhelpers.tsto supportFindUpOptionsfor more flexible file searching.tryFileStatsfunction inhelpers.tsfor detailed file stats retrieval.tryFileto usetryFileStatsinhelpers.ts.package.json.actions/checkoutto use versionv4.2.2in multiple workflow files.This description was created by
for 0bc4a98. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit