-
Notifications
You must be signed in to change notification settings - Fork 1
fix: remove pdf extension from export filename #117
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
Conversation
WalkthroughThe pull request introduces a change to the Changes
Poem
Finishing Touches
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: 0
🧹 Nitpick comments (2)
src/utils.ts (2)
27-30: Consider aligning PDF support across utility functions.There's an inconsistency in the API design:
generateFileNameonly supports 'log' extension- But
getTimestamp(which is used by this function) still supports both 'log' and 'pdf' typesThis partial PDF support could be confusing for maintainers.
Consider either:
- Removing PDF support completely from all utility functions, or
- Keeping PDF support consistent across all functions
If option 1 is chosen, here's a suggested refactor:
-const getTimestamp = ({ type = 'log' }: { type: 'log' | 'pdf' }): string => { +const getTimestamp = ({ type = 'log' }: { type: 'log' }): string => { const now = new Date() const year = now.getFullYear() const month = String(now.getMonth() + 1).padStart(2, '0') const day = String(now.getDate()).padStart(2, '0') - const hours = String(now.getHours()).padStart(2, '0') - const minutes = String(now.getMinutes()).padStart(2, '0') - const seconds = String(now.getSeconds()).padStart(2, '0') - return type === 'log' - ? `${year}-${month}-${day}` - : `${year}-${month}-${day}_${hours}-${minutes}-${seconds}` + return `${year}-${month}-${day}` }
27-30: Document the reason for removing PDF support.Since this appears to be an intentional removal of PDF support, it would be helpful to document the reasoning in the code.
Consider adding a comment explaining why PDF support was removed:
+// PDF extension support was removed as it's no longer needed for export functionality const generateFileName = (prefix: string, ext: 'log'): string => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
mod_test.ts(0 hunks)src/utils.ts(1 hunks)
💤 Files with no reviewable changes (1)
- mod_test.ts
🔇 Additional comments (1)
src/utils.ts (1)
27-27: Verify the impact of removing PDF support.The function signature has been restricted to only accept 'log' extension. This could be a breaking change if other parts of the codebase expect PDF filename generation.
Let's verify the usage:
✅ Verification successful
API inconsistency in type definitions
The removal of PDF support from
generateFileNameis safe as there are no usages with 'pdf' extension in the codebase. However,getTimestampstill accepts both 'log' | 'pdf' types, which creates an inconsistent API. Consider updatinggetTimestampto also remove PDF support for consistency.
src/utils.ts: UpdategetTimestamptype definition to only accept 'log' type🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining PDF filename generation calls rg -l "generateFileName.*pdf" # Search for other PDF-related functionality rg -l "type.*=.*['\"]pdf['\"]"Length of output: 81
Script:
#!/bin/bash # Show PDF-related code in utils.ts with context rg "pdf" src/utils.ts -B 2 -A 2 # Find calls to generateFileName ast-grep --pattern 'generateFileName($$$)'Length of output: 445
This is an automated pull request for branch develop
Summary by CodeRabbit