MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

  def create
    @resource_import_textfile = ResourceImportTextfile.new(params[:resource_import_textfile])
    @resource_import_textfile.user = current_user
    extraparams = params[:extraparams]
    sheets              = []
Severity: Minor
Found in app/controllers/resource_import_textfiles_controller.rb - About 1 hr to fix

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

      def build_manifestation(h)
        bibResource = h['ndl_iss']['bibResource']
        item_raw = h['ndl_iss']['item']
        original_title = bibResource['title']['value']
        transcription = bibResource['title']['transcription']
    Severity: Minor
    Found in lib/enju_trunk/xml2db_service.rb - About 1 hr to fix

      Method create_pdf has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create_pdf(filename)
          coord = Struct.new("Coord", :x, :y)
          init = coord.new(30, 731)
          pos = coord.new(init.x, init.y)
          inter = coord.new(170, 72)
      Severity: Minor
      Found in app/models/barcode_sheet.rb - About 1 hr to fix

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

          def index
            @count = {}
        
            # set screen option
            @departments = Department.all
        Severity: Minor
        Found in app/controllers/users_controller.rb - About 1 hr to fix

          Method user_list has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def user_list(params)
              query = params[:query].to_s
              @query = query.dup
              @count = {}
          
          
          Severity: Minor
          Found in app/controllers/print_labels_controller.rb - About 1 hr to fix

            Function init has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function init(input, settings) {
            
                    var minicolors = $('<div class="minicolors" />'),
                        defaults = $.minicolors.defaults;
            
            
            Severity: Minor
            Found in app/assets/javascripts/jquery.minicolors.js - About 1 hr to fix

              Method excel_worksheet_value has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def excel_worksheet_value(ws_type, ws_col, sep_flg, ccount)
                  helper = Object.new
                  helper.extend(ItemsHelper)
                  helper.instance_eval { def t(*a) I18n.t(*a) end } # NOTE: ItemsHelper#i18n_rankの中でtを呼び出しているが、ヘルパーを直接利用しようとするとRedCloth由来のtが見えてしまうため、その回避策
                  val = nil
              Severity: Minor
              Found in app/models/item.rb - About 1 hr to fix

                Method val_v has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def val_v
                    # 先頭に数字が混ざる可能性があるため、検証する開始文字位置を定める
                    string_location = 0
                    v.split("").each do |spelling|
                      if string_location == 0 then
                Severity: Minor
                Found in app/models/abbreviation.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 last_issues has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def last_issues
                    return [] unless self.periodical
                    issues = []
                    serial_number = manifestations.where('serial_number IS NOT NULL').select(:serial_number).order('serial_number DESC').first.try(:serial_number)
                    if serial_number
                Severity: Minor
                Found in app/models/series_statement.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 get_abbreviation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.get_abbreviation(bookname)
                    # 当モデルのチェックメソッドを使用するため、レシーバのインスタンスを生成する
                    abbreviation_res = Abbreviation.new
                
                    merge_v = ""
                Severity: Minor
                Found in app/models/abbreviation.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 grep_num has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.grep_num(date, str, filename)
                    num = 0
                    date_line = ''
                
                    File.open(filename) do |f|
                Severity: Minor
                Found in app/models/access_log.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 volume_display has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def volume_display(manifestation)
                    return true if manifestation.edition_display_value?
                    return true unless manifestation.volume_number_string.blank?
                
                    unless SystemConfiguration.get("manifestation.volume_number_string_only")
                Severity: Minor
                Found in app/helpers/manifestations_helper.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 output_excelx has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.output_excelx(output_data, filename = nil)
                    require 'axlsx'
                
                    # initialize
                    if filename.present?
                Severity: Minor
                Found in app/models/checkout_statistics.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 do_direct_mode_process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def do_direct_mode_process(search_opts)
                    return false unless search_opts[:direct_mode]
                
                    manifestation = nil
                
                
                Severity: Minor
                Found in app/controllers/manifestations_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 check_duplicate_item_identifier has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def check_duplicate_item_identifier(sheet)
                      col = sheet.field_index('book.item_identifier')
                      return unless col
                
                      item_identifiers = {}
                Severity: Minor
                Found in lib/enju_trunk/resourceadapter/import_book.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 set_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_data(field_value, field_name, mode, model, options = {})
                      obj = nil
                      options[:can_blank]    = false    if options[:can_blank].nil?
                      options[:check_column] = :name    if options[:check_column].nil?
                
                
                Severity: Minor
                Found in lib/enju_trunk/resourceadapter/import_book.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 index has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index
                    @selected_circulation_ids = params[:circulation_status].map{|s| s.to_i} if params[:circulation_status]
                    if params[:pdf] || params[:tsv]
                      @displist = []
                      if params[:circulation_status].blank?
                Severity: Minor
                Found in app/controllers/checkoutlists_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 set_locale has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                      def set_locale
                        if params[:locale]
                          unless I18n.available_locales.include?(params[:locale].to_s.intern)
                            raise InvalidLocaleError
                          end
                Severity: Minor
                Found in lib/enju_trunk/enju_trunk_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 set_request_format has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                      def set_request_format
                        if session[:enju_mobile_view].nil?
                          if is_mobile_device? or is_tablet_device?
                            if should_request_html_format?
                              request.format = :html
                Severity: Minor
                Found in lib/enju_trunk/enju_trunk_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 modify has 43 lines of code (exceeds 25 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 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language