MiraitSystems/enju_trunk

View on GitHub
app/models/nacsis_cat.rb

Summary

Maintainability
F
2 wks
Test Coverage

File nacsis_cat.rb has 1452 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class NacsisCat
  include ActiveModel::Conversion
  extend ActiveModel::Naming

  attr_accessor :record
Severity: Major
Found in app/models/nacsis_cat.rb - About 3 days to fix

    Method new_manifestation_from_nacsis_cat has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
    Open

          def new_manifestation_from_nacsis_cat(nacsis_cat, book_types, volg_info = {}, manifestation = nil)
            return nil if nacsis_cat.blank? # || book_types.blank?
            nacsis_info = nacsis_cat.detail
            attrs = {}
            if nacsis_info[:source].nil?
    Severity: Minor
    Found in app/models/nacsis_cat.rb - About 1 day 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

    Class NacsisCat has 78 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class NacsisCat
      include ActiveModel::Conversion
      extend ActiveModel::Naming
    
      attr_accessor :record
    Severity: Major
    Found in app/models/nacsis_cat.rb - About 1 day to fix

      Method new_manifestation_from_nacsis_cat has 183 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def new_manifestation_from_nacsis_cat(nacsis_cat, book_types, volg_info = {}, manifestation = nil)
              return nil if nacsis_cat.blank? # || book_types.blank?
              nacsis_info = nacsis_cat.detail
              attrs = {}
              if nacsis_info[:source].nil?
      Severity: Major
      Found in app/models/nacsis_cat.rb - About 7 hrs to fix

        Method create_manifestation_from_nacsis_cat has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

              def create_manifestation_from_nacsis_cat(nacsis_cat, book_types, manifestation = nil)
                return nil if nacsis_cat.blank?
        
                ActiveRecord::Base.transaction do
                  child_manifestation = nil
        Severity: Minor
        Found in app/models/nacsis_cat.rb - About 4 hrs 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 upload_info_to_nacsis has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def upload_info_to_nacsis(id, db_type, command)
              return {} unless check_upload_params(id, db_type, command)
        
              req_query = {}
        
        
        Severity: Minor
        Found in app/models/nacsis_cat.rb - About 3 hrs 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 detail has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method create_manifestation_from_nacsis_cat has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def create_manifestation_from_nacsis_cat(nacsis_cat, book_types, manifestation = nil)
                  return nil if nacsis_cat.blank?
          
                  ActiveRecord::Base.transaction do
                    child_manifestation = nil
          Severity: Major
          Found in app/models/nacsis_cat.rb - About 2 hrs to fix

            Method hold_query has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 upload_info_to_nacsis has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def upload_info_to_nacsis(id, db_type, command)
                  return {} unless check_upload_params(id, db_type, command)
            
                  req_query = {}
            
            
            Severity: Major
            Found in app/models/nacsis_cat.rb - About 2 hrs to fix

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

                        def new_work_has_titles_from_nacsis_cat(nacsis_cat)
                          return [] if nacsis_cat.blank?
                          nacsis_info = nacsis_cat.detail
                          wht_ary = []
                          nacsis_info[:other_titles].each do |other_title|
                  Severity: Minor
                  Found in app/models/nacsis_cat.rb - About 1 hr to fix

                    Method detail has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def detail
                        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 build_query has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def build_query(cond, inverse = false)
                            if inverse
                              op = 'OR'
                            else
                              op = 'AND'
                    Severity: Minor
                    Found in app/models/nacsis_cat.rb - About 1 hr to fix

                      Method request_summary has 33 lines of code (exceeds 25 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

                        Method new_root_manifestation_from_nacsis_cat has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def new_root_manifestation_from_nacsis_cat(nacsis_cat, book_types, manifestation = nil)
                                case nacsis_cat.detail[:vol_info].size
                                when 0,1 # VOLGが0/1件の場合
                                # NCIDに該当するManifestationが既にある場合は既存のManifestationを更新する
                                  manifestation = Manifestation.where(:nacsis_identifier => nacsis_cat.ncid).first unless manifestation
                        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 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 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_series_with_relation_from_nacsis_cat has a Cognitive Complexity of 10 (exceeds 5 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

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

                                    def utl_group # book only
                                      results = []
                                      title_type = TitleType.find_by_name('UTL')
                                      utl_titles = @manifestation.manifestation_titles.where('work_has_titles.title_type_id' => title_type.id)
                                      utl_titles.each do |title|
                              Severity: Minor
                              Found in app/models/nacsis_cat.rb - About 1 hr to fix

                                Method new_work_has_titles_from_nacsis_cat has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def new_work_has_titles_from_nacsis_cat(nacsis_cat)
                                        return [] if nacsis_cat.blank?
                                        nacsis_info = nacsis_cat.detail
                                        wht_ary = []
                                        nacsis_info[:other_titles].each do |other_title|
                                Severity: Minor
                                Found in app/models/nacsis_cat.rb - About 55 mins 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 check_upload_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def check_upload_params(id, db_type, command)
                                        return unless id
                                        return unless (['BHOLD','SHOLD','BOOK','SERIAL'].include?(db_type))
                                        return unless (['insert','update','delete'].include?(command))
                                        case db_type
                                Severity: Minor
                                Found in app/models/nacsis_cat.rb - About 55 mins 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 batch_create_from_ncid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def batch_create_from_ncid(ncids, opts = {}, &block)
                                      nacsis_batch_size = opts[:nacsis_batch_size] || 50
                                
                                      ncids.each_slice(nacsis_batch_size) do |ids|
                                        result = NacsisCat.search(dbs: [:all], id: ids)
                                Severity: Minor
                                Found in app/models/nacsis_cat.rb - About 45 mins 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_query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def build_query(cond, inverse = false)
                                        if inverse
                                          op = 'OR'
                                        else
                                          op = 'AND'
                                Severity: Minor
                                Found in app/models/nacsis_cat.rb - About 35 mins 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 summary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def summary
                                    return nil unless @record
                                
                                    if item?
                                      hash = {
                                Severity: Minor
                                Found in app/models/nacsis_cat.rb - About 35 mins 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 update_manifestation_from_isbn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def update_manifestation_from_isbn(manifestation, book_types = ManifestationType.book.all, nacsis_cat = nil, index = nil)
                                      raise ArgumentError if manifestation.blank?
                                      raise ArgumentError if manifestation.isbn.blank?
                                      if nacsis_cat.nil?
                                        result = NacsisCat.search(isbn: manifestation.isbn)
                                Severity: Minor
                                Found in app/models/nacsis_cat.rb - About 35 mins 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

                                Avoid too many return statements within this method.
                                Open

                                        return true
                                Severity: Major
                                Found in app/models/nacsis_cat.rb - About 30 mins to fix

                                  Method volg_group has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 ptbl_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                        def ptbl_group # book only
                                          results = []
                                          parent_manifestations = @manifestation.original_manifestations || []
                                          parent_manifestations.each do |manifestation|
                                            if manifestation.nacsis_identifier
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb - About 25 mins 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 new_series_statement_from_nacsis_cat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                        def new_series_statement_from_nacsis_cat(nacsis_cat, root_manifestation = nil)
                                          return nil if nacsis_cat.blank?
                                          series_statement = root_manifestation.series_statement
                                          series_statement = SeriesStatement.where(:root_manifestation_id => root_manifestation.id).first unless series_statement && !root_manifestation
                                          series_statement = SeriesStatement.new unless series_statement
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb - About 25 mins 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 update_manifestation_from_nbn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def update_manifestation_from_nbn(manifestation, book_types = ManifestationType.book.all, nacsis_cat = nil, index = nil)
                                        raise ArgumentError if manifestation.blank?
                                        raise ArgumentError if manifestation.nbn.blank?
                                        if nacsis_cat.nil?
                                          result = NacsisCat.search(nbn: manifestation.nbn)
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb - About 25 mins 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_volg_manifestation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                        def get_volg_manifestation(nbn, vol)
                                          return nil if nbn.blank? || vol.blank?
                                          manifestation = Manifestation.where(:nbn => nbn, :edition_display_value => vol).first
                                          manifestation = Manifestation.where(:nbn => nbn, :volume_number_string => vol).first unless manifestation
                                          volume_numbers = [vol.gsub(I18n.t('nacsis_cat.replace_volume_1'),''),
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb - About 25 mins 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

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

                                          print_log "--#{index}-- START to update Manifestation(#{manifestation.id}) IDENTIFIER: #{manifestation.identifier} ISBN: #{manifestation.isbn}"
                                          catalog = Catalog.where(:display_name => 'NACSIS UPDATE', :name => 'NACSIS UPDATE', :nacsis_identifier => 'NACSIS UPDATE').first_or_create
                                          manifestation.update_attribute('catalog_id', catalog.id)
                                  
                                          begin 
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 1 other location - About 1 hr to fix
                                  app/models/nacsis_cat.rb on lines 259..269

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

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

                                          print_log "--#{index}-- START to update Manifestation(#{manifestation.id}) IDENTIFIER: #{manifestation.identifier} NBN: #{manifestation.nbn}"
                                          #TODO 
                                          catalog = Catalog.where(:display_name => 'NACSIS UPDATE', :name => 'NACSIS UPDATE', :nacsis_identifier => 'NACSIS UPDATE').first_or_create
                                          manifestation.update_attribute('catalog_id', catalog.id)
                                  
                                  
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 1 other location - About 1 hr to fix
                                  app/models/nacsis_cat.rb on lines 286..295

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

                                  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

                                        :author_heading => map_attrs(@record['AL']) do |al|
                                          if al['AHDNG'].blank? && al['AHDNGR'].blank?
                                            nil
                                          elsif al['AHDNG'] && al['AHDNGR']
                                            "#{al['AHDNG']}(#{al['AHDNGR']})"
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 1 other location - About 55 mins to fix
                                  app/models/nacsis_cat.rb on lines 1680..1687

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

                                  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

                                        :author_heading => map_attrs(@record['AL']) do |al|
                                          if al['AHDNG'].blank? && al['AHDNGR'].blank?
                                            nil
                                          elsif al['AHDNG'] && al['AHDNGR']
                                            "#{al['AHDNG']}(#{al['AHDNGR']})"
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 1 other location - About 55 mins to fix
                                  app/models/nacsis_cat.rb on lines 1603..1610

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

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

                                      def create_manifestation_from_nbn(nbn, book_types = ManifestationType.book.all, nacsis_cat = nil)
                                        raise ArgumentError if nbn.blank?
                                        if nacsis_cat.nil?
                                          result = NacsisCat.search(dbs: [:book], nbn: nbn)
                                          nacsis_cat = result[:book].first
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 35 mins to fix
                                  app/models/nacsis_cat.rb on lines 109..115
                                  app/models/nacsis_cat.rb on lines 124..130
                                  app/models/nacsis_cat.rb on lines 301..307
                                  app/models/nacsis_cat.rb on lines 311..317
                                  app/models/nacsis_cat.rb on lines 320..326

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

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

                                      def create_manifestation_from_ncid(ncid, book_types = ManifestationType.book.all, nacsis_cat = nil)
                                        raise ArgumentError if ncid.blank?
                                        if nacsis_cat.nil?
                                          result = NacsisCat.search(dbs: [:book], id: ncid)
                                          nacsis_cat = result[:book].first
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 35 mins to fix
                                  app/models/nacsis_cat.rb on lines 124..130
                                  app/models/nacsis_cat.rb on lines 241..247
                                  app/models/nacsis_cat.rb on lines 301..307
                                  app/models/nacsis_cat.rb on lines 311..317
                                  app/models/nacsis_cat.rb on lines 320..326

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

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

                                      def create_manifestation_from_isbn(isbn, book_types = ManifestationType.book.all, nacsis_cat = nil)
                                        raise ArgumentError if isbn.blank?
                                        if nacsis_cat.nil?
                                          result = NacsisCat.search(dbs: [:book], isbn: isbn) # 複数あるかも
                                          nacsis_cat = result[:book].first
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 35 mins to fix
                                  app/models/nacsis_cat.rb on lines 109..115
                                  app/models/nacsis_cat.rb on lines 124..130
                                  app/models/nacsis_cat.rb on lines 241..247
                                  app/models/nacsis_cat.rb on lines 301..307
                                  app/models/nacsis_cat.rb on lines 320..326

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

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

                                      def create_series_statement_from_nbn(nbn, book_types = ManifestationType.series.all, nacsis_cat = nil)
                                        raise ArgumentError if nbn.blank?
                                        if nacsis_cat.nil?
                                          result = NacsisCat.search(dbs: [:serial], nbn: nbn)
                                          nacsis_cat = result[:serial].first
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 35 mins to fix
                                  app/models/nacsis_cat.rb on lines 109..115
                                  app/models/nacsis_cat.rb on lines 124..130
                                  app/models/nacsis_cat.rb on lines 241..247
                                  app/models/nacsis_cat.rb on lines 311..317
                                  app/models/nacsis_cat.rb on lines 320..326

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

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

                                      def create_series_statement_from_isbn(isbn, book_types = ManifestationType.series.all, nacsis_cat = nil)
                                        raise ArgumentError if isbn.blank?
                                        if nacsis_cat.nil?
                                          result = NacsisCat.search(dbs: [:serial], isbn: isbn) #複数あるかも
                                          nacsis_cat = result[:serial].first
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 35 mins to fix
                                  app/models/nacsis_cat.rb on lines 109..115
                                  app/models/nacsis_cat.rb on lines 124..130
                                  app/models/nacsis_cat.rb on lines 241..247
                                  app/models/nacsis_cat.rb on lines 301..307
                                  app/models/nacsis_cat.rb on lines 311..317

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

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

                                      def create_series_statement_from_ncid(ncid, book_types = ManifestationType.series.all, nacsis_cat = nil)
                                        raise ArgumentError if ncid.blank?
                                        if nacsis_cat.nil?
                                          result = NacsisCat.search(dbs: [:serial], id: ncid)
                                          nacsis_cat = result[:serial].first
                                  Severity: Major
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 35 mins to fix
                                  app/models/nacsis_cat.rb on lines 109..115
                                  app/models/nacsis_cat.rb on lines 241..247
                                  app/models/nacsis_cat.rb on lines 301..307
                                  app/models/nacsis_cat.rb on lines 311..317
                                  app/models/nacsis_cat.rb on lines 320..326

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

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

                                              if nacsis_info[:ndlhold]
                                                identifier_type = IdentifierType.where(:name => 'ndlhold').first_or_create
                                                attrs[:identifiers] <<
                                                  Identifier.create(:body => nacsis_info[:ndlhold], :identifier_type_id => identifier_type.id)
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 15 mins to fix
                                  app/models/nacsis_cat.rb on lines 1187..1190
                                  app/models/nacsis_cat.rb on lines 1236..1239
                                  app/models/nacsis_cat.rb on lines 1241..1244
                                  app/models/nacsis_cat.rb on lines 1246..1249
                                  app/models/nacsis_cat.rb on lines 1251..1254

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

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

                                              if nacsis_info[:coden]
                                                identifier_type = IdentifierType.where(:name => 'coden').first_or_create
                                                attrs[:identifiers] <<
                                                  Identifier.create(:body => nacsis_info[:coden], :identifier_type_id => identifier_type.id)
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 15 mins to fix
                                  app/models/nacsis_cat.rb on lines 1187..1190
                                  app/models/nacsis_cat.rb on lines 1236..1239
                                  app/models/nacsis_cat.rb on lines 1246..1249
                                  app/models/nacsis_cat.rb on lines 1251..1254
                                  app/models/nacsis_cat.rb on lines 1256..1259

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

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

                                              if nacsis_info[:ndlpn]
                                                identifier_type = IdentifierType.where(:name => 'ndlpn').first_or_create
                                                attrs[:identifiers] <<
                                                  Identifier.create(:body => nacsis_info[:ndlpn], :identifier_type_id => identifier_type.id)
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 15 mins to fix
                                  app/models/nacsis_cat.rb on lines 1187..1190
                                  app/models/nacsis_cat.rb on lines 1241..1244
                                  app/models/nacsis_cat.rb on lines 1246..1249
                                  app/models/nacsis_cat.rb on lines 1251..1254
                                  app/models/nacsis_cat.rb on lines 1256..1259

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

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

                                              if nacsis_info[:ulpn]
                                                identifier_type = IdentifierType.where(:name => 'ulpn').first_or_create
                                                attrs[:identifiers] <<
                                                  Identifier.create(:body => nacsis_info[:ulpn], :identifier_type_id => identifier_type.id)
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 15 mins to fix
                                  app/models/nacsis_cat.rb on lines 1187..1190
                                  app/models/nacsis_cat.rb on lines 1236..1239
                                  app/models/nacsis_cat.rb on lines 1241..1244
                                  app/models/nacsis_cat.rb on lines 1251..1254
                                  app/models/nacsis_cat.rb on lines 1256..1259

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

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

                                              if nacsis_info[:ndlcln]
                                                identifier_type = IdentifierType.where(:name => 'ndlcln').first_or_create
                                                attrs[:identifiers] <<
                                                  Identifier.create(:body => nacsis_info[:ndlcln], :identifier_type_id => identifier_type.id)
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 15 mins to fix
                                  app/models/nacsis_cat.rb on lines 1187..1190
                                  app/models/nacsis_cat.rb on lines 1236..1239
                                  app/models/nacsis_cat.rb on lines 1241..1244
                                  app/models/nacsis_cat.rb on lines 1246..1249
                                  app/models/nacsis_cat.rb on lines 1256..1259

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

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

                                            if nacsis_info[:gpon]
                                              identifier_type = IdentifierType.where(:name => 'gpon').first_or_create
                                              attrs[:identifiers] <<
                                               Identifier.create(:body => nacsis_info[:gpon], :identifier_type_id => identifier_type.id)
                                  Severity: Minor
                                  Found in app/models/nacsis_cat.rb and 5 other locations - About 15 mins to fix
                                  app/models/nacsis_cat.rb on lines 1236..1239
                                  app/models/nacsis_cat.rb on lines 1241..1244
                                  app/models/nacsis_cat.rb on lines 1246..1249
                                  app/models/nacsis_cat.rb on lines 1251..1254
                                  app/models/nacsis_cat.rb on lines 1256..1259

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

                                  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

                                  There are no issues that match your filters.

                                  Category
                                  Status