MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

        grand_totals.each do |grand_total|
          books_row << grand_total[:jpn_not_donate][book_sym]
          books_row << grand_total[:jpn_not_donate][price_sym] if conditions.money_aggregation.present?
          books_row << grand_total[:foreign_not_donate][book_sym]
          books_row << grand_total[:foreign_not_donate][price_sym] if conditions.money_aggregation.present?
Severity: Major
Found in app/models/item_statistics.rb and 1 other location - About 2 hrs to fix
app/models/item_statistics.rb on lines 777..785

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

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 search_by_gateway has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def search_by_gateway(options)
        # db_type = db_names = nil

        key_to_db = {
          all: '_ALL_',
Severity: Major
Found in app/models/nacsis_cat.rb - About 2 hrs to fix

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

      def index
        unless can_use_purchase_request?
          access_denied; return
        else
          if !user_signed_in?
    Severity: Major
    Found in app/controllers/purchase_requests_controller.rb - About 2 hrs to fix

      Method bulk_update has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def bulk_update
          unless (user_signed_in? and current_user.has_role?('Librarian'))
            access_denied; return
          end
          unless @basket
      Severity: Major
      Found in app/controllers/items_controller.rb - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

              if items.nil? || items.size < 1
                logger.warn "item data is empty"
              else
                items.each do |item|
                  row = []
        Severity: Critical
        Found in app/models/item.rb - About 2 hrs to fix

          Method export_tsv has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.export_tsv(expenses)
              dir_base = "#{Rails.root}/private/system"
              out_dir = "#{dir_base}/expense/"
              tsv_file = out_dir + "expenses.tsv"
              FileUtils.mkdir_p(out_dir) unless FileTest.exist?(out_dir)
          Severity: Minor
          Found in app/models/expense.rb - About 2 hrs to fix

            Method generate_order_list has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.generate_order_list(start_at, end_at)
                # generate order list
                logger.debug "self.generate_order_list start_at=#{start_at} end_at=#{end_at}"
            
                order_lists = OrderList.where(:ordered_at => start_at.beginning_of_day..end_at.end_of_day)
            Severity: Minor
            Found in app/models/order_list.rb - About 2 hrs to fix

              Method update_all has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def update_all
                  changed = failed = 0
                  abilities = {}
              
                  (params['function_class_abilities'] || {}).each do |function_id, ability|
              Severity: Minor
              Found in app/controllers/function_class_abilities_controller.rb - About 2 hrs to fix

                Method make_form_selector has 50 lines of code (exceeds 25 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 2 hrs to fix

                  Function move has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function move(target, event, animate) {
                  
                          var input = target.parents('.minicolors').find('.minicolors-input'),
                              settings = input.data('minicolors-settings'),
                              picker = target.find('[class$=-picker]'),
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.minicolors.js - About 1 hr to fix

                    Method do_numbering has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.do_numbering(name, is_save = true, options = {})
                        counter = 10
                        n = nil
                        number = ''
                        Numbering.transaction do
                    Severity: Minor
                    Found in app/models/numbering.rb - About 1 hr to fix

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

                        def new
                          @select_theme_tags = Manifestation.struct_theme_selects if defined?(EnjuTrunkTheme)
                          original_manifestation = Manifestation.where(:id => params[:manifestation_id]).first
                          if original_manifestation # GET /manifestations/new?manifestation_id=1
                            @manifestation = original_manifestation.dup
                      Severity: Minor
                      Found in app/controllers/manifestations_controller.rb - About 1 hr to fix

                        Method get_approval_report has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def get_approval_report
                            begin
                              @approval = Approval.find(params[:param])
                              case params[:output]
                              when 'report'
                        Severity: Minor
                        Found in app/controllers/approvals_controller.rb - About 1 hr to fix

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

                                                  else if (menuType == 'ipod') {
                                                      $(event.target).trigger('click');                        
                                                      setTimeout(function(){
                                                          $(event.target).next().find('a:eq(0)').trigger('mouseover');
                                                      }, options.crossSpeed);
                          Severity: Major
                          Found in app/assets/javascripts/fg.menu.js and 1 other location - About 1 hr to fix
                          app/assets/javascripts/fg.menu.js on lines 182..187

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

                          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

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

                                              if ($(event.target).is('.fg-menu-indicator') && menuType == 'ipod') {                            
                                                  $(event.target).trigger('click');                        
                                                  setTimeout(function(){
                                                      $(event.target).next().find('a:eq(0)').trigger('mouseover');
                                                  }, options.crossSpeed);                    
                          Severity: Major
                          Found in app/assets/javascripts/fg.menu.js and 1 other location - About 1 hr to fix
                          app/assets/javascripts/fg.menu.js on lines 155..160

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

                          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 generate_manifestation_list_internal has 48 lines of code (exceeds 25 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 1 hr to fix

                            Function hideShowCovered has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            Calendar.prototype.hideShowCovered = function () {
                                if (!Calendar.is_ie && !Calendar.is_opera)
                                    return;
                                function getVisib(obj){
                                    var value = obj.style.visibility;
                            Severity: Minor
                            Found in app/assets/javascripts/jquery.simplecalendarjp.js - About 1 hr to fix

                              Method hold_query has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def hold_query(command, db_type)
                                      return unless @item
                                      return @item.nacsis_identifier if command == 'delete'
                              
                                      query_field = command == 'update' ? ["ID=#{@item.nacsis_identifier}"] : []
                              Severity: Minor
                              Found in app/models/nacsis_cat.rb - About 1 hr to fix

                                Method bestreader has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def bestreader
                                    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
                                    end
                                Severity: Minor
                                Found in app/controllers/manifestation_exstats_controller.rb - About 1 hr to fix

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

                                    def create
                                      list_type = params[:export_item_register][:list_type]
                                      file_type = params[:export_item_register][:file_type]
                                      unless %w(pdf tsv).include?(file_type)
                                        flash[:message] = t('item_register.invalid_file_type')
                                  Severity: Minor
                                  Found in app/controllers/export_item_registers_controller.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language