Skip to content

feat: display human-readable attribute in repr() if present #2010

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
May 8, 2022

Conversation

nejch
Copy link
Member

@nejch nejch commented May 7, 2022

This supersedes #1996 by reusing existing scaffolding we already have for many other objects.

As an aside this should have the added benefit of further decoupling the CLI because we actually use _repr_attr in the API itself which was not yet the case with _short_print_attr and it was a bit out of place in base.py IMO. Now, the CLi simply reuses it.

Note: @Psycojoker this replaces name_with_namespace in your PR with path because we already had it and it'd otherwise be a breaking change on the CLI. Let me know if you want to override that, otherwise we'll use with_namespace in the next major release which I hope we can have soon with some other features. In any case I think the least confusing option would be path_with_namespace because people can name the group and project anything they like, so my-evil-group/my-evil-project can be named to display as GitLab.org / GitLab if using names.

@codecov-commenter
Copy link

Codecov Report

Merging #2010 (20c899e) into main (82c9a07) will increase coverage by 0.14%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2010      +/-   ##
==========================================
+ Coverage   92.51%   92.65%   +0.14%     
==========================================
  Files          78       78              
  Lines        4944     4944              
==========================================
+ Hits         4574     4581       +7     
+ Misses        370      363       -7     
Flag Coverage Δ
cli_func_v4 81.41% <84.09%> (-0.03%) ⬇️
py_func_v4 80.42% <77.27%> (-0.03%) ⬇️
unit 83.55% <93.18%> (+0.14%) ⬆️

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

Impacted Files Coverage Δ
gitlab/base.py 94.32% <100.00%> (+1.73%) ⬆️
gitlab/v4/cli.py 81.56% <100.00%> (ø)
gitlab/v4/objects/applications.py 100.00% <100.00%> (ø)
gitlab/v4/objects/commits.py 94.80% <100.00%> (ø)
gitlab/v4/objects/events.py 98.73% <100.00%> (ø)
gitlab/v4/objects/files.py 100.00% <100.00%> (ø)
gitlab/v4/objects/groups.py 88.65% <100.00%> (ø)
gitlab/v4/objects/hooks.py 100.00% <100.00%> (ø)
gitlab/v4/objects/issues.py 89.02% <100.00%> (ø)
gitlab/v4/objects/members.py 94.73% <100.00%> (ø)
... and 8 more

@nejch nejch requested a review from JohnVillalovos May 7, 2022 21:28
@JohnVillalovos
Copy link
Member

Thanks @nejch

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