MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

  def show
    case params[:size]
    when 'original'
      size = 'original'
    when 'thumb'
Severity: Minor
Found in app/controllers/picture_files_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 make_form_selector has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

 def make_form_selector(string, system_configuration)
   string << "<select name=system_configurations[#{ system_configuration.id }]>"
   case system_configuration.keyname
   when 'header.disp_date'
     3.times do |i|
Severity: Minor
Found in app/helpers/system_configurations_helper.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 make_data has 172 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def make_data
    items = Item.select("items.id")
    items = items.joins(:manifestation)
    items = items.joins(:budget_category)
    items = items.joins(:shelf)
Severity: Major
Found in app/models/item_statistics.rb - About 6 hrs to fix

    Method output_detail has 170 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.output_detail(wbstyles, sheet, data, conditions, cols, remove = nil)
        default_style = wbstyles.add_style :font_name => Setting.item_statistics_print_excelx.fontname
    
        if remove.blank?
          book_sym = "book".to_sym
    Severity: Major
    Found in app/models/item_statistics.rb - About 6 hrs to fix

      Method get_next_number has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_next_number(current_volume, current_issue)
          next_volume = self.volume_param.nil? ? nil : current_volume
          next_issue = self.issue_param.nil? ? nil : current_issue
      
          next_issue = current_issue + self.issue_param if current_issue && self.issue_param
      Severity: Minor
      Found in app/models/sequence_pattern.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

      File users_controller.rb has 447 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class UsersController < ApplicationController
        authorize_function
        add_breadcrumb "I18n.t('page.listing', :model => I18n.t('activerecord.models.user'))", 'users_path', :only => [:index]
        add_breadcrumb "I18n.t('page.new', :model => I18n.t('activerecord.models.user'))", 'new_user_path', :only => [:new, :create]
        add_breadcrumb "I18n.t('page.editing', :model => I18n.t('activerecord.models.user'))", 'edit_user_path(params[:id])', :only => [:edit, :update]
      Severity: Minor
      Found in app/controllers/users_controller.rb - About 6 hrs to fix

        Method get_manifestation_list_pdf has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.get_manifestation_list_pdf(manifestation_ids, current_user, summary = nil, type = :book)
            report = EnjuTrunk.new_report('searchlist.tlf')
        
            # set page_num
            report.events.on :page_create do |e|
        Severity: Minor
        Found in app/models/manifestation.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 new has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

          def new
            if Shelf.real.blank?
              flash[:notice] = t('item.create_shelf_first')
              redirect_to libraries_url
              return
        Severity: Minor
        Found in app/controllers/items_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 output_csv has 164 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def output_csv
            approvals = Approval.scoped
            # approval_identifier
            unless params[:approval_identifier].blank?
              approvals = approvals.where(["approvals.approval_identifier like ?", params[:approval_identifier] + "%"])
        Severity: Major
        Found in app/controllers/approvals_controller.rb - About 6 hrs to fix

          Method update_or_create_item has 161 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def update_or_create_item(datas, sheet, textfile, numbering, auto_numbering, manifestation, item, error_msgs)
                if item
                  mode = 'edit'
                  item.manifestation.try(:reload) # ActiveRecord::StaleObjectError回避
          
          
          Severity: Major
          Found in lib/enju_trunk/resourceadapter/import_book.rb - About 6 hrs to fix

            Method search_family has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

              def search_family
                return nil unless request.xhr?
                unless params[:keys].blank?
                  tel_1 = params[:keys][:tel_1]
                  tel_1.delete!("-")
            Severity: Minor
            Found in app/controllers/users_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 index has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
                flash[:reserve_notice] = ""
                unless params[:do_search].blank?
                  query = params[:query].to_s.strip
                  @query = query.dup
            Severity: Minor
            Found in app/controllers/reminder_lists_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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                if (options.positionOpts.directionV == 'up') {
                    el.css({ top: 'auto', bottom: yVal });
                    if (options.positionOpts.detectV && !fitVertical(el)) {
                        el.css({ bottom: 'auto', top: yVal });
                    }
            Severity: Major
            Found in app/assets/javascripts/fg.menu.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/fg.menu.js on lines 517..528

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 163.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                if (options.positionOpts.directionH == 'left') {
                    el.css({ left: 'auto', right: xVal });
                    if (options.positionOpts.detectH && !fitHorizontal(el)) {
                        el.css({ right: 'auto', left: xVal });
                    }
            Severity: Major
            Found in app/assets/javascripts/fg.menu.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/fg.menu.js on lines 503..514

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 163.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

              def show
                @location_symbol_size = Keycode.where(:name => 'item.location_symbol')
            
                if params[:isbn].present?
                  if @manifestation_redirect = Manifestation.find_by_isbn(params[:isbn])
            Severity: Minor
            Found in app/controllers/manifestations_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 index has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
                @count = {}
                page = params[:page] || 1
            
                # when create a item 
            Severity: Minor
            Found in app/controllers/shelves_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 edit has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

              def edit
                unless current_user.has_role?('Librarian')
                  unless params[:mode] == 'tag_edit'
                    access_denied
                  end
            Severity: Minor
            Found in app/controllers/manifestations_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 index has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
                #session[:params] = {} unless session[:params]
                #session[:params][:agent] = params
                # 最近追加されたパトロン
                #@query = params[:query] ||= "[* TO *]"
            Severity: Minor
            Found in app/controllers/agents_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 make_data has 153 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def make_data
                # 集計日付を求める
                if md = self.checked_at_from.match(/^([0-9]{4})-([0-9]{2})$/)
                  checked_at_from = "#{md[1]}-#{md[2]}-01"
                else
            Severity: Major
            Found in app/models/checkout_statistics.rb - About 6 hrs to fix

              Method make_query_filter has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

                def make_query_filter(options)
                  with = []
                  without = []
              
                  #
              Severity: Minor
              Found in app/controllers/manifestations_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

              Severity
              Category
              Status
              Source
              Language