MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

Method add_exinfos has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.add_exinfos(exinfos, item_id)
    return [] if exinfos.blank?
    list = []
    exinfos.each do |key, value|
      name = key.split('_').first 
Severity: Minor
Found in app/models/item_exinfo.rb - About 1 hr to fix

    Method add_exinfos has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.add_exinfos(exinfos, manifestation_id)
        return [] if exinfos.blank?
        list = []
        exinfos.each do |key, value|
          name = key.split('_').first
    Severity: Minor
    Found in app/models/manifestation_exinfo.rb - About 1 hr to fix

      Method new has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def new
          if user_signed_in?
            unless current_user.has_role?('Librarian')
              access_denied; return
            end
      Severity: Minor
      Found in app/controllers/users_controller.rb - About 1 hr to fix

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

        Calendar.findMonth = function(el) {
            if (typeof el.month != "undefined") {
                return el;
            } else if (typeof el.parentNode.month != "undefined") {
                return el.parentNode;
        Severity: Major
        Found in app/assets/javascripts/jquery.simplecalendarjp.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/jquery.simplecalendarjp.js on lines 307..314

        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 69.

        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

        Calendar.findYear = function(el) {
            if (typeof el.year != "undefined") {
                return el;
            } else if (typeof el.parentNode.year != "undefined") {
                return el.parentNode;
        Severity: Major
        Found in app/assets/javascripts/jquery.simplecalendarjp.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/jquery.simplecalendarjp.js on lines 298..305

        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 69.

        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

              ResourceImportTextresult.generate_resource_import_textresult_list_internal(textresults, output_type) do |output|
                io, info = user_file.create(:resource_import_results, output.filename)
                if output.result_type == :path
                  open(output.path) { |io2| FileUtils.copy_stream(io2, io) }
                else
        Severity: Major
        Found in app/models/resource_import_textresult.rb and 1 other location - About 1 hr to fix
        app/models/checkoutlist.rb on lines 67..80

        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 68.

        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

              Checkoutlist.generate_checkoutlist(output_type, circulation_status_ids) do |output|
                io, info = user_file.create(:checkoutlist, output.filename)
                if output.result_type == :path
                  open(output.path) {|io2| FileUtils.copy_stream(io2, io) }
                else
        Severity: Major
        Found in app/models/checkoutlist.rb and 1 other location - About 1 hr to fix
        app/models/resource_import_textresult.rb on lines 221..234

        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 68.

        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

        Function showYearsCombo has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Calendar.showYearsCombo = function (fwd) {
            var cal = Calendar._C;
            if (!cal) {
                return false;
            }
        Severity: Minor
        Found in app/assets/javascripts/jquery.simplecalendarjp.js - About 1 hr to fix

          Method make_export_removed_list_tsv has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.make_export_removed_list_tsv(items)
              data = String.new
              data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
          
              columns = [
          Severity: Minor
          Found in app/models/item.rb - About 1 hr to fix

            Method build_new_record has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def build_new_record
                  if action_name == 'new'
                    form_input = params
                  else
                    form_input = params[:nacsis_user_request]
            Severity: Minor
            Found in app/controllers/nacsis_user_requests_controller.rb - About 1 hr to fix

              Method bestrequest has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def bestrequest
                  logger.info "bestrequest start"
                  if params[:opac] and params[:search_date_first].blank? and params[:search_date_last].blank?
                    @start_d = (Date.today - 2.weeks).to_s
                    @end_d = Date.today.to_s
              Severity: Minor
              Found in app/controllers/manifestation_exstats_controller.rb - About 1 hr to fix

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

                  def update
                    @user = current_user
                
                    respond_to do |format|
                =begin
                Severity: Minor
                Found in app/controllers/my_accounts_controller.rb - About 1 hr to fix

                  Method get_list_size has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def get_list_size
                      if !request.xhr? || params[:list_type].blank?
                        render :nothing => true, :status => :not_found
                        return
                  
                  
                  Severity: Minor
                  Found in app/controllers/export_item_registers_controller.rb - About 1 hr to fix

                    Method build_associated_records has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def build_associated_records(sheet, datas, record, assoc_name, spec)
                          field_keys = spec.values.map(&:first)
                          target_data = sheet.field_data_set(datas, field_keys)
                          return nil if target_data.nil?
                    
                    
                    Severity: Minor
                    Found in lib/enju_trunk/resourceadapter/import_book.rb - About 1 hr to fix

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

                          this.create = function(){    
                              container.css({ width: options.width }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');
                              container.find('ul, li a').addClass('ui-corner-all');
                              
                              // aria roles & attributes
                      Severity: Minor
                      Found in app/assets/javascripts/fg.menu.js - About 1 hr to fix

                        Method make_item_register_pdf has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def self.make_item_register_pdf(pdf_file, items, list_title = nil)
                            report = EnjuTrunk.new_report('item_register.tlf')
                            report.events.on :page_create do |e|
                              e.page.item(:page).value(e.page.no)
                            end
                        Severity: Minor
                        Found in app/models/item.rb - About 1 hr to fix

                          Method make_export_new_item_list_tsv has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def self.make_export_new_item_list_tsv(items)
                              data = String.new
                              data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
                          
                              # set term
                          Severity: Minor
                          Found in app/models/item.rb - About 1 hr to fix

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

                              def create_pdf
                                @barcode_list = BarcodeList.find(params[:barcode_list_id])
                                start_number = params[:barcode_list][:start_number]
                                end_number = params[:barcode_list][:end_number]
                            
                            
                            Severity: Minor
                            Found in app/controllers/barcode_lists_controller.rb - About 1 hr to fix

                              Method open_import_file has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def open_import_file
                                  tempfile = Tempfile.new('agent_import_file')
                                  if Setting.uploaded_file.storage == :s3
                                    uploaded_file_path = open(self.agent_import.expiring_url(10)).path
                                  else
                              Severity: Minor
                              Found in app/models/agent_import_file.rb - About 1 hr to fix

                                Method make_form has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def make_form(system_configuration, errors = nil)
                                    #TODO:
                                    error = nil
                                    if errors
                                      errors.each do |e|
                                Severity: Minor
                                Found in app/helpers/system_configurations_helper.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language