-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lookup multiple args #186
Lookup multiple args #186
Conversation
Previously, for lookup cli command, it is possible to set only a single argument for looking up. Now, it is possible to set multiple arguments. Related to: dahlia#173
WalkthroughThe changes in this pull request introduce several updates across multiple files. Notably, two new OpenTelemetry imports are added to Changes
Poem
Warning Rate limit exceeded@rudeh1253 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 7 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (2)
cli/lookup.ts (2)
35-39
: Fix typo in separator option descriptionThere's a typo in the separator option description: "Speicfy" should be "Specify".
.option( "-s, --separator <separator:string>", - "Speicfy the separator between adjacent output object.", + "Specify the separator between adjacent output objects.", { default: "~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~" }, )
102-105
: Enhance spinner text with current URLThe spinner text should indicate which URL is being processed to provide better feedback.
const spinnerForEachLookup = ora({ - text: "Looking up an object...", + text: `Looking up object (${i + 1}/${urls.length}): ${url}`, discardStdin: false, }).start();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
cli/npm/package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (3)
cli/import_map.g.json
(1 hunks)cli/lookup.ts
(3 hunks)cli/npm/package.json
(1 hunks)
🔇 Additional comments (4)
cli/import_map.g.json (1)
19-20
: Verify version compatibility with other dependencies.
The caret ranges (^) in the versions are good for allowing minor updates. However, ensure these versions are compatible with your Node.js/Deno environment and other dependencies.
✅ Verification successful
Dependencies are compatible and no version conflicts detected
The verification shows:
- Both packages are used consistently with the same version ranges across the codebase (
^1.9.0
for api and^1.27.0
for semantic-conventions) - Neither package has any peer dependencies that could cause conflicts
- The versions are aligned between
src/deno.json
andcli/import_map.g.json
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for potential version conflicts
# Search for other OpenTelemetry related dependencies
rg '"@opentelemetry/[^"]+": "npm:@opentelemetry/[^"]+"'
# Check if there are any peer dependencies
curl -s https://registry.npmjs.org/@opentelemetry/api/1.9.0 | jq '.peerDependencies'
curl -s https://registry.npmjs.org/@opentelemetry/semantic-conventions/1.27.0 | jq '.peerDependencies'
Length of output: 633
cli/lookup.ts (3)
96-97
: LGTM! Improved user feedback
The spinner text update provides clearer feedback about the initialization status.
148-150
: LGTM! Proper cleanup and exit handling
The implementation correctly cleans up resources and sets an appropriate exit code based on the operation's success.
18-18
: Verify command behavior with test cases
The implementation appears to meet the PR objectives. Let's verify the behavior with the test cases mentioned in the PR description.
Also applies to: 40-40
✅ Verification successful
Implementation verified and meets requirements
The code analysis confirms that the implementation properly handles:
- Multiple URL arguments through the
...urls:string
spread operator - Error handling with proper feedback for failed lookups
- Separator functionality with the
-s/--separator
option (default:~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
) - URL validation through the
lookupObject
function, which is thoroughly tested insrc/vocab/lookup.test.ts
- WebFinger resolution for actor handles, verified by tests in
src/webfinger/lookup.test.ts
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the command properly handles the test cases mentioned in the PR
# Test 1: Check if the command accepts multiple arguments
deno task run lookup @[email protected] @[email protected]
# Test 2: Check if the command properly handles invalid input
deno task run lookup @[email protected] @[email protected]
# Test 3: Check if the separator option works
deno task run lookup -s "---" @[email protected] @[email protected]
Length of output: 489
Script:
#!/bin/bash
# Let's verify the implementation through code analysis instead of runtime behavior
# Check the command implementation
ast-grep --pattern 'command($$$).arguments("<...urls:string>")'
# Check for URL validation logic
rg -A 5 "validateUrl|isValidUrl|checkUrl"
# Check for separator handling
rg -A 5 "separator|delimiter"
# Look for test files
fd "test|spec" --extension ts
Length of output: 1607
Script:
#!/bin/bash
# Let's check the implementation details in lookup.ts and related test files
# Check the lookup command implementation
cat cli/lookup.ts
# Check the lookup-related test files
cat src/vocab/lookup.test.ts
cat src/webfinger/lookup.test.ts
Length of output: 12342
By setting options of separator, it is possible to modify the value of separator Related to: dahlia#173
bedd385
to
3146e71
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
cli/lookup.ts (2)
35-39
: Fix typo in separator option descriptionThere's a typo in the description: "Speicfy" should be "Specify".
.option( "-s, --separator <separator:string>", - "Speicfy the separator between adjacent output object.", + "Specify the separator between adjacent output objects.", { default: "~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~" }, )
102-104
: Make spinner text more specificThe current spinner text is generic. Consider including the URL being processed for better progress tracking.
const spinnerForEachLookup = ora({ - text: "Looking up an object...", + text: `Looking up object: ${url}`, discardStdin: false, }).start();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
cli/lookup.ts
(3 hunks)
🔇 Additional comments (3)
cli/lookup.ts (3)
96-98
: LGTM! Good improvement in user feedback
The added success message clearly indicates when initialization is complete, improving the user experience.
148-150
: LGTM! Proper cleanup and exit handling
The code properly cleans up resources and sets an appropriate exit code based on the operation's success.
Line range hint 40-150
: Verify handling of example cases from PR description
Let's verify that the implementation correctly handles the example cases mentioned in the PR description.
✅ Verification successful
Implementation correctly handles multiple URLs and separator functionality
The code analysis confirms proper implementation of the requirements:
- Iterates through multiple URLs with proper error handling for each URL
- Implements separator option with a default value
- Handles error cases with appropriate user feedback
- Only prints separator between objects (when i < urls.length - 1)
Note: There's a minor typo in the separator option description ("Speicfy" instead of "Specify"), but this doesn't affect functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that the code handles the example cases correctly
# Test 1: Check if the command accepts multiple valid URLs
echo "Test 1: Multiple valid URLs"
deno task run lookup @[email protected] @[email protected]
# Test 2: Check if the command handles invalid URLs appropriately
echo "Test 2: Invalid URL"
deno task run lookup @[email protected] @[email protected]
# Test 3: Check if the separator option works
echo "Test 3: Custom separator"
deno task run lookup -s "---" @[email protected] @[email protected]
Length of output: 663
Script:
#!/bin/bash
# Let's verify the implementation by analyzing the code structure instead
# Check for URL handling and separator implementation
# Check how URLs are processed
ast-grep --pattern 'for (let i = 0; i < urls.length; i++) {
$$$
}'
# Check separator implementation
rg "separator" -A 2 -B 2
# Check error handling for URLs
ast-grep --pattern 'catch (_) {
$$$
}'
# Verify the command line options
rg "\.option.*separator" -A 2 -B 2
Length of output: 3061
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
CHANGES.md (1)
67-67
: Fix bullet point indentation.The indentation of this bullet point is inconsistent with other bullet points in the changelog.
Apply this diff to fix the indentation:
- - Let the `fedify lookup` command take multiple arguments. + - Let the `fedify lookup` command take multiple arguments.🧰 Tools
🪛 Markdownlint (0.35.0)
67-67: Expected: 0; Actual: 1
Unordered list indentation(MD007, ul-indent)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
CHANGES.md
(1 hunks)
🧰 Additional context used
🪛 Markdownlint (0.35.0)
CHANGES.md
67-67: Expected: 0; Actual: 1
Unordered list indentation
(MD007, ul-indent)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for your first contribution!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for your first contribution!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #186 +/- ##
=======================================
Coverage 84.46% 84.46%
=======================================
Files 42 42
Lines 11618 11618
Branches 1157 1157
=======================================
Hits 9813 9813
Misses 1784 1784
Partials 21 21 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
[ci skip]
Issue Number
Fixes #173
Description
lookup
command now accepts multiple arguments2024-11-23.161157.1.mp4
Exit code:
There is a typo:
@[email protected]
2024-11-23.161304.1.mp4
Exit code:
It is possible to specify the separator to separate objects output
Default
Specifying separator
Then:
Why?
Summary by CodeRabbit
Release Notes for Fedify Version 1.3.0
New Features
Improvements
Deprecations
fetchDocumentLoader()
function in favor of new document loading mechanisms.These updates significantly enhance the functionality and configurability of Fedify.