phateio/kiris

View on GitHub

Showing 37 of 43 total issues

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

  def update
    id = params[:id]

    issue_id = request.POST[:issue_id].to_i
    issue_status = request.POST[:issue_status].to_s
Severity: Minor
Found in app/controllers/issues_controller.rb - About 1 hr to fix

    Method confirm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def confirm
        @track = Track.find(track_id)
        set_site_title(I18n.t('admin.track.review_title_with_index', id: @track.id))
        message = ''
        message += "Title: 「#{@track.title}」→「#{track_params[:title]}」" if @track.title != track_params[:title]
    Severity: Minor
    Found in app/controllers/admin/tracks_controller.rb - About 45 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 index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        items = []
        playlist_colle = Playlist.includes(:track).order(playedtime: :desc, id: :asc).limit(4).load
        playlist_colle.each do |playlist|
          track = playlist.track
    Severity: Minor
    Found in app/controllers/bridge/playlist_controller.rb - About 45 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 redirect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def redirect
        icy_metadata = request.env['HTTP_ICY_METADATA']
        request_protocol = request.protocol # Returns 'https://' if this is an SSL request and 'http://' otherwise.
    
        if $ICECAST_SERVER
    Severity: Minor
    Found in app/controllers/listen_controller.rb - About 45 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        set_site_title("#{I18n.t('navbar.images')}##{track_id}")
        userip = @client[:ip]
        @track = Track.find(track_id)
        @image = @track.images.build(image_params)
    Severity: Minor
    Found in app/controllers/tracks/images_controller.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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        id = params[:id]
    
        issue_id = request.POST[:issue_id].to_i
        reply_id = request.POST[:reply_id].to_i
    Severity: Minor
    Found in app/controllers/issues_controller.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

    Avoid too many return statements within this method.
    Open

            return 'Hong Kong'
    Severity: Major
    Found in app/controllers/application_controller.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return 'Taipei'
      Severity: Major
      Found in app/controllers/application_controller.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              render 'new' and return
        Severity: Major
        Found in app/controllers/upload/niconico_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                render 'new' and return
          Severity: Major
          Found in app/controllers/upload/niconico_controller.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return 'Beijing'
            Severity: Major
            Found in app/controllers/application_controller.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    render 'new' and return
              Severity: Major
              Found in app/controllers/upload/niconico_controller.rb - About 30 mins to fix

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

                  def set_locale!
                    I18n.locale = I18n.default_locale
                    @@available_locales ||= I18n.available_locales.map(&:to_s)
                    if preference_params['locale']
                      locale = preference_params['locale']
                Severity: Minor
                Found in app/controllers/application_controller.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def update
                    set_site_title(I18n.t('upload.niconico.title'))
                    @track = Track.find(track_id)
                    redirect_to_index_if_not_permitted(@track); return if performed?
                    @track.attributes = track_params
                Severity: Minor
                Found in app/controllers/upload/niconico_controller.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def update
                    set_site_title(I18n.t('admin.notices.notification_management'))
                
                    ids = request.POST[:id].to_a
                    datelines = request.POST[:dateline].to_a
                Severity: Minor
                Found in app/controllers/admin/notices_controller.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 get_niconico_thumb_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def get_niconico_thumb_info(video_id)
                    res_body = http_get_response_body("http://ext.nicovideo.jp/api/getthumbinfo/#{video_id}") rescue nil
                    return false if res_body.nil?
                    thumb_info_doc = Nokogiri::XML(res_body)
                    thumb_element = thumb_info_doc.xpath('/nicovideo_thumb_response/thumb')
                Severity: Minor
                Found in app/controllers/upload/niconico_controller.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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index
                    set_site_title(I18n.t('members.login'))
                
                    referer = request.headers['X-XHR-Referer']
                    render file: 'public/403.html', status: :forbidden, layout: false and return if referer.nil?
                Severity: Minor
                Found in app/controllers/members_controller.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