MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

Method hidden_advanced_search_field_tags has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def hidden_advanced_search_field_tags
      array = []
      ADVANCED_SEARCH_PARAMS.map do |name|
        if name == :manifestation_types
          next unless params[name]
Severity: Minor
Found in lib/enju_trunk/enju_trunk_helper.rb - About 3 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 get_manifestation_locate has 89 lines of code (exceeds 25 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: Major
Found in app/models/manifestation.rb - About 3 hrs to fix

    Method process_book_data has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def process_book_data(import_textresult, datas, sheet, textfile, numbering, auto_numbering, not_set_serial_number, external_resource)
          manifestation = series_statement = item = nil
          error_msgs = []
    
          # 所蔵、シリーズ、書誌を特定する
    Severity: Major
    Found in lib/enju_trunk/resourceadapter/import_book.rb - About 3 hrs to fix

      Method output_excelx has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.output_excelx(output_data, filename = nil)
          require 'axlsx'
      
          # initialize
          if filename.present?
      Severity: Major
      Found in app/models/item_statistics.rb - About 3 hrs to fix

        Function parseDate has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Date.parseDate = function(str, fmt) {
            var today = new Date();
            var y = 0;
            var m = -1;
            var d = 0;
        Severity: Major
        Found in app/assets/javascripts/jquery.simplecalendarjp.js - About 3 hrs to fix

          Function Menu has a Cognitive Complexity of 24 (exceeds 5 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: Minor
          Found in app/assets/javascripts/fg.menu.js - About 3 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 get_resource_import_textresults_tsv_csv has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.get_resource_import_textresults_tsv_csv(resource_import_textresults)
              split = SystemConfiguration.get("set_output_format_type") ? "\t" : ","
              before_sheet_name = nil
              data = String.new
              data << "\xEF\xBB\xBF".force_encoding("UTF-8")
          Severity: Minor
          Found in app/models/resource_import_textresult.rb - About 3 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 delete_article has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.delete_article(result)
              item = Item.find(result.item_id) rescue nil
              if item
                if item.manifestation.article?
                  if item.reserve
          Severity: Minor
          Found in app/models/resource_import_textresult.rb - About 3 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_reminder_letter has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.output_reminder_letter(file, reminder_lists, user, current_user)
              logger.info "create_file=> #{file}"
          
              report = EnjuTrunk.new_report('reminder_letter.tlf')
              report.layout.config.list(:list) do
          Severity: Minor
          Found in app/models/reminder_list.rb - About 3 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 upload_info_to_nacsis has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def upload_info_to_nacsis(id, db_type, command)
                return {} unless check_upload_params(id, db_type, command)
          
                req_query = {}
          
          
          Severity: Minor
          Found in app/models/nacsis_cat.rb - About 3 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_pdf has a Cognitive Complexity of 24 (exceeds 5 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 3 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_familylist_pdf has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.output_familylist_pdf(families)
              max_family_column = 7
              report = EnjuTrunk.new_report('familylist.tlf')
          
              # set page_num
          Severity: Minor
          Found in app/models/family.rb - About 3 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 a Cognitive Complexity of 24 (exceeds 5 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 3 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 set_attributes has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def set_attributes(record, datas, sheet, opts)
                opts.each do |attr_name, (field_key, *convs)|
                  set_nil_when_blank = false
                  allow_overwrite = true
                  value = sheet.field_data(datas, field_key)
          Severity: Minor
          Found in lib/enju_trunk/resourceadapter/import_book.rb - About 3 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_manifestation_languages has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def update_manifestation_languages(sheet, datas, field, manifestation, error_msgs)
                if Manifestation.separate_output_columns?
                  records = build_associated_records(sheet, datas, manifestation, :work_has_languages, {
                    language_id: ["#{field}.language", Language, :name],
                    language_type: ["#{field}.language_type", LanguageType, :name, allow_blank: true],
          Severity: Minor
          Found in lib/enju_trunk/resourceadapter/import_book.rb - About 3 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_index_plan has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def make_index_plan
              search_opts = {
                :index => :local,
              }
          
          
          Severity: Major
          Found in app/controllers/manifestations_controller.rb - About 3 hrs to fix

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

              def index
                unless SystemConfiguration.get("user_show_questions")
                  unless current_user.has_role?('Librarian')
                    access_denied; return
                  end
            Severity: Major
            Found in app/controllers/questions_controller.rb - About 3 hrs to fix

              Function updateFromInput has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function updateFromInput(input, preserveInputValue) {
              
                      var hex,
                          hsb,
                          opacity,
              Severity: Major
              Found in app/assets/javascripts/jquery.minicolors.js - About 3 hrs to fix

                Method generate_manifestation_list_internal has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.generate_manifestation_list_internal(manifestation_ids, output_type, current_user, summary, cols, &block)
                    output = OpenStruct.new
                    output.result_type = output_type == :excelx ? :path : :data
                    case output_type
                    when :pdf 
                Severity: Minor
                Found in app/models/manifestation.rb - About 3 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_user_label_pdf has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.output_user_label_pdf(user_ids, output_types)
                    report = EnjuTrunk.new_report('agent_label.tlf')
                
                    user_ids.each do |user_id|
                      user = User.find(user_id)
                Severity: Minor
                Found in app/models/user_label.rb - About 3 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