MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

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

  def index
    begin
      if !current_user.has_role?('Librarian')
        if @question
          raise unless @question.shared?
Severity: Minor
Found in app/controllers/answers_controller.rb - About 1 hr to fix

    Method get_manifestation_list_tsv_csv has a Cognitive Complexity of 15 (exceeds 5 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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method request_summary has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def request_summary
        return nil unless @record
    
        {
          :subject_heading => @record['TR'].try(:[], 'TRD'),
    Severity: Minor
    Found in app/models/nacsis_cat.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method search_by_gateway has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

          def search_by_gateway(options)
            # db_type = db_names = nil
    
            key_to_db = {
              all: '_ALL_',
    Severity: Minor
    Found in app/models/nacsis_cat.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        unless can_use_purchase_request?
          access_denied; return
        end
    
    
    Severity: Minor
    Found in app/controllers/purchase_requests_controller.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method paginate_ncid_link has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def paginate_ncid_link(nacsis_cat)
        return nil unless nacsis_cat.is_a?(NacsisCat)
        links = []
        if nacsis_cat.serial?
          ids_ary = session['nacsis_cat_serial_ids']
    Severity: Minor
    Found in app/helpers/manifestations_helper.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method destroy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        unless can_use_purchase_request?
          access_denied; return
        else
          if !user_signed_in?
    Severity: Minor
    Found in app/controllers/purchase_requests_controller.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method build_new_record has a Cognitive Complexity of 15 (exceeds 5 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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method get_resource_import_results_tsv has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.get_resource_import_results_tsv(resource_import_results)
        data = String.new
        data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
        columns = [
          [:title, 'activerecord.attributes.manifestation.original_title'],
    Severity: Minor
    Found in app/models/resource_import_result.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method user_list has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def user_list(params)
        query = params[:query].to_s
        @query = query.dup
        @count = {}
    
    
    Severity: Minor
    Found in app/controllers/print_labels_controller.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method setup_sunspot_rails has a Cognitive Complexity of 15 (exceeds 5 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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _connectKeypad has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _connectKeypad: function(target, inst) {
            var field = $(target);
            if (field.hasClass(this.markerClassName)) {
                return;
            }
    Severity: Minor
    Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

      Function flyout has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Menu.prototype.flyout = function(container, options) {
          var menu = this;
          
          this.resetFlyoutMenu = function(){
              var allLists = container.find('ul ul');
      Severity: Minor
      Found in app/assets/javascripts/fg.menu.js - About 1 hr to fix

        Function _generateHTML has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _generateHTML: function(inst) {
                var useTR = this._get(inst, 'useThemeRoller');
                var isRTL = this._get(inst, 'isRTL');
                var prompt = this._get(inst, 'prompt');
                var separator = this._get(inst, 'separator');
        Severity: Minor
        Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

          Function tableMouseUp has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method create_pdf_new has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create_pdf_new(barcode_list, filename, code_words)
                coord = Struct.new("Coord", :x, :y)
                sheet = barcode_list.sheet
                # cell size (a label)
                cell = coord.new(to_pt(sheet.cell_w), to_pt(sheet.cell_h))
            Severity: Minor
            Found in app/models/barcode_sheet.rb - About 1 hr to fix

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

                def index
                  @count = {}
                  page = params[:page] || 1
              
                  # when create a item 
              Severity: Minor
              Found in app/controllers/shelves_controller.rb - About 1 hr to fix

                Method update_or_create_series_statement has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def update_or_create_series_statement(datas, sheet, manifestation, series_statement)
                      if series_statement
                        mode = 'edit'
                      else
                        mode = 'create'
                Severity: Minor
                Found in lib/enju_trunk/resourceadapter/import_book.rb - About 1 hr to fix

                  Method make_export_series_statements_list_tsv has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def self.make_export_series_statements_list_tsv(items, acquired_at)
                      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 has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def create
                        @manifestation = Manifestation.new(params[:manifestation])
                        @original_manifestation = Manifestation.where(:id => params[:manifestation_id]).first
                        if @manifestation.respond_to?(:post_to_scribd)
                          @manifestation.post_to_scribd = true if params[:manifestation][:post_to_scribd] == "1"
                    Severity: Minor
                    Found in app/controllers/manifestations_controller.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language