MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

  def create
    respond_to do |format|
      begin
        Agent.transaction do
          @family = params[:family]
Severity: Minor
Found in app/controllers/users_controller.rb - About 1 hr to fix

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

      def update
        @errors = []
        error = Struct.new(:id, :msg, :v)
        params[:system_configurations].each do |id, value|
          begin
    Severity: Minor
    Found in app/controllers/system_configurations_controller.rb - About 1 hr to fix

      Function _hideKeypad has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _hideKeypad: function(field, duration) {
              var inst = this._curInst;
              if (!inst || (field && inst != $.data(field, PROP_NAME))) {
                  return;
              }
      Severity: Minor
      Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

        Method get_manifestation_list_tsv_csv has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.get_manifestation_list_tsv_csv(manifestation_ids, selected_column = [])
            csv_sep = SystemConfiguration.get("set_output_format_type") ? "\t" : ","
            bom = "\xEF\xBB\xBF"
            bom.force_encoding("UTF-8")
            data = ""
        Severity: Minor
        Found in app/models/manifestation.rb - About 1 hr to fix

          Method generate_manifestation_list has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.generate_manifestation_list(solr_search, output_type, current_user, search_condition_summary, cols=[], threshold = nil, &block)
              solr_search.build {
                paginate :page => 1, :per_page => Manifestation.count
              }
          
          
          Severity: Minor
          Found in app/models/manifestation.rb - About 1 hr to fix

            Method common_field has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def common_field
            
                    source = @manifestation.catalog.nacsis_identifier if @manifestation.catalog
                    if source == 'NACSIS' || source == 'NDL' || source.nil?
                      source = 'ORG'
            Severity: Minor
            Found in app/models/nacsis_cat.rb - About 1 hr to fix

              Method volg_group has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def volg_group # book only
                      results = []
                      identifier_type = IdentifierType.where(:name => 'isbn').first
                      manifestations = @manifestation.series_statement.try(:manifestations)
                      if manifestations
              Severity: Minor
              Found in app/models/nacsis_cat.rb - About 1 hr to fix

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

                  def update
                    check_can_access_purchase_request
                
                    if @user
                      @purchase_request = @user.purchase_requests.find(params[:id])
                Severity: Minor
                Found in app/controllers/purchase_requests_controller.rb - About 1 hr to fix

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

                    def update
                      @relationship_family = @series_statement_relationship.relationship_family
                      before_relationship_series_statement_ids = @series_statement_relationship.relationship_family.series_statements.map(&:id)
                      SeriesStatementRelationship.transaction do  
                        @series_statement_relationship.update_attributes!(params[:series_statement_relationship])
                  Severity: Minor
                  Found in app/controllers/series_statement_relationships_controller.rb - About 1 hr to fix

                    Method create_pdf_item_identifier_list has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def create_pdf_item_identifier_list(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.pdf"
                    Severity: Minor
                    Found in app/models/barcode_list.rb - About 1 hr to fix

                      Method adhoc_text_field_query has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def adhoc_text_field_query(qwords, model, fields, nest = true, op = :default)
                          model_string_fields = {}
                          Sunspot::Setup.for(model).fields.each do |sunspot_field|
                            next unless sunspot_field.type.is_a?(Sunspot::Type::StringType)
                            model_string_fields[sunspot_field.name] = sunspot_field.indexed_name
                      Severity: Minor
                      Found in app/controllers/form_input_utils.rb - About 1 hr to fix

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

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

                            def index
                              @bookstores = Bookstore.all
                              @bookstore_id = params[:bookstore_id]
                              @ordered_start_at = params[:ordered_start_at]
                              @ordered_end_at = params[:ordered_end_at]
                          Severity: Minor
                          Found in app/controllers/order_lists_controller.rb - About 1 hr to fix

                            Method prepare_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def prepare_options
                                @subject_types = SubjectType.all
                                @carrier_types = CarrierType.all
                                @sub_carrier_types = SubCarrierType.all
                                @manifestation_types = ManifestationType.all#ManifestationType.series
                            Severity: Minor
                            Found in app/controllers/series_statements_controller.rb - About 1 hr to fix

                              Method add_output_column_spec has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def add_output_column_spec(fields, field_ext, field_names, for_join, for_separate, spec_hash = OUTPUT_COLUMN_SPEC)
                                      fields = [fields].flatten.map(&:to_s)
                                      unknown = fields - OUTPUT_COLUMN_FIELDS
                                      unless unknown.empty?
                                        raise ArgumentError, "unknown field: #{unknown.join(', ')}"
                              Severity: Minor
                              Found in lib/enju_trunk/output_columns.rb - About 1 hr to fix

                                Method create_contributor_values has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                     def create_contributor_values(add_contributors)
                                       realizes = []
                                       (add_contributors || []).each do |add_contributor|
                                         next if add_contributor[:id].blank?
                                         if add_contributor[:id].to_i != 0
                                Severity: Minor
                                Found in lib/enju_trunk/enju_trunk_controller.rb - About 1 hr to fix

                                  Method create_creator_values has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                       def create_creator_values(add_creators)
                                         creates = []
                                         (add_creators || []).each do |add_creator|
                                           next if add_creator[:id].blank?
                                           if add_creator[:id].to_i != 0
                                  Severity: Minor
                                  Found in lib/enju_trunk/enju_trunk_controller.rb - About 1 hr to fix

                                    Method create_publisher_values has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                         def create_publisher_values(add_publishers)
                                           produces = []
                                           (add_publishers || []).each do |add_publisher|
                                             next if add_publisher[:id].blank?
                                             if add_publisher[:id].to_i != 0
                                    Severity: Minor
                                    Found in lib/enju_trunk/enju_trunk_controller.rb - About 1 hr to fix

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

                                        def calculate_count
                                          self.started_at = Time.zone.now
                                          Manifestation.find_each do |manifestation|
                                            daily_count = manifestation.reserves.created(self.start_date, self.end_date).size
                                            #manifestation.update_attributes({:daily_reserves_count => daily_count, :total_count => manifestation.total_count + daily_count})
                                      Severity: Major
                                      Found in app/models/manifestation_reserve_stat.rb and 2 other locations - About 1 hr to fix
                                      app/models/user_checkout_stat.rb on lines 17..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

                                                      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 535..535
                                      app/assets/javascripts/jquery.minicolors.js on lines 553..553

                                      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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language