Skip to content

Conversation

@fedemkr
Copy link
Member

@fedemkr fedemkr commented Jul 7, 2025

🎟️ Tracking

PM-25300

📔 Objective

Adds docs on Sourcery usage on automatic mock generation on iOS architecture.
This has been added in bitwarden/ios#1724.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@fedemkr fedemkr requested review from a team as code owners July 7, 2025 17:56
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 7, 2025

Deploying contributing-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e50d215
Status: ✅  Deploy successful!
Preview URL: https://6e764d9d.contributing-docs.pages.dev
Branch Preview URL: https://ios-pm-23500-sourcery-usage.contributing-docs.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2025

Logo
Checkmarx One – Scan Summary & Details13d149bd-12f2-46c9-b19b-43fe095ff9ad

Great job! No new security vulnerabilities introduced in this pull request

djsmith85
djsmith85 previously approved these changes Jul 17, 2025
dasien
dasien previously approved these changes Jul 17, 2025
vvolkgang
vvolkgang previously approved these changes Sep 16, 2025
# Conflicts:
#	docs/architecture/mobile-clients/ios/index.md
@claude
Copy link

claude bot commented Nov 20, 2025

Claude finished @fedemkr's task —— View job


Review complete

  • Read changed files and gather context
  • Review PR metadata (title, description, test plan)
  • Analyze documentation quality, grammar, and clarity
  • Check for accuracy and best practices
  • Post comprehensive review findings

Summary

This PR adds clear and helpful documentation about Sourcery usage for automatic mock generation in the iOS project. The content is well-structured and includes practical examples. However, there are a few minor grammar and clarity issues that should be addressed.

Findings

Finding 1: Grammar issues with possessive forms vs. noun adjuncts (lines 475, 486)

Finding 2: Missing "to" in infinitive construction (line 476)

Finding 3: Sentence structure could be improved for clarity (line 482)

Details

All specific issues have been marked with inline comments at the relevant lines. The findings are minor grammatical improvements that will enhance readability.

The changes to docs/getting-started/mobile/ios/index.md look good - they improve consistency by using "and" instead of "&" and make the warning text clearer.

The addition of "Sourcery" to custom-words.txt is appropriate and necessary.

What was done well

The documentation provides clear examples with code blocks and uses the appropriate Docusaurus info admonition for edge cases.

vvolkgang
vvolkgang previously approved these changes Nov 20, 2025
}
```

:::info Manual generation
Copy link

Choose a reason for hiding this comment

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

⚠️ Grammar: "specially" should be "especially" in technical writing.

Suggested change
:::info Manual generation
or it cannot handle some closure types, especially in function's parameters. In such cases prefer

```

:::info Manual generation

Copy link

Choose a reason for hiding this comment

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

⚠️ Grammar: Missing "to" before "create". Should be "prefer to create the mock manually".

Suggested change
create the mock manually and remove the protocol's comment as `AutoMockable`.


#### Custom annotations

Sourcery allows us to annotate different parts of our code to guide code generation. On top of this
Copy link

Choose a reason for hiding this comment

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

💭 Clarity: This sentence is somewhat awkward. Consider rephrasing for better readability.

Suggested rewrite:

Suggested change
Sourcery allows us to annotate different parts of our code to guide code generation. On top of this
Sourcery allows us to annotate different parts of our code to guide code generation. Custom annotations have been added in `AutoMockable.stencil` to handle special cases.

custom annotations have been added in `AutoMockable.stencil` to handle special cases.

- **useSelectorName**: Method annotation used to indicate that the generated mocked properties need
to use the selector name instead of the short method name. This is specially useful when using
Copy link

Choose a reason for hiding this comment

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

⚠️ Grammar: "specially" should be "especially".

Suggested change
to use the selector name instead of the short method name. This is specially useful when using
to use the selector name instead of the short method name. This is especially useful when using

[ios version](https://github.com/bitwarden/ios/blob/main/.test-simulator-ios-version)), otherwise
tests may fail because of subtle differences between iOS versions.

### Mocks generation
Copy link

Choose a reason for hiding this comment

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

🎨 Heading structure: Consider using a more descriptive heading like "Mock generation" instead of "Mocks generation" (singular form is more standard in English).

@fedemkr fedemkr requested a review from vvolkgang November 20, 2025 16:43
vvolkgang
vvolkgang previously approved these changes Nov 20, 2025
:::info Manual generation

There are some cases where the automatically generated mock does not cover the mock scenario we want
or it cannot handle some closure types, especially in function's parameters. In such cases prefer to
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ I would say "function parameters". If we still want to make it possessive instead of a noun adjunct, then it should be plural: "functions' parameters", but that sounds off to my ear.


There are some cases where the automatically generated mock does not cover the mock scenario we want
or it cannot handle some closure types, especially in function's parameters. In such cases prefer to
create the mock manually and remove the protocol's comment as `AutoMockable`.
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ I would say "The protocol's AutoMockable comment".


- **useSelectorName**: Method annotation used to indicate that the generated mocked properties need
to use the selector name instead of the short method name. This is especially useful when using
function overloading where we need the mocked names to also have the parameters names to
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ Either "parameter names" (noun adjunct, my preference) or "parameters' names" (possessive of plural noun)

:::info Manual generation

There are some cases where the automatically generated mock does not cover the mock scenario we want
or it cannot handle some closure types, especially in function parameters. In such cases prefer to
Copy link

Choose a reason for hiding this comment

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

⛏️ Grammar: "function parameters" (noun adjunct) is more natural than "function's parameters" (possessive).

Suggested change
or it cannot handle some closure types, especially in function parameters. In such cases prefer to
or it cannot handle some closure types, especially in function parameters. In such cases prefer to


There are some cases where the automatically generated mock does not cover the mock scenario we want
or it cannot handle some closure types, especially in function parameters. In such cases prefer to
create the mock manually and remove the protocol's `AutoMockable` comment.
Copy link

Choose a reason for hiding this comment

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

⛏️ Grammar: Missing "to" before "create". Should be "prefer to create the mock manually".

Suggested change
create the mock manually and remove the protocol's `AutoMockable` comment.
create the mock manually and remove the protocol's `AutoMockable` comment.


#### Custom annotations

Sourcery allows us to annotate different parts of our code to guide code generation. Custom
Copy link

Choose a reason for hiding this comment

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

💭 Clarity: This sentence structure could be improved for readability.

Suggested rewrite:

Suggested change
Sourcery allows us to annotate different parts of our code to guide code generation. Custom
Sourcery allows us to annotate different parts of our code to guide code generation. Custom annotations have been added in `AutoMockable.stencil` to handle special cases.

annotations have been added in `AutoMockable.stencil` to handle special cases.

- **useSelectorName**: Method annotation used to indicate that the generated mocked properties need
to use the selector name instead of the short method name. This is especially useful when using
Copy link

Choose a reason for hiding this comment

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

⛏️ Grammar: "parameter names" (noun adjunct, preferred) is more natural than "parameter's names" (possessive).

Suggested change
to use the selector name instead of the short method name. This is especially useful when using
function overloading where we need the mocked names to also have the parameter names to

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants