Skip to content

chore: add type-hints to gitlab/v4/objects/merge_requests.py#1673

Merged
nejch merged 1 commit intomainfrom
jlvillal/mypy_merge_requests
Nov 7, 2021
Merged

chore: add type-hints to gitlab/v4/objects/merge_requests.py#1673
nejch merged 1 commit intomainfrom
jlvillal/mypy_merge_requests

Conversation

@JohnVillalovos
Copy link
Copy Markdown
Member

  • Add type-hints to gitlab/v4/objects/merge_requests.py
  • Add return value to cancel_merge_when_pipeline_succeeds() function
    as GitLab docs show it returns a value.
  • Add return value to approve() function as GitLab docs show it
    returns a value.
  • Add 'get()' method so that type-checkers will understand that
    getting a project merge request is of type ProjectMergeRequest.

@JohnVillalovos JohnVillalovos requested a review from nejch November 7, 2021 00:15
 * Add type-hints to gitlab/v4/objects/merge_requests.py
 * Add return value to cancel_merge_when_pipeline_succeeds() function
   as GitLab docs show it returns a value.
 * Add return value to approve() function as GitLab docs show it
   returns a value.
 * Add 'get()' method so that type-checkers will understand that
   getting a project merge request is of type ProjectMergeRequest.
@JohnVillalovos JohnVillalovos force-pushed the jlvillal/mypy_merge_requests branch from 8a0f9de to f9c0ad9 Compare November 7, 2021 00:17
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 7, 2021

Codecov Report

❌ Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.96%. Comparing base (4ab9e92) to head (f9c0ad9).
⚠️ Report is 1484 commits behind head on main.

Files with missing lines Patch % Lines
gitlab/v4/objects/merge_requests.py 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1673      +/-   ##
==========================================
- Coverage   91.99%   91.96%   -0.04%     
==========================================
  Files          75       75              
  Lines        4337     4345       +8     
==========================================
+ Hits         3990     3996       +6     
- Misses        347      349       +2     
Flag Coverage Δ
cli_func_v4 81.88% <73.68%> (-0.04%) ⬇️
py_func_v4 81.15% <84.21%> (-0.02%) ⬇️
unit 83.68% <68.42%> (-0.04%) ⬇️

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

Files with missing lines Coverage Δ
gitlab/v4/objects/merge_requests.py 85.18% <84.21%> (-0.65%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +459 to +462
def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectMergeRequest:
return cast(ProjectMergeRequest, super().get(id=id, lazy=lazy, **kwargs))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe for a follow-up it'd be good to document this in the Development docs so we can point people to this in case they are adding new managers and get hit by mypy errors?

@nejch nejch merged commit 32ea954 into main Nov 7, 2021
@nejch nejch deleted the jlvillal/mypy_merge_requests branch November 7, 2021 09:31
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