-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix use of formatting tokens #638
Conversation
📝 WalkthroughWalkthroughThe pull request involves modifications to the Changes
Possibly related PRs
Suggested labels
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: 1
🧹 Nitpick comments (1)
src/Altinn.Correspondence.Integrations/Dialogporten/Mappers/DialogportenText.cs (1)
21-21
: Consider using string interpolation for better readabilityAs a readability improvement, consider using C# string interpolation instead of
string.Format
.Apply this alternative improvement to all three language methods:
- DialogportenTextType.DownloadStarted => string.Format("Startet nedlastning av vedlegg {0}", tokens[0]), + DialogportenTextType.DownloadStarted => $"Startet nedlastning av vedlegg {tokens[0]}", - DialogportenTextType.DownloadStarted => string.Format("Startet nedlastning av vedlegg {0}", tokens[0]), + DialogportenTextType.DownloadStarted => $"Startet nedlastning av vedlegg {tokens[0]}", - DialogportenTextType.DownloadStarted => string.Format("Started downloading attachment {0}", tokens[0]), + DialogportenTextType.DownloadStarted => $"Started downloading attachment {tokens[0]}",Also applies to: 33-33, 45-45
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/Altinn.Correspondence.Integrations/Dialogporten/Mappers/DialogportenText.cs
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (csharp)
🔇 Additional comments (1)
src/Altinn.Correspondence.Integrations/Dialogporten/Mappers/DialogportenText.cs (1)
Line range hint
1-52
: Verify the impact on existing callersThe changes to the formatting tokens might affect existing code that calls these methods.
Let's verify all callers of this method to ensure they provide the correct number of tokens:
✅ Verification successful
No issues found with token formatting changes
The verification shows that all callers of
GetDialogportenText
withDialogportenTextType.DownloadStarted
pass exactly one token (the filename), which matches the format string{0}
used in the implementation. The changes are safe and compatible with existing usage.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for calls to GetDialogportenText with DownloadStarted ast-grep --pattern 'GetDialogportenText($_, DialogportenTextType.DownloadStarted, $_)'Length of output: 88
Script:
#!/bin/bash # Search for any calls to GetDialogportenText ast-grep --pattern 'GetDialogportenText($_)' # Backup search using ripgrep echo "=== Ripgrep search ===" rg "GetDialogportenText" -l # Search for DialogportenTextType.DownloadStarted usage echo "=== DownloadStarted usage ===" rg "DialogportenTextType\.DownloadStarted" -A 2Length of output: 4988
src/Altinn.Correspondence.Integrations/Dialogporten/Mappers/DialogportenText.cs
Show resolved
Hide resolved
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.
Good work!
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
Description
Fix use of formatting tokens in DialogActivity for DownloadStarted
Related Issue(s)
Verification
Documentation
Summary by CodeRabbit