dwarvesf/glod

View on GitHub

Showing 4 of 4 total issues

Method SoundCloud.GetDirectLink has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
Open

func (s *SoundCloud) GetDirectLink(link string) ([]glod.Response, error) {
    var listSong []glod.Response
    var song glod.Response
    var linkRequest = APILink + "url=" + link + "&client_id=" + ClientID

Severity: Minor
Found in soundcloud/soundcloud.go - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid deeply nested control flow statements.
Open

                    if strings.Contains(song.Title, "-") {
                        tmp := strings.Split(song.Title, "-")

                        song.Title = tmp[0]
                        song.Artist = tmp[1]
Severity: Major
Found in soundcloud/soundcloud.go - About 45 mins to fix

    Method SoundCloud.GetDirectLink has 5 return statements (exceeds 4 allowed).
    Open

    func (s *SoundCloud) GetDirectLink(link string) ([]glod.Response, error) {
        var listSong []glod.Response
        var song glod.Response
        var linkRequest = APILink + "url=" + link + "&client_id=" + ClientID
    
    
    Severity: Major
    Found in soundcloud/soundcloud.go - About 35 mins to fix

      Method Youtube.GetDirectLink has 5 return statements (exceeds 4 allowed).
      Open

      func (youtube *Youtube) GetDirectLink(link string) ([]glod.Response, error) {
          var listSong []glod.Response
      
          var song glod.Response
      
      
      Severity: Major
      Found in youtube/youtube.go - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language