Skip to content

feat: Add build config & SonarCloud setup for CheckoutComponents#1630

Open
bthebladeprimer wants to merge 3 commits into
bn/feature/checkout-components-stagingfrom
bn/feature/cc-01-build-config
Open

feat: Add build config & SonarCloud setup for CheckoutComponents#1630
bthebladeprimer wants to merge 3 commits into
bn/feature/checkout-components-stagingfrom
bn/feature/cc-01-build-config

Conversation

@bthebladeprimer
Copy link
Copy Markdown
Contributor

Summary

  • Add SonarCloud coverage exclusions for CheckoutComponents UI-only files (screens, components, views, generated tokens, accessibility, navigation, logging)
  • Update PrimerSDK.podspec with resource paths for CheckoutComponentsLocalizable strings and InterVariable.ttf font
  • Add Phrase translation config (phrase_config_checkout_components.yml) and CI workflow for translation updates
  • Add Design Tokens tooling (Style Dictionary configs for light/dark token generation)
  • Add Claude Code rules, agents, and skills for CheckoutComponents development

Context

This is PR 1 of 15 in the CheckoutComponents PR split. It establishes build configuration and SonarCloud exclusions that all subsequent PRs depend on.

Tracking: Notion PR Review Tracker
Staging branch: bn/feature/checkout-components-staging

Test plan

  • Verify sonar-project.properties exclusion patterns are correct and complete
  • Verify PrimerSDK.podspec builds with pod lib lint (no new Swift source yet)
  • Verify .gitignore additions don't affect existing tracked files
  • Verify CI workflow YAML is valid

Add SonarCloud coverage exclusions for CheckoutComponents UI-only files,
update podspec with localization and font resources, add Phrase translation
config, CI workflow, design token tooling, and Claude Code rules/agents.
@bthebladeprimer bthebladeprimer requested review from a team as code owners March 26, 2026 15:30
@bthebladeprimer bthebladeprimer self-assigned this Mar 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 26, 2026

Warnings
⚠️ This PR doesn't seem to contain any updated Unit Test 🤔. Please consider double checking it.🙏
⚠️ > Pull Request size seems relatively large. If this Pull Request contains multiple changes, please split each into separate PR will helps faster, easier review.
⚠️ PR is classed as Work in Progress

Generated by 🚫 Danger Swift against f16bfbd

@bthebladeprimer bthebladeprimer marked this pull request as ready for review April 3, 2026 18:09
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 3, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

Comment thread sonar-project.properties
Package.*.swift,\
**/CardComponentsManager.swift # Deprecated
**/CardComponentsManager.swift,\
Sources/PrimerSDK/Classes/CheckoutComponents/Internal/Presentation/Screens/**/*,\
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not just CheckoutComponents/* ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I am wrong, but these exclusions are not needed for this PR, correct? I would worry about merging them in then as I assume we want to get to a future (by release) where none of these exclusions exist? Might be easy to miss them and not get coverage reports as we present PRs with these files.

Comment thread README.md

// Custom styling for card number field
cardFormScope.cardNumberField = { label, styling in
AnyView(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we remove the need for AnyView for clients?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did. This is a leftover in the docs, thanks.

Comment thread BuildTools/.swiftformat
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should really be a separate pr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If affects all PRs going forward/is not specific to CC


phrase:
access_token: ${PHRASE_ACCESS_TOKEN}
project_id: 4ef09e68b0f08039c865e202d878b3e9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hardcoded here, but appears to be prepended from the CI in .github/workflows/manual-translation-update-checkout-components.yml. Can we remove this - it is not clear which project ID will be present in the final file

// Remove "CGFloat(" and the first ")" to extract the numeric expression.
let raw = token.value.replace(/CGFloat\$begin:math:text$/g, '').replace(/\\$end:math:text$/g, '');
try {
value = Number(eval(raw));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low risk as these input files are controlled by us, but eval() is a code-injection vector should this code ever be used on merchant or user-facing input files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically I believe we should be bundling the licence for this font with the SDK and disclosing its use somewhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the workspace diff, PrimerSwiftUIBridgeViewController.swift appears both under:

  • CheckoutComponents/Internal/UI/ (new)
  • Root/ (existing, from the old User Interface group)

Verify this isn't a duplicate file reference that could cause Xcode build conflicts.

Comment thread .mcp.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an approved MCP, so not useful to us right now

Comment thread DesignTokens/package.json
"version": "0.0.0",
"type": "module",
"scripts": {
"build": "yarn run build-light && yarn run build-dark",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn here, but we have package-lock.json, not a yarn.lock. Also, README suggests to npm install. Worth tighening up these inconsistencies

Comment thread README.md
```swift
// Example: Complete screen replacement
if let cardFormScope: DefaultCardFormScope = checkoutScope.getPaymentMethodScope(for: .paymentCard) {
cardFormScope.screen = { presentationContext in
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment here as to if/how presentationContext should be used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants