-
Notifications
You must be signed in to change notification settings - Fork 3
Pp 1940 sonar qube reduce issues of duplicating literals #1018
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
base: PP-1687-SonarQube-Fix-Cyclomatic-Complexity-in-all-the-function-which-is-greater-than-10-authorized
Are you sure you want to change the base?
Conversation
…g localization - Add convenience wrapper around `NSLocalizedStringPreferredGiniBankFormat` to improve code readability and reduce verbosity when accessing localized strings throughout the BankSDK PP-1940
…ce duplication of literals PP-1940
…er` to reduce duplication of literals PP-1940
…odel` to reduce duplication of literals PP-1940
…ring localization - Add convenience wrapper around `NSLocalizedStringPreferredFormat` to improve code readability and reduce verbosity when accessing localized strings throughout the GiniCaptureSDK PP-1940
…uplication of literals - use the newly introduced `giniLocalized` method for better visibility and readability PP-1940
…ion of literals PP-1940
…r Strings/Constants/Images PP-1940
…duplication of literals PP-1940
…chant+PaymentComponentsStringsProvider` PP-1940
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.
Pull request overview
This pull request refactors code to reduce SonarQube issues related to duplicating string literals. The changes extract inline localized strings and image references into centralized private Strings and Images structs within their respective classes, and introduce a new giniLocalized() convenience function to simplify localization calls.
- Introduced
giniLocalized()helper functions in both CaptureSDK and BankSDK as convenience wrappers around the more verbose localization methods - Extracted duplicate string literals into private
Stringsstructs across multiple view controllers and data sources - Refactored QRCode-related classes by extracting
CorrectQRCodeTextContainerandIncorrectQRCodeTextContainerinto separate files with their own string constants - Changed several
enumtypes tostructfor Constants and Images containers (more appropriate since they're just namespaces)
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| GiniMerchant+PaymentComponentsStringsProvider.swift | Updated localization comments to be more specific (e.g., "answer 1", "question 1") |
| HelpFormatsDataSource.swift | Major refactoring to use centralized Strings and Images structs instead of inline literals |
| QRCodeOverlay.swift | Extracted nested classes to separate files, added Strings/Images structs |
| IncorrectQRCodeTextContainer.swift | New file containing extracted class with Strings struct |
| CorrectQRCodeTextContainer.swift | New file containing extracted class with Strings struct |
| CameraPreviewView.swift | Removed author attribution comment |
| CameraViewController.swift | Refactored to use Strings struct and new giniLocalized helper |
| AnalysisViewController.swift | Changed Constants from enum to struct |
| GiniCaptureUtils.swift | Added new giniLocalized() convenience function |
| EducationFlowContent.swift | Changed Images from enum to struct |
| SettingsViewController+SwitchOptionModel.swift | Consolidated duplicate return statements using comma-separated case patterns |
| DigitalInvoiceOnboardingViewController.swift | Refactored to use Strings struct and giniLocalized helper |
| DigitalInvoiceHelpViewModel.swift | Refactored to use Strings struct |
| GiniBankUtils.swift | Added new giniLocalized() convenience function |
Comments suppressed due to low confidence (1)
CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Views/QRCodeOverlay/QRCodeOverlay.swift:327
- Typo in comment: "Retrievenig" should be "Retrieving".
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ple/GiniBankSDKExample/SettingsViewController/SettingsViewController+SwitchOptionModel.swift
Show resolved
Hide resolved
.../GiniBankSDK/Sources/GiniBankSDK/Core/ReturnAssistant/Help/DigitalInvoiceHelpViewModel.swift
Outdated
Show resolved
Hide resolved
...ces/GiniBankSDK/Core/ReturnAssistant/Onboarding/DigitalInvoiceOnboardingViewController.swift
Outdated
Show resolved
Hide resolved
...ces/GiniBankSDK/Core/ReturnAssistant/Onboarding/DigitalInvoiceOnboardingViewController.swift
Outdated
Show resolved
Hide resolved
.../GiniBankSDK/Sources/GiniBankSDK/Core/ReturnAssistant/Help/DigitalInvoiceHelpViewModel.swift
Show resolved
Hide resolved
...iCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Help/DataSources/HelpFormatsDataSource.swift
Outdated
Show resolved
Hide resolved
.../GiniBankSDK/Sources/GiniBankSDK/Core/ReturnAssistant/Help/DigitalInvoiceHelpViewModel.swift
Outdated
Show resolved
Hide resolved
|



Pull Request Description
PP-1940
This pull request refactors code to reduce SonarQube issues related to duplicating string literals. The changes extract inline localized strings and image references into centralized private
StringsandImagesstructs within their respective classes, and introduce a newginiLocalized()convenience function to simplify localization calls.giniLocalized()helper functions in both CaptureSDK and BankSDK as convenience wrappers around the more verbose localization methodsStringsstructs across multiple view controllers and data sourcesCorrectQRCodeTextContainerandIncorrectQRCodeTextContainerinto separate files with their own string constantsenumtypes tostructfor Constants and Images containers (more appropriate since they're just namespaces)