mirror of
https://github.com/mathenz/goffy.git
synced 2026-04-26 07:35:56 +03:00
[GH-ISSUE #2] some advice #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @marcelloh on GitHub (Oct 12, 2023).
Original GitHub issue: https://github.com/mathenz/goffy/issues/2
YTSong is just a local var, so it shouldn't have uppercase at the beginning: replace by ytSong and it works fine.
There are probably more of those :-)
With my linter I can see that there are some functions that are candidates to refactor.
(Because they are "too complex"; everything above 12 is mentioned)
To explain a bit more:
goffy/downloader.go:78:1 - dlFromTxt has complexity: 13
complexity = 1
goffy/downloader.go:147:1 - dlTracks has complexity: 14
complexity = 1
goffy/youtube.go:28:1 - Match has complexity: 27
complexity = 1
+ 4 (found 'if' at line: 57, complexity = 21)
6 = files
39 = functions
27 = highest complexity
4.92 = overall average complexity
@mathenz commented on GitHub (Oct 12, 2023):
Thank you for the suggestions. I'm going to look at them in more detail.
@marcelloh commented on GitHub (Oct 13, 2023):
If you need some help, let me know
@mathenz commented on GitHub (Oct 19, 2023):
I improved some of the code in certain functions and methods. There were other functions that I didn't consider important enough to refactor (e.g., ToZip). I refactored the code in significant parts such as dlTracks() and Match(). Thank you for introducing me to the concept of complexity; I hadn't been considering it.
@marcelloh commented on GitHub (Oct 19, 2023):
For me, running my linter against this, was a piece of cake. You did all the hard work :-)
I'm thinking about writing some stuff about it and how it can help people in writing more maintainable software.
I'll let you know.
@marcelloh commented on GitHub (Oct 19, 2023):
https://dev.to/marcello_h/solve-code-complexity-in-go-56hg