WeTransfer / Mocker

Mock Alamofire and URLSession requests without touching your code implementation
MIT License
1.12k stars 96 forks source link

Simplify tests and add Sendable to subtypes #150

Closed AvdLee closed 10 months ago

AvdLee commented 10 months ago

In an attempt to make Mocker conform to Sendable, I realized it's not making much sense for the nature of this project. Any mutations to Mock are done before the mock is registered and right now, it does not make any sense to change properties after registration.

If we would make Mock conform to Sendable, we would have to make all its properties including closures Sendable too. This would cause a huge impact on codebases since our tests are using onRequest handlers and others while capturing many non-sendable types. Therefore, I don't think it makes sense for this project, for testing purposes designed, to conform to Sendable in the short term.

Yet, I did add a few conformances that don't hurt 👌

wetransferplatform commented 10 months ago
Warnings
:warning: Consider to place some `MARK:` lines for Sources/Mocker/Mock.swift, which is over 300 lines big.
Messages
:book: View more details on Bitrise

SwiftLint found issues

Severity File Reason
Warning Mock.swift:9 The disabled 'force_unwrapping' rule should be re-enabled before the end of the file (blanket_disable_command)
Warning Mock.swift:93 Computed properties should first declare the getter and then the setter (computed_accessors_order)
Error Mock.swift:111 Prefer checking isEmpty over comparing count to zero (empty_count)
Error Mock.swift:8 Line should be 160 characters or less; currently it has 177 characters (line_length)
Error Mock.swift:38 Line should be 160 characters or less; currently it has 195 characters (line_length)
Warning Mock.swift:55 Line should be 140 characters or less; currently it has 155 characters (line_length)
Error Mock.swift:87 Line should be 160 characters or less; currently it has 211 characters (line_length)
Error Mock.swift:90 Line should be 160 characters or less; currently it has 208 characters (line_length)
Error Mock.swift:101 Line should be 160 characters or less; currently it has 217 characters (line_length)
Error Mock.swift:110 Line should be 160 characters or less; currently it has 297 characters (line_length)
Warning Mock.swift:116 Line should be 140 characters or less; currently it has 152 characters (line_length)
Warning Mock.swift:156 Line should be 140 characters or less; currently it has 141 characters (line_length)
Error Mock.swift:159 Line should be 160 characters or less; currently it has 171 characters (line_length)
Warning Mock.swift:178 Line should be 140 characters or less; currently it has 141 characters (line_length)
Warning Mock.swift:185 Line should be 140 characters or less; currently it has 142 characters (line_length)
Error Mock.swift:186 Line should be 160 characters or less; currently it has 246 characters (line_length)
Warning Mock.swift:204 Line should be 140 characters or less; currently it has 141 characters (line_length)
Error Mock.swift:206 Line should be 160 characters or less; currently it has 171 characters (line_length)
Error Mock.swift:211 Line should be 160 characters or less; currently it has 256 characters (line_length)
Warning Mock.swift:234 Line should be 140 characters or less; currently it has 150 characters (line_length)
Error Mock.swift:249 Line should be 160 characters or less; currently it has 171 characters (line_length)
Warning Mock.swift:253 Line should be 140 characters or less; currently it has 160 characters (line_length)
Warning Mock.swift:268 Line should be 140 characters or less; currently it has 141 characters (line_length)
Error Mock.swift:270 Line should be 160 characters or less; currently it has 171 characters (line_length)
Error Mock.swift:275 Line should be 160 characters or less; currently it has 262 characters (line_length)
Warning Mock.swift:326 Line should be 140 characters or less; currently it has 159 characters (line_length)
Error Mock.swift:336 Line should be 160 characters or less; currently it has 168 characters (line_length)
Warning Mock.swift:129 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning Mock.swift:338 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning Mock.swift:338 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning Mock.swift:42 Lines should not have trailing whitespace (trailing_whitespace)
Warning Mock.swift:114 Lines should not have trailing whitespace (trailing_whitespace)
Warning Mock.swift:155 Lines should not have trailing whitespace (trailing_whitespace)
Warning Mock.swift:199 Lines should not have trailing whitespace (trailing_whitespace)
Warning Mock.swift:224 Lines should not have trailing whitespace (trailing_whitespace)
Warning Mock.swift:244 Lines should not have trailing whitespace (trailing_whitespace)
Warning Mock.swift:263 Lines should not have trailing whitespace (trailing_whitespace)
Warning MockerTests.swift:187 Line should be 140 characters or less; currently it has 151 characters (line_length)
Warning MockerTests.swift:205 Line should be 140 characters or less; currently it has 149 characters (line_length)
Warning MockerTests.swift:263 Line should be 140 characters or less; currently it has 157 characters (line_length)
Warning MockerTests.swift:52 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:71 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:94 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:116 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:148 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:173 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:189 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:207 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:230 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:283 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:548 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:582 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:261 Variables should not have redundant type annotation (redundant_type_annotation)
Warning MockerTests.swift:132 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning MockerTests.swift:267 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning MockerTests.swift:536 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning MockerTests.swift:152 Lines should not have trailing whitespace (trailing_whitespace)
Warning MockerTests.swift:167 Lines should not have trailing whitespace (trailing_whitespace)
Warning MockerTests.swift:15 Type body should span 400 lines or less excluding comments and whitespace: currently spans 445 lines (type_body_length)
Warning MockerTests.swift:48 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:67 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:90 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:112 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:130 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:162 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:185 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:203 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:226 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:242 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:265 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:531 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:574 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)

Generated by :no_entry_sign: Danger Swift against d4014d0a23e94c91f875f98dd3ea1db0e8dfb908

wetransferplatform commented 10 months ago

Congratulations! :tada: This was released as part of Release 3.0.2 :rocket:

Generated by GitBuddy