Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: enable mypy check strict_equality #2146

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

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

JohnVillalovos
Copy link
Member

Enable the mypy strict_equality check.

@JohnVillalovos JohnVillalovos force-pushed the jlvillal/mypy_strict_step_by_step branch 3 times, most recently from a0cc815 to d8ba031 Compare July 15, 2022 02:04
@JohnVillalovos JohnVillalovos requested a review from nejch July 15, 2022 02:17
@JohnVillalovos JohnVillalovos force-pushed the jlvillal/mypy_strict_step_by_step branch from d8ba031 to 8dece89 Compare July 15, 2022 06:01
@JohnVillalovos
Copy link
Member Author

@nejch I am thinking it might be better to not return anything from block and unblock. As they are supposed to raise Exceptions if something goes wrong. The return values are undocumented. So am leaning towards just returning None. What do you think?

@JohnVillalovos JohnVillalovos force-pushed the jlvillal/mypy_strict_step_by_step branch 2 times, most recently from a77ca4f to 24a9bd7 Compare July 18, 2022 05:25
@nejch
Copy link
Member

nejch commented Jul 19, 2022

@nejch I am thinking it might be better to not return anything from block and unblock. As they are supposed to raise Exceptions if something goes wrong. The return values are undocumented. So am leaning towards just returning None. What do you think?

I'm thinking it might be best to just return whatever the server returns. This way we don't back ourselves into a corner which seems to have happened with the old lint() method that no longer returns all the fields the server provides:

post_data = {"content": content}
data = self.http_post("/ci/lint", post_data=post_data, **kwargs)
if TYPE_CHECKING:
assert not isinstance(data, requests.Response)
return (data["status"] == "valid", data["errors"])

This way also any breaking changes are only because of GitLab and not us. WDYT?

Enable the `mypy` `strict_equality` check.
@JohnVillalovos JohnVillalovos force-pushed the jlvillal/mypy_strict_step_by_step branch from 24a9bd7 to a29cd6c Compare July 19, 2022 23:43
@JohnVillalovos
Copy link
Member Author

I'm thinking it might be best to just return whatever the server returns. This way we don't back ourselves into a corner which seems to have happened with the old lint() method that no longer returns all the fields the server provides:

This way also any breaking changes are only because of GitLab and not us. WDYT?

Works for me. I have updated it.

Thanks for the review.

@codecov-commenter
Copy link

Codecov Report

Merging #2146 (a29cd6c) into main (ed110bd) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2146   +/-   ##
=======================================
  Coverage   95.39%   95.39%           
=======================================
  Files          79       79           
  Lines        5149     5149           
=======================================
  Hits         4912     4912           
  Misses        237      237           
Flag Coverage Δ
api_func_v4 81.10% <100.00%> (ø)
cli_func_v4 82.59% <60.00%> (ø)
unit 87.00% <60.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/v4/objects/users.py 96.38% <100.00%> (ø)

@nejch nejch merged commit c84379d into main Jul 20, 2022
@nejch nejch deleted the jlvillal/mypy_strict_step_by_step branch July 20, 2022 09:36
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.

3 participants