-
Notifications
You must be signed in to change notification settings - Fork 21
[PM-25300] Add Sourcery usage on iOS architecture #631
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: main
Are you sure you want to change the base?
Changes from 3 commits
43eb39e
397278d
a292135
e4938b5
9d8aaed
b312c12
e50d215
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,6 +73,7 @@ SDLC | |
| Serilog | ||
| signtool | ||
| signup | ||
| Sourcery | ||
| sqlcmd | ||
| struct | ||
| structs | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -444,3 +444,51 @@ This makes it convenient to switch between these files or open them side-by-side | |||||
| mode, dark mode, and with a large dynamic type size. โ ๏ธ These tests are done using an **iPhone 15 | ||||||
| Pro (17.0.1)** simulator, otherwise tests may fail because of subtle differences between iOS | ||||||
| versions. | ||||||
|
|
||||||
| ### Mocks generation | ||||||
|
|
||||||
| We use [Sourcery](https://github.com/krzysztofzablocki/Sourcery) for automatic mock generation. | ||||||
|
|
||||||
| In order to automatically generate a mock from a protocol, just add a comment with | ||||||
| `// sourcery: AutoMockable` to such protocol, perform a build and the mock will be automatically | ||||||
| generated and added to the `AutoMockable.generated.swift` file. | ||||||
|
|
||||||
| For example: | ||||||
|
|
||||||
| ```swift | ||||||
| protocol FooProtocol { // sourcery: AutoMockable | ||||||
| func bar() -> Bool | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| :::info Manual generation | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| There are some cases where the automatically generated mock does not cover the mock scenario we want | ||||||
| or it cannot handle some closure types, specially in function's parameters. In such cases prefer | ||||||
| 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 | ||||||
|
||||||
| 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. |
Outdated
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.
| 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 |
Outdated
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.
โ๏ธ Either "parameter names" (noun adjunct, my preference) or "parameters' names" (possessive of plural noun)
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.
๐จ Heading structure: Consider using a more descriptive heading like "Mock generation" instead of "Mocks generation" (singular form is more standard in English).