Skip to content
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

Option to ignore URLs that match a prefix #157

Merged
merged 1 commit into from
May 13, 2024

Conversation

bwhtmn
Copy link
Contributor

@bwhtmn bwhtmn commented Apr 19, 2024

Resolves #93.

Extend the Mocker's ignore rules to have an option to ignore any URLs that start with a specific prefix. This expands on existing functionality that has ignore rules for ignoring URLs that match exactly, or matching the URL excluding the query.

If this PR is approved, it may be nice to consider a follow-up PR to make a similar change to the Mock struct, migrating its use of ignoreQuery to also use a URLMatchType approach. If this is of interest to the repo maintainers, I could open an issue for further discussion, for example on how to deal the proliferation of public initializers as mentioned here #140 (comment)

Copy link
Contributor

@BasThomas BasThomas left a comment

Choose a reason for hiding this comment

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

Nice, thanks for the contribution!

Copy link
Contributor

@raphkoebraam raphkoebraam left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! 🚀

@wetransferplatform
Copy link
Collaborator

Warnings
⚠️

'onRequest' is deprecated: Use onRequestHandler instead.

⚠️

'onRequest' is deprecated: Use onRequestHandler instead.

⚠️

Consider to place some MARK: lines for Sources/Mocker/Mock.swift, which is over 300 lines big.

Messages
📖 MockerTests: Executed 34 tests (0 failed, 0 retried, 0 skipped) in 1.789 seconds
📖

View more details on Bitrise

Code Coverage Report

Name Coverage
Mocker 81.02%

SwiftLint found issues

Severity File Reason
Error URLMatchType.swift:21 Line should be 160 characters or less; currently it has 168 characters (line_length)
Warning URLMatchType.swift:23 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning URLMatchType.swift:23 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning URLMatchType.swift:26 Lines should not have trailing whitespace (trailing_whitespace)
Warning URLMatchType.swift:34 Lines should not have trailing whitespace (trailing_whitespace)
Warning Mocker.swift:92 Line should be 140 characters or less; currently it has 149 characters (line_length)
Warning Mocker.swift:58 Variables should not have redundant type annotation (redundant_type_annotation)
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)
Warning Mock.swift:326 if, for, guard, switch, while, and catch statements shouldn't unnecessarily wrap their conditionals or arguments in parentheses (control_statement)
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)
Warning Mock.swift:129 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:386 Prefer named constructors over .init and type inference (explicit_init)
Warning MockerTests.swift:412 Prefer named constructors over .init and type inference (explicit_init)
Warning MockerTests.swift:434 Prefer named constructors over .init and type inference (explicit_init)
Warning MockerTests.swift:453 Prefer named constructors over .init and type inference (explicit_init)
Warning MockerTests.swift:678 File should contain 660 lines or less: currently contains 678 (file_length)
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:412 Line should be 140 characters or less; currently it has 145 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:586 Chained function calls should be either on the same line, or one per line (multiline_function_chains)
Warning MockerTests.swift:620 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:574 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 473 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:569 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:612 Parentheses are not needed when declaring closure arguments (unneeded_parentheses_in_closure_argument)
Warning MockerTests.swift:328 Prefer the specific matcher 'XCTAssertEqual' instead (xct_specific_matcher)

Generated by 🚫 Danger Swift against 6dfdbc3

@raphkoebraam raphkoebraam merged commit 8bbd037 into WeTransfer:master May 13, 2024
4 checks passed
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.

Feature request: ignoring domains/subdomains or URL prefix
4 participants