MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

    if (Calendar.is_ie) {
        posY = window.event.clientY + document.body.scrollTop;
        posX = window.event.clientX + document.body.scrollLeft;
    } else {
        posX = ev.pageX;
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 1639..1645

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

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 (Calendar.is_ie) {
        posY = window.event.clientY + document.body.scrollTop;
        posX = window.event.clientX + document.body.scrollLeft;
    } else {
        posY = ev.clientY + window.scrollY;
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 538..544

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

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 3 locations. Consider refactoring.
Open

                y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
Severity: Major
Found in app/assets/javascripts/jquery.minicolors.js and 2 other locations - About 1 hr to fix
app/assets/javascripts/jquery.minicolors.js on lines 553..553
app/assets/javascripts/jquery.minicolors.js on lines 571..571

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

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 3 locations. Consider refactoring.
Open

  def calculate_count
    self.started_at = Time.zone.now
    User.find_each do |user|
      daily_count = user.checkouts.completed(self.start_date, self.end_date).size
      if daily_count > 0
Severity: Major
Found in app/models/user_checkout_stat.rb and 2 other locations - About 1 hr to fix
app/models/manifestation_reserve_stat.rb on lines 16..29
app/models/user_reserve_stat.rb on lines 17..29

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

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 3 locations. Consider refactoring.
Open

  def calculate_count
    self.started_at = Time.zone.now
    User.find_each do |user|
      daily_count = user.reserves.created(self.start_date, self.end_date).size
      if daily_count > 0
Severity: Major
Found in app/models/user_reserve_stat.rb and 2 other locations - About 1 hr to fix
app/models/manifestation_reserve_stat.rb on lines 16..29
app/models/user_checkout_stat.rb on lines 17..29

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

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 3 locations. Consider refactoring.
Open

                y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
Severity: Major
Found in app/assets/javascripts/jquery.minicolors.js and 2 other locations - About 1 hr to fix
app/assets/javascripts/jquery.minicolors.js on lines 535..535
app/assets/javascripts/jquery.minicolors.js on lines 571..571

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

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 update_or_create_manifestation has 9 arguments (exceeds 4 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)
Severity: Major
Found in lib/enju_trunk/resourceadapter/import_book.rb - About 1 hr to fix

    Method book_binding has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

       def book_binding
        Item.transaction do
          if self.binding_items.blank?
             errors[:base] = I18n.t('activerecord.errors.messages.bookbinding.bookbinding_nil')
             return nil
    Severity: Minor
    Found in app/models/bookbinding.rb - About 1 hr to fix

      Function dayMouseDown has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Calendar.dayMouseDown = function(ev) {
          var el = Calendar.getElement(ev);
          if (el.disabled) {
              return false;
          }
      Severity: Minor
      Found in app/assets/javascripts/jquery.simplecalendarjp.js - About 1 hr to fix

        Method get_keyword_counts_list_excelx has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.get_keyword_counts_list_excelx(all_results)
            require 'axlsx'
        
            # initialize
            out_dir = "#{Rails.root}/private/system/keyword_counts_list_excelx"
        Severity: Minor
        Found in app/models/keyword_count.rb - About 1 hr to fix

          Method output_user_label_pdf has 28 lines of code (exceeds 25 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 1 hr to fix

            Function fixPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function fixPosition(box) {
                    if (box.x < 0)
                        box.x = 0;
                    if (box.y < 0)
                        box.y = 0;
            Severity: Minor
            Found in app/assets/javascripts/jquery.simplecalendarjp.js - About 1 hr to fix

              Method open_import_file has 28 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.resource_import.expiring_url(10)).path
                  else
              Severity: Minor
              Found in app/models/resource_import_file.rb - About 1 hr to fix

                Method make_export_new_book_list_pdf has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.make_export_new_book_list_pdf(items)
                    return false if items.blank?
                    report = EnjuTrunk.new_report('new_book_list')
                
                    report.events.on :page_create do |e|
                Severity: Minor
                Found in app/models/item.rb - About 1 hr to fix

                  Method create_series_with_relation_from_nacsis_cat has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def create_series_with_relation_from_nacsis_cat(nacsis_cat, book_types)
                          return nil if nacsis_cat.blank? || book_types.blank?
                  
                          # 元の雑誌情報作成
                          series_statement = create_series_statement_from_nacsis_cat(nacsis_cat, book_types)
                  Severity: Minor
                  Found in app/models/nacsis_cat.rb - About 1 hr to fix

                    Method create_pdf_sheet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def create_pdf_sheet(start_number,end_number)
                          dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
                          FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
                          #filename = "barcode#{Time.now.strftime('%s')}.pdf"
                          filename = "barcode.pdf"
                    Severity: Minor
                    Found in app/models/barcode_list.rb - About 1 hr to fix

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

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

                        Method upload_to_nacsis has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def upload_to_nacsis
                            result = NacsisCat.upload_info_to_nacsis(params[:work_id], params[:db_type], params[:command])
                        
                            case params[:db_type]
                            when 'BOOK'
                        Severity: Minor
                        Found in app/controllers/manifestations_controller.rb - About 1 hr to fix

                          Method field_index_set has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def field_index_set(field_keys)
                                names = {}
                                field_keys.each do |fk|
                                  next unless @column_spec[fk] == :plural
                                  name = field_name(fk)
                          Severity: Minor
                          Found in lib/enju_trunk/resourceadapter/resource_import.rb - About 1 hr to fix

                            Method attr_keycode_accessor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def attr_keycode_accessor(*args)
                                args.each do |arg|
                                  class_eval <<-EOF
                                    attr_accessible :#{arg}_id
                                    def #{arg}_id=(obj)
                            Severity: Minor
                            Found in lib/active_record_extension.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language