MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

File resource_import_file.rb has 543 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ResourceImportFile < ActiveRecord::Base
  attr_accessible :resource_import, :edit_mode
  include ImportFile
  default_scope :order => 'id DESC'
  scope :not_imported, where(:state => 'pending', :imported_at => nil)
Severity: Major
Found in app/models/resource_import_file.rb - About 1 day to fix

    Method get_manifestation_locate has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.get_manifestation_locate(manifestation, current_user)
        report = EnjuTrunk.new_report('manifestation_reseat.tlf')
       
        # footer
        report.layout.config.list(:list) do
    Severity: Minor
    Found in app/models/manifestation.rb - About 1 day 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

    Class Item has 60 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Item < ActiveRecord::Base
      extend ActiveRecordExtension
      attr_accessible :library_id, :shelf_id, :checkout_type_id, :circulation_status_id,
                      :retention_period_id, :call_number, :bookstore_id, :price, :price_string, :url,
                      :include_supplements, :use_restriction_id, :required_role_id,
    Severity: Major
    Found in app/models/item.rb - About 1 day to fix

      Method make_query_string_and_hl_pattern has 212 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def make_query_string_and_hl_pattern
          qwords = []
          highlight = []
      
          #
      Severity: Major
      Found in app/controllers/manifestations_controller.rb - About 1 day to fix

        Method make_detail_data has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

          def make_detail_data(item_statistics, second_items)
            detail = {:jpn_not_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
                      :foreign_not_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
                      :jpn_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
                      :foreign_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
        Severity: Minor
        Found in app/models/item_statistics.rb - About 1 day 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_index_plan has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

          def make_index_plan
            search_opts = {
              :index => :local,
            }
        
        
        Severity: Minor
        Found in app/controllers/manifestations_controller.rb - About 1 day 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 excel_worksheet_value has 210 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def excel_worksheet_value(ws_type, ws_col, sep_flg, ccount, item = nil)
            if ws_type == 'root'
              if root_manifestation = series_statement.try(:root_manifestation)
                root_manifestation.excel_worksheet_value('book', ws_col, sep_flg, ccount, item)
              else
        Severity: Major
        Found in app/models/manifestation.rb - About 1 day to fix

          Function create has 209 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Calendar.prototype.create = function (_par) {
              var parent = null;
              if (! _par) {
                  // default parent is the document body, in which case we create
                  // a popup calendar.
          Severity: Major
          Found in app/assets/javascripts/jquery.simplecalendarjp.js - About 1 day to fix

            File enju_trunk_controller.rb has 513 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module EnjuTrunk
              module EnjuTrunkController
                extend ActiveSupport::Concern
            
                class InvalidLocaleError < StandardError; end
            Severity: Major
            Found in lib/enju_trunk/enju_trunk_controller.rb - About 1 day to fix

              Method modify has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
              Open

                def modify
                  rows = open_import_file
                  row_num = 2
                  field = rows.first
                  rows.each do |row|
              Severity: Minor
              Found in app/models/resource_import_file.rb - About 1 day 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_item has a Cognitive Complexity of 53 (exceeds 5 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: Minor
              Found in lib/enju_trunk/resourceadapter/import_book.rb - About 1 day 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_userlist_tsv has 205 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.output_userlist_tsv(users)
                  columns = [
                    [:full_name, 'activerecord.attributes.agent.full_name'],
                    [:full_name_transcription, 'activerecord.attributes.agent.full_name_transcription'],
                    [:full_name_alternative, 'activerecord.attributes.agent.full_name_alternative'],
              Severity: Major
              Found in app/models/user.rb - About 1 day to fix

                Method update_or_create_manifestation has 198 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def update_or_create_manifestation(datas, sheet, manifestation_type, manifestation, not_set_serial_number, series_statement, error_msgs, external_resource, is_root = false)
                      if is_root
                        # root_manifestationのための処理を行う
                        field = 'root'
                        return nil unless series_statement
                Severity: Major
                Found in lib/enju_trunk/resourceadapter/import_book.rb - About 7 hrs to fix

                  File fg.menu.js has 494 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /*-------------------------------------------------------------------- 
                  Scripts for creating and manipulating custom menus based on standard <ul> markup
                  Version: 3.0, 03.31.2009
                  
                  By: Maggie Costello Wachs (maggie@filamentgroup.com) and Scott Jehl (scott@filamentgroup.com)
                  Severity: Minor
                  Found in app/assets/javascripts/fg.menu.js - About 7 hrs to fix

                    Function Menu has 188 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function Menu(caller, options){
                        var menu = this;
                        var caller = $(caller);
                        var container = $('<div class="fg-menu-container ui-widget ui-widget-content ui-corner-all">'+options.content+'</div>');
                        
                    Severity: Major
                    Found in app/assets/javascripts/fg.menu.js - About 7 hrs to fix

                      Method new_manifestation_from_nacsis_cat has 183 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def new_manifestation_from_nacsis_cat(nacsis_cat, book_types, volg_info = {}, manifestation = nil)
                              return nil if nacsis_cat.blank? # || book_types.blank?
                              nacsis_info = nacsis_cat.detail
                              attrs = {}
                              if nacsis_info[:source].nil?
                      Severity: Major
                      Found in app/models/nacsis_cat.rb - About 7 hrs to fix

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

                          def index
                            set_reserve_user
                            search_opts = make_index_plan # 検索動作の方針を抽出する
                        
                            @seconds = Benchmark.realtime do
                        Severity: Major
                        Found in app/controllers/manifestations_controller.rb - About 7 hrs to fix

                          Class User has 51 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class User < ActiveRecord::Base
                            self.extend UsersHelper
                            # Include default devise modules. Others available are:
                            # :token_authenticatable, :lockable and :timeoutable
                            devise :database_authenticatable, #:registerable, :confirmable,
                          Severity: Major
                          Found in app/models/user.rb - About 7 hrs to fix

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

                              def self.get_resource_import_textresults_excelx(resource_import_textresults)
                                # initialize
                                out_dir = "#{Rails.root}/private/system/manifestations_list_excelx"
                                excel_filepath = "#{out_dir}/list#{Time.now.strftime('%s')}#{rand(10)}.xlsx"
                                FileUtils.mkdir_p(out_dir) unless FileTest.exist?(out_dir)
                            Severity: Minor
                            Found in app/models/resource_import_textresult.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 45 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def index
                                unless can_use_purchase_request?
                                  access_denied; return
                                else
                                  if !user_signed_in?
                            Severity: Minor
                            Found in app/controllers/purchase_requests_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