MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

  def index
    sort = User.set_sort(params[:sort_by], params[:order])
    page = params[:page] || 1
    role = current_user.try(:role) || Role.default_role
    @search = User.search do
Severity: Minor
Found in app/controllers/unablelist_controller.rb - About 1 hr to fix

    Method edit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def edit
        unless current_user.has_role?('Librarian')
          unless params[:mode] == 'tag_edit'
            access_denied
          end
    Severity: Minor
    Found in app/controllers/manifestations_controller.rb - About 1 hr to fix

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

        def update_all
          respond_to do |format|
            begin
              @current_basket.checked_manifestations.map(&:manifestation).each do |m|
                if m.series_statement
      Severity: Minor
      Found in app/controllers/series_has_manifestations_controller.rb - About 1 hr to fix

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

          def update
            SeriesStatement.transaction do
              if params[:move]
                move_position(@series_statement, params[:move])
                return
        Severity: Minor
        Found in app/controllers/series_statements_controller.rb - About 1 hr to fix

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

            def index
              search = Sunspot.new_search(SeriesStatement)
              query = params[:query].to_s.strip
              page = params[:page] || 1
              unless query.blank?
          Severity: Minor
          Found in app/controllers/series_statements_controller.rb - About 1 hr to fix

            Method setup_sunspot_rails has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def setup_sunspot_rails
                solr_name = 'apache-solr-3.6.2'
                solr_dir = "#{Rails.root}/vendor/#{solr_name}"
                solr_url = "http://archive.apache.org/dist/lucene/solr/3.6.2/#{solr_name}.tgz"
                solr_md5 = 'e9c51f51265b070062a9d8ed50b84647'
            Severity: Minor
            Found in lib/generators/enju_trunk/install/install_generator.rb - About 1 hr to fix

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

                def update
                  respond_to do |format|
                    if @subscribe.update_attributes(params[:subscribe])
                      format.html { redirect_to @subscribe, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subscribe')) }
                      format.json { head :no_content }
              Severity: Major
              Found in app/controllers/subscribes_controller.rb and 6 other locations - About 1 hr to fix
              app/controllers/accepts_controller.rb on lines 131..138
              app/controllers/agent_import_files_controller.rb on lines 76..83
              app/controllers/donates_controller.rb on lines 58..65
              app/controllers/resource_import_files_controller.rb on lines 76..83
              app/controllers/shelves_controller.rb on lines 108..115
              app/controllers/subscriptions_controller.rb on lines 65..72

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

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

                def update
                  respond_to do |format|
                    if @donate.update_attributes(params[:donate])
                      format.html { redirect_to @donate, :notice => t('controller.successfully_updated', :model => t('activerecord.models.donate')) }
                      format.json { head :no_content }
              Severity: Major
              Found in app/controllers/donates_controller.rb and 6 other locations - About 1 hr to fix
              app/controllers/accepts_controller.rb on lines 131..138
              app/controllers/agent_import_files_controller.rb on lines 76..83
              app/controllers/resource_import_files_controller.rb on lines 76..83
              app/controllers/shelves_controller.rb on lines 108..115
              app/controllers/subscribes_controller.rb on lines 61..68
              app/controllers/subscriptions_controller.rb on lines 65..72

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

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

                def update
                  respond_to do |format|
                    if @resource_import_file.update_attributes(params[:resource_import_file])
                      format.html { redirect_to @resource_import_file, :notice => t('controller.successfully_updated', :model => t('activerecord.models.resource_import_file')) }
                      format.json { head :no_content }
              Severity: Major
              Found in app/controllers/resource_import_files_controller.rb and 6 other locations - About 1 hr to fix
              app/controllers/accepts_controller.rb on lines 131..138
              app/controllers/agent_import_files_controller.rb on lines 76..83
              app/controllers/donates_controller.rb on lines 58..65
              app/controllers/shelves_controller.rb on lines 108..115
              app/controllers/subscribes_controller.rb on lines 61..68
              app/controllers/subscriptions_controller.rb on lines 65..72

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

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

                def update
                  respond_to do |format|
                    if @shelf.update_attributes(params[:shelf])
                      format.html { redirect_to @shelf, :notice => t('controller.successfully_updated', :model => t('activerecord.models.shelf')) }
                      format.json { head :no_content }
              Severity: Major
              Found in app/controllers/shelves_controller.rb and 6 other locations - About 1 hr to fix
              app/controllers/accepts_controller.rb on lines 131..138
              app/controllers/agent_import_files_controller.rb on lines 76..83
              app/controllers/donates_controller.rb on lines 58..65
              app/controllers/resource_import_files_controller.rb on lines 76..83
              app/controllers/subscribes_controller.rb on lines 61..68
              app/controllers/subscriptions_controller.rb on lines 65..72

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

              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 LibraryGroup.site_config.try(:url)
                  uri = Addressable::URI.parse(LibraryGroup.site_config.url)
                  default_url_options[:host] = uri.host
                  default_url_options[:port] = uri.port if Setting.enju.web_port_number != 80
                else
              Severity: Major
              Found in app/mailers/notifier.rb and 1 other location - About 1 hr to fix
              app/mailers/reservation_notifier.rb on lines 2..8

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

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

                def update
                  respond_to do |format|
                    if @accept.update_attributes(params[:accept])
                      format.html { redirect_to @accept, notice:  t('controller.successfully_updated', model:  t('activerecord.models.accept')) }
                      format.json { head :no_content }
              Severity: Major
              Found in app/controllers/accepts_controller.rb and 6 other locations - About 1 hr to fix
              app/controllers/agent_import_files_controller.rb on lines 76..83
              app/controllers/donates_controller.rb on lines 58..65
              app/controllers/resource_import_files_controller.rb on lines 76..83
              app/controllers/shelves_controller.rb on lines 108..115
              app/controllers/subscribes_controller.rb on lines 61..68
              app/controllers/subscriptions_controller.rb on lines 65..72

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

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

                def update
                  respond_to do |format|
                    if @agent_import_file.update_attributes(params[:agent_import_file])
                      format.html { redirect_to @agent_import_file, :notice => t('controller.successfully_updated', :model => t('activerecord.models.agent_import_file')) }
                      format.json { head :no_content }
              Severity: Major
              Found in app/controllers/agent_import_files_controller.rb and 6 other locations - About 1 hr to fix
              app/controllers/accepts_controller.rb on lines 131..138
              app/controllers/donates_controller.rb on lines 58..65
              app/controllers/resource_import_files_controller.rb on lines 76..83
              app/controllers/shelves_controller.rb on lines 108..115
              app/controllers/subscribes_controller.rb on lines 61..68
              app/controllers/subscriptions_controller.rb on lines 65..72

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

              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 LibraryGroup.site_config.try(:url)
                  uri = Addressable::URI.parse(LibraryGroup.site_config.url)
                  default_url_options[:host] = uri.host
                  default_url_options[:port] = uri.port if Setting.enju.web_port_number != 80
                else
              Severity: Major
              Found in app/mailers/reservation_notifier.rb and 1 other location - About 1 hr to fix
              app/mailers/notifier.rb on lines 2..8

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

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

                def update
                  respond_to do |format|
                    if @subscription.update_attributes(params[:subscription])
                      format.html { redirect_to @subscription, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subscription')) }
                      format.json { head :no_content }
              Severity: Major
              Found in app/controllers/subscriptions_controller.rb and 6 other locations - About 1 hr to fix
              app/controllers/accepts_controller.rb on lines 131..138
              app/controllers/agent_import_files_controller.rb on lines 76..83
              app/controllers/donates_controller.rb on lines 58..65
              app/controllers/resource_import_files_controller.rb on lines 76..83
              app/controllers/shelves_controller.rb on lines 108..115
              app/controllers/subscribes_controller.rb on lines 61..68

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

              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

              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: Major
              Found in app/models/item.rb - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    errors.add(:v) unless
                    (check_first_big?(v) or
                     check_first_numeric?(v)) and
                    ((v.length == 1) or
                     (string_location == 0) or
                Severity: Major
                Found in app/models/abbreviation.rb - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                        if params[:item_identifier].present? &&
                              params[:item_identifier] !~ /\*/ ||
                            (SystemConfiguration.get('manifestation.isbn_unique') &&
                              params[:isbn].present? && params[:isbn] !~ /\*/) ||
                                (params[:identifier].present? && params[:identifier] !~ /\*/)
                  Severity: Major
                  Found in app/controllers/manifestations_controller.rb - About 1 hr to fix

                    Method import_row_data has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def import_row_data(origin_datas, row_num, textfile, sheet, numbering, auto_numbering, not_set_serial_number, external_resource)
                    Severity: Major
                    Found in lib/enju_trunk/resourceadapter/resource_import.rb - About 1 hr to fix

                      Method update_or_create_item has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def update_or_create_item(datas, sheet, textfile, numbering, auto_numbering, manifestation, item, error_msgs)
                      Severity: Major
                      Found in lib/enju_trunk/resourceadapter/import_book.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language