bihealth / sodar-core

SODAR Core: A Django-based framework for building scientific data management web apps
MIT License
9 stars 1 forks source link

Form proper labels for Category/Project update link #1422

Closed gromdimon closed 3 months ago

gromdimon commented 4 months ago

Issue: #1421

gromdimon commented 4 months ago

It looks like some 'label' lines are now too long. Although Black and Flake8 do not raise any issues, this definitely doesn't follow conventions. There are multiple ways to solve this problem: reformatting the string using parentheses (), using the '+' syntax, adding a helper method, or introducing some temporary variables before appending the link.

The question now is: how should I address this issue?

mikkonie commented 3 months ago

It looks like some 'label' lines are now too long. Although Black and Flake8 do not raise any issues, this definitely doesn't follow conventions. There are multiple ways to solve this problem: reformatting the string using parentheses (), using the '+' syntax, adding a helper method, or introducing some temporary variables before appending the link.

The question now is: how should I address this issue?

This is a good point. You have "wrapped" the code inside the format string and strings are exempt from line length formatting in black. It is possible to do the following:

'label': f'Create '
'{get_display_name(PROJECT_TYPE_PROJECT, title=True)}',

That reduces line length and is accepted by black. Probably the best way unless you want to use the old style format() or get the title into a variable before inserting it into the string.