phateio/kiris

View on GitHub

Showing 43 of 43 total issues

Method create has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    items = {}

    track_id = request.POST[:track_id]
    nickname = request.POST[:nickname].to_s.strip
Severity: Minor
Found in app/controllers/json/request_controller.rb - About 7 hrs 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 42 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    items = []
    timeout = 60.seconds

    CacheLock.synchronize(:playlist) do
Severity: Minor
Found in app/controllers/json/playlist_controller.rb - About 6 hrs 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 134 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    items = {}

    track_id = request.POST[:track_id]
    nickname = request.POST[:nickname].to_s.strip
Severity: Major
Found in app/controllers/json/request_controller.rb - About 5 hrs to fix

    Class ApplicationController has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ApplicationController < ActionController::Base
      # Prevent CSRF attacks by raising an exception.
      # For APIs, you may want to use :null_session instead.
      protect_from_forgery with: :exception
      before_action :set_locale!
    Severity: Minor
    Found in app/controllers/application_controller.rb - About 2 hrs to fix

      Method index has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def index
          items = []
          timeout = 60.seconds
      
          CacheLock.synchronize(:playlist) do
      Severity: Major
      Found in app/controllers/json/playlist_controller.rb - About 2 hrs to fix

        Method fetch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def fetch
            set_site_title(I18n.t('upload.niconico.title'))
            @track = Track.new(track_params)
            if @track.niconico.empty?
              flash.now[:error] = I18n.t('upload.niconico.blank_niconico_id')
        Severity: Minor
        Found in app/controllers/upload/niconico_controller.rb - About 2 hrs 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_or_create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_or_create
            set_site_title(I18n.t('navbar.catalog'))
            @catalog_old = Catalog.order(id: :desc).limit(1).first
            @catalog_new = Catalog.new(catalog_params)
        
        
        Severity: Minor
        Found in app/controllers/catalogs_controller.rb - About 2 hrs 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 fetch has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def fetch
            set_site_title(I18n.t('upload.niconico.title'))
            @track = Track.new(track_params)
            if @track.niconico.empty?
              flash.now[:error] = I18n.t('upload.niconico.blank_niconico_id')
        Severity: Major
        Found in app/controllers/upload/niconico_controller.rb - About 2 hrs to fix

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

            def update
              secret_key = request.POST[:secret_key]
              szhash = request.POST[:szhash] || request.POST[:hash]
              if secret_key != $BRIDGE_SECRET_KEY
                render nothing: true, status: :forbidden and return
          Severity: Minor
          Found in app/controllers/bridge/playlist_controller.rb - About 1 hr to fix

            Method show has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def show
                #set_site_title("#{I18n.t('upload.asin.title')}『#{asin_id}』")
                @items = []
            
                flash.now[:error] = 'invalid_amazon_asin' and return if (/^[A-Z0-9]{10}$/ =~ asin_id) == nil
            Severity: Minor
            Found in app/controllers/upload/asin_controller.rb - About 1 hr to fix

              Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def update
                  secret_key = request.POST[:secret_key]
                  szhash = request.POST[:szhash] || request.POST[:hash]
                  if secret_key != $BRIDGE_SECRET_KEY
                    render nothing: true, status: :forbidden and return
              Severity: Minor
              Found in app/controllers/bridge/playlist_controller.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 update has 37 lines of code (exceeds 25 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 1 hr to fix

                Method update_or_create has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def update_or_create
                    set_site_title(I18n.t('navbar.catalog'))
                    @catalog_old = Catalog.order(id: :desc).limit(1).first
                    @catalog_new = Catalog.new(catalog_params)
                
                
                Severity: Minor
                Found in app/controllers/catalogs_controller.rb - About 1 hr to fix

                  Method create has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def create
                      set_site_title(I18n.t('issues.new_issue'))
                      @typeids ||= ['question', 'suggestion', 'appeal']
                  
                      dateline = Time.now.utc
                  Severity: Minor
                  Found in app/controllers/issues_controller.rb - About 1 hr to fix

                    Method show has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def show
                        @item = {}
                        @item_replies = []
                        id = params[:id]
                        issue = Issue.where(id: id).first
                    Severity: Minor
                    Found in app/controllers/issues_controller.rb - About 1 hr to fix

                      Method show has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def show
                          #set_site_title("#{I18n.t('upload.asin.title')}『#{asin_id}』")
                          @items = []
                      
                          flash.now[:error] = 'invalid_amazon_asin' and return if (/^[A-Z0-9]{10}$/ =~ asin_id) == nil
                      Severity: Minor
                      Found in app/controllers/upload/asin_controller.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 import has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def import
                          attachment = params[:attachment]
                          items = JSON.parse(attachment.read)
                          destroy_all = request.POST[:destroy_all]
                      
                      
                      Severity: Minor
                      Found in app/controllers/admin/images_controller.rb - About 1 hr to fix

                        Method append has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def append
                            id = params[:id]
                            issue = Issue.where(id: id).first
                        
                            dateline = Time.now.utc
                        Severity: Minor
                        Found in app/controllers/issues_controller.rb - About 1 hr to fix

                          Method create has 28 lines of code (exceeds 25 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 1 hr to fix

                            Method update has a Cognitive Complexity of 10 (exceeds 5 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

                            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