parse-community / Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
https://parseplatform.org
MIT License
308 stars 69 forks source link

feat: add discardableResult to ParseObject methods #385

Closed vdkdamian closed 2 years ago

vdkdamian commented 2 years ago

New Pull Request Checklist

Issue Description

If you want to execute save() or fetch(),... the function returns the ParseObject. If you don't need it you need to cancel it out with an underscore replacement.

Related issue: #384

Approach

@discardableResult adds the possibility to skip the result as developer. It's up to the developer to decide whether they use the result or not.

TODOs before merging

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this pull request!

codecov[bot] commented 2 years ago

Codecov Report

Merging #385 (6a887e3) into main (b0bd351) will decrease coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #385      +/-   ##
==========================================
- Coverage   89.66%   89.64%   -0.03%     
==========================================
  Files         155      155              
  Lines       14121    14121              
==========================================
- Hits        12662    12659       -3     
- Misses       1459     1462       +3     
Impacted Files Coverage Δ
...s/ParseSwift/Objects/ParseInstallation+async.swift 100.00% <100.00%> (ø)
Sources/ParseSwift/Objects/ParseObject+async.swift 100.00% <100.00%> (ø)
Sources/ParseSwift/Objects/ParseUser+async.swift 100.00% <100.00%> (ø)
Sources/ParseSwift/Objects/ParseUser.swift 86.12% <0.00%> (-0.18%) :arrow_down:
Sources/ParseSwift/Objects/ParseObject.swift 85.10% <0.00%> (-0.16%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b0bd351...6a887e3. Read the comment docs.

vdkdamian commented 2 years ago

@cbaker6 Could you help me point why the tests are failing? I tried running the tests on my mac, but I am on the Ventura Beta. The tests are failing on something I noticed since the beginning of the Beta's. All function like "saveAll", "fetchAll",... give me a warning. Might be a future problem when Ventura and iOS 16 release.

But I don't think that has anything to do with the little changes I made

Scherm­afbeelding 2022-07-17 om 23 23 27
cbaker6 commented 2 years ago

I wouldn’t worry about the failing tests on your system if they aren’t showing up in the CI. What does show in the CI looks like you didn’t lint the project after your changes. You will need to fix linting before this can be merged.

vdkdamian commented 2 years ago

@cbaker6 I'm testing this line: ParseLiveQueryTests.testEventCreateSubscriptionCallback() and it was successful. I don't get why it fails here. Any ideas?

cbaker6 commented 2 years ago

I'm testing this line: ParseLiveQueryTests.testEventCreateSubscriptionCallback() and it was successful. I don't get why it fails here. Any ideas?

This is a random failure that only occurs in the CI so you can ignore.

Can you add @discardableResult to the equivalent methods in ParseInstallation and ParseUser?

vdkdamian commented 2 years ago

Now something is wrong with linux?