krasnoukhov/gospotify

View on GitHub

Showing 7 of 19 total issues

Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render: function() {
    var icon = 'fa fa-' + this.props.icon;
    var content;

    if (!this.state.loaded) {
Severity: Minor
Found in public/application.js - About 1 hr to fix

    Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render: function() {
        var icon = 'fa fa-' + this.props.icon;
        var content;
    
        if (!this.state.loaded) {
    Severity: Minor
    Found in app/jsx/application.jsx - About 1 hr to fix

      Method remote_tracks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def remote_tracks(id)
          tracks = []
          params = { limit: 200, offset: 0 }
          path = path_for(id)
      
      
      Severity: Minor
      Found in app/clients/soundcloud.rb - About 1 hr 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

      Method remote_tracks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def remote_tracks(id)
          tracks = []
          params = { limit: 200, offset: 0 }
          path = path_for(id)
      
      
      Severity: Minor
      Found in app/clients/soundcloud.rb - About 1 hr to fix

        Method ensure_track has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def ensure_track(spotify_playlist, track)
            track.queries.each do |query|
              search_tracks = @api.search(:track, query)["tracks"]["items"]
        
              # puts query.inspect
        Severity: Minor
        Found in app/clients/spotify.rb - About 35 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

        Method call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def call(params)
              auth = compute_auth(params.env["omniauth.auth"])
        
              # Do not allow users w/o email
              if !auth.email && !(auth.user_id || user_signed_in)
        Severity: Minor
        Found in app/controllers/auth.rb - About 25 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

        Method compute_auth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def compute_auth(omniauth)
              auth = AuthRepository.by_external(
                omniauth[:provider], omniauth[:uid].to_s
              ) || Auth.new(
                provider: omniauth[:provider],
        Severity: Minor
        Found in app/controllers/auth.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language