After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 774500 - Refactor gnome-music.in to be more readable
Refactor gnome-music.in to be more readable
Status: RESOLVED FIXED
Product: gnome-music
Classification: Applications
Component: general
unspecified
Other Linux
: Normal minor
: ---
Assigned To: gnome-music-maint
gnome-music-maint
Depends on:
Blocks:
 
 
Reported: 2016-11-16 03:01 UTC by ppalacios992
Modified: 2017-04-14 13:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome-music: groups configurations within functions (6.60 KB, patch)
2016-11-16 03:05 UTC, ppalacios992
none Details | Review
gnome-music: groups configurations within functions (6.67 KB, patch)
2016-11-22 15:25 UTC, ppalacios992
needs-work Details | Review
gnome-music.in: groups configurations within functions (6.65 KB, patch)
2017-02-28 22:32 UTC, ppalacios992
none Details | Review
gnome-music.in: groups configurations within functions (6.65 KB, patch)
2017-04-08 23:47 UTC, ppalacios992
committed Details | Review

Description ppalacios992 2016-11-16 03:01:54 UTC
gnome-music.in is the main entry point for gnome-music. It looks like it has grew up organically and it is somekind hard to understand now. 

Observing the commit history for this script, it is possible to see that it started with a marely trigger for gnome-music Gtk.Application and it has been inflated with many configurations (such as resources, libgd, i18n, etc...).

Following the wave of cleaning modules according to PEP-8, I think gnome-music could also be organised to group this configurations within functions, such as pitivi.in (https://github.com/pitivi/pitivi/blob/master/bin/pitivi.in), so it could be more easy to read, maintain and understand what is happening.
Comment 1 ppalacios992 2016-11-16 03:05:01 UTC
Created attachment 339986 [details] [review]
gnome-music: groups configurations within functions

gnome-music.in was refactored to be more readable. All
pre-configurations that are need to be made before starting gnome-music
were grouped in proper functions so it is now easies to read, understand
and maintain. It also follow PEP-8 where it is possible.
Comment 2 ppalacios992 2016-11-22 15:25:57 UTC
Created attachment 340524 [details] [review]
gnome-music: groups configurations within functions

gnome-music.in was refactored to be more readable. All
pre-configurations that are need to be made before starting gnome-music
were grouped in proper functions so it is now easies to read, understand
and maintain. It also follow PEP-8 where it is possible.
Comment 3 Marinus Schraal 2017-02-13 22:24:10 UTC
Review of attachment 340524 [details] [review]:

I'm pretty sure this is alright, but I haven't had the time to check it all. Nor am I sure what every element is supposed to do and how it might interact. So I think we're just gonna put in for the next dev cycle and see if anything comes up.

Some minor indentation fixes and this should be good to go.

::: gnome-music.in
@@ +100,3 @@
     parser = argparse.ArgumentParser()
+    parser.add_argument(
+        '-d', '--debug', action='store_true', default=False, dest='debug')

for indentation here I prefer indenting on the opening parenthesis if possible with the length of the arguments (the review tool isn't good with indentation examples like this :( ) :

function(arg1, arg2,
               arg3, arg4)

@@ +104,3 @@
     if args.debug:
+        logging.basicConfig(
+            level=logging.DEBUG, format=LOG_FORMAT, datefmt=LOG_DATE_FORMAT)

same

@@ +112,3 @@
     else:
+        logging.basicConfig(
+            level=logging.WARN, format=LOG_FORMAT, datefmt=LOG_DATE_FORMAT)

same
Comment 4 ppalacios992 2017-02-28 22:32:29 UTC
Created attachment 346939 [details] [review]
gnome-music.in: groups configurations within functions

All pre-configurations that must be set before starting gnome-music
were grouped in proper functions so it is now easier to read,
understand and maintain. It also follows PEP-8 when possible.
Comment 5 Marinus Schraal 2017-03-01 09:28:36 UTC
Review of attachment 346939 [details] [review]:

lgtm

::: gnome-music.in
@@ +60,3 @@
+
+
+# Log settigns

typo

& keep consistent: some comments do a white line after the comment, others don't. I'm in favor of no whitespace in this case.
Comment 6 ppalacios992 2017-04-08 23:47:00 UTC
Created attachment 349536 [details] [review]
gnome-music.in: groups configurations within functions

All pre-configurations that must be set before starting gnome-music
were grouped in proper functions so it is now easier to read,
understand and maintain. It also follows PEP-8 when possible.
Comment 7 Marinus Schraal 2017-04-14 06:56:22 UTC
Review of attachment 349536 [details] [review]:

lgtm
Comment 8 Marinus Schraal 2017-04-14 13:00:09 UTC
Fixed a mistake with the pkgdatadir being set from the localedir.

Thanks for the patch!