masao/fuwatto

View on GitHub
fuwatto.rb

Summary

Maintainability
F
3 wks
Test Coverage

File fuwatto.rb has 1512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

$:.unshift "."

require "net/http"
require "net/https"
#require "pp"
Severity: Major
Found in fuwatto.rb - About 4 days to fix

    Method execute has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
    Open

          def execute( search_method, terms, opts = {} )
             data = {}
             opts[ :use_df ] = true if not opts.has_key?( :use_df )
             opts[ :prf_alpha ] = PRF_ALPHA if opts[ :prf ] and not opts.has_key?( :prf_alpha )
             prev_time = nil
    Severity: Minor
    Found in fuwatto.rb - About 2 days 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 execute has 203 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def execute( search_method, terms, opts = {} )
             data = {}
             opts[ :use_df ] = true if not opts.has_key?( :use_df )
             opts[ :prf_alpha ] = PRF_ALPHA if opts[ :prf ] and not opts.has_key?( :prf_alpha )
             prev_time = nil
    Severity: Major
    Found in fuwatto.rb - About 1 day to fix

      Method ndl_search has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

         def ndl_search( keyword, opts = {} )
            base_uri = "http://api.porta.ndl.go.jp/servicedp/opensearch"
            q = URI.escape( keyword )
            cont = nil
            cache_file = cache_xml( "ndl", q, opts[:start] )
      Severity: Minor
      Found in fuwatto.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 iss_ndl_search has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

         def iss_ndl_search( keyword, opts = {} )
            base_uri = "http://iss.ndl.go.jp/api/opensearch"
            q = URI.escape( keyword )
            cont = nil
            cache_file = cache_xml( "ndl", q, opts[:start] )
      Severity: Minor
      Found in fuwatto.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 springer_metadata_search has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

         def springer_metadata_search( keyword, opts = {} )
            base_uri = "http://api.springer.com/metadata/pam"
            q = URI.escape( keyword )
            cont = nil
            cache_file = cache_xml( "springer", q, opts[:start] )
      Severity: Minor
      Found in fuwatto.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 crd_search2 has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

         def crd_search2( keyword, opts = {} )
            base_uri = "http://api.porta.ndl.go.jp/servicedp/opensearch"
            q = URI.escape( keyword )
            cont = nil
            cache_file = cache_xml( "crd2", q, opts[:start] )
      Severity: Minor
      Found in fuwatto.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 ndl_search has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

         def ndl_search( keyword, opts = {} )
            base_uri = "http://api.porta.ndl.go.jp/servicedp/opensearch"
            q = URI.escape( keyword )
            cont = nil
            cache_file = cache_xml( "ndl", q, opts[:start] )
      Severity: Major
      Found in fuwatto.rb - About 3 hrs to fix

        Method iss_ndl_search has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

           def iss_ndl_search( keyword, opts = {} )
              base_uri = "http://iss.ndl.go.jp/api/opensearch"
              q = URI.escape( keyword )
              cont = nil
              cache_file = cache_xml( "ndl", q, opts[:start] )
        Severity: Major
        Found in fuwatto.rb - About 3 hrs to fix

          Method crd_search2 has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

             def crd_search2( keyword, opts = {} )
                base_uri = "http://api.porta.ndl.go.jp/servicedp/opensearch"
                q = URI.escape( keyword )
                cont = nil
                cache_file = cache_xml( "crd2", q, opts[:start] )
          Severity: Major
          Found in fuwatto.rb - About 3 hrs to fix

            Method cinii_search has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

               def cinii_search( keyword, opts = {} )
                  base_uri = "http://ci.nii.ac.jp/opensearch/search"
                  q = URI.escape( keyword )
                  cont = nil
                  cache_file = cache_xml( "cinii", q, opts[:start] )
            Severity: Minor
            Found in fuwatto.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 cinii_research_search has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

               def cinii_research_search( keyword, opts = {} )
                  base_uri = "https://cir.nii.ac.jp/opensearch/all"
                  q = URI.escape( keyword )
                  cont = nil
                  cache_file = cache_xml( "cinii_r", q, opts[:start] )
            Severity: Minor
            Found in fuwatto.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 springer_metadata_search has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

               def springer_metadata_search( keyword, opts = {} )
                  base_uri = "http://api.springer.com/metadata/pam"
                  q = URI.escape( keyword )
                  cont = nil
                  cache_file = cache_xml( "springer", q, opts[:start] )
            Severity: Major
            Found in fuwatto.rb - About 2 hrs to fix

              Method epi_search has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                 def epi_search( keyword, opts = {} )
                    base_uri = "http://dl.nier.go.jp/epi"
                    client_base_uri = "http://dl.nier.go.jp/epi-search/sru-gw.rb"
                    q = URI.escape( keyword.split.join( " AND " ) )
                    cont = nil
              Severity: Minor
              Found in fuwatto.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 springer_images_search has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                 def springer_images_search( keyword, opts = {} )
                    base_uri = "http://api.springer.com/images/xml"
                    q = CGI.escape( keyword )
                    cont = nil
                    cache_file = cache_xml( "springer-images", q )
              Severity: Major
              Found in fuwatto.rb - About 2 hrs to fix

                Method crd_search has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                   def crd_search( keyword, opts = {} )
                      require "htmlentities"
                      base_uri = "http://crd.ndl.go.jp/refapi/servlet/refapi.RSearchAPI"
                      q = URI.escape( keyword )
                      opts[ :query_logic ] = "2"
                Severity: Major
                Found in fuwatto.rb - About 2 hrs to fix

                  Method opac_hit_u_search has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                     def opac_hit_u_search( keyword, opts = {} )
                        require "htmlentities"
                        base_uri = "https://opac.lib.hit-u.ac.jp/opac/opac_list.cgi"
                        q = URI.escape( keyword )
                        opts[ :amode ] = 9 if opts.key?( :key )
                  Severity: Major
                  Found in fuwatto.rb - About 2 hrs to fix

                    Method extract_keywords_mecab has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                       def extract_keywords_mecab( str, opts )
                          return [] if str.strip.empty?
                          mecab = MeCab::Tagger.new( '--node-format=%m\t%H\t%c\n --unk-format=%m\tUNK\t%c\n' )
                          lines = mecab.parse( str.toeuc )
                          #puts lines
                    Severity: Minor
                    Found in fuwatto.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 cinii_research_search has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                       def cinii_research_search( keyword, opts = {} )
                          base_uri = "https://cir.nii.ac.jp/opensearch/all"
                          q = URI.escape( keyword )
                          cont = nil
                          cache_file = cache_xml( "cinii_r", q, opts[:start] )
                    Severity: Major
                    Found in fuwatto.rb - About 2 hrs to fix

                      Method cinii_search has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                         def cinii_search( keyword, opts = {} )
                            base_uri = "http://ci.nii.ac.jp/opensearch/search"
                            q = URI.escape( keyword )
                            cont = nil
                            cache_file = cache_xml( "cinii", q, opts[:start] )
                      Severity: Major
                      Found in fuwatto.rb - About 2 hrs to fix

                        Method crd_search has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                           def crd_search( keyword, opts = {} )
                              require "htmlentities"
                              base_uri = "http://crd.ndl.go.jp/refapi/servlet/refapi.RSearchAPI"
                              q = URI.escape( keyword )
                              opts[ :query_logic ] = "2"
                        Severity: Minor
                        Found in fuwatto.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 worldcat_search has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                           def worldcat_search( keyword, opts = {} )
                              base_uri = "http://worldcat.org/webservices/catalog/search/opensearch"
                              q = URI.escape( keyword )
                              cont = nil
                              cache_file = cache_xml( "worldcat", q, opts[:start] )
                        Severity: Minor
                        Found in fuwatto.rb - About 2 hrs to fix

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

                             def cinii_nrid_search( nrid, opts = {} )
                                q = URI.escape( nrid )
                                base_uri = "http://ci.nii.ac.jp/opensearch/nrid/"
                                cont = nil
                                cache_file = cache_xml( "cinii_nrid", q, opts[:start] )
                          Severity: Minor
                          Found in fuwatto.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 epi_search has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                             def epi_search( keyword, opts = {} )
                                base_uri = "http://dl.nier.go.jp/epi"
                                client_base_uri = "http://dl.nier.go.jp/epi-search/sru-gw.rb"
                                q = URI.escape( keyword.split.join( " AND " ) )
                                cont = nil
                          Severity: Minor
                          Found in fuwatto.rb - About 1 hr to fix

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

                               def cinii_nrid_search( nrid, opts = {} )
                                  q = URI.escape( nrid )
                                  base_uri = "http://ci.nii.ac.jp/opensearch/nrid/"
                                  cont = nil
                                  cache_file = cache_xml( "cinii_nrid", q, opts[:start] )
                            Severity: Minor
                            Found in fuwatto.rb - About 1 hr to fix

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

                                 def jstage_search( keyword, opts = {} )
                                    base_uri = "http://api.jstage.jst.go.jp/searchapi/do"
                                    client_base_uri = "http://www.jstage.jst.go.jp/search/-char/ja?d6=te&typer=on&searchtype=1"
                                    q = URI.escape( keyword )
                                    cont = nil
                              Severity: Minor
                              Found in fuwatto.rb - About 1 hr to fix

                                Method opac_hit_u_search has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                   def opac_hit_u_search( keyword, opts = {} )
                                      require "htmlentities"
                                      base_uri = "https://opac.lib.hit-u.ac.jp/opac/opac_list.cgi"
                                      q = URI.escape( keyword )
                                      opts[ :amode ] = 9 if opts.key?( :key )
                                Severity: Minor
                                Found in fuwatto.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 springer_images_search has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                   def springer_images_search( keyword, opts = {} )
                                      base_uri = "http://api.springer.com/images/xml"
                                      q = CGI.escape( keyword )
                                      cont = nil
                                      cache_file = cache_xml( "springer-images", q )
                                Severity: Minor
                                Found in fuwatto.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 dpla_search has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                   def dpla_search( keyword, opts = {} )
                                      base_uri = "http://api.dp.la/v2/items"
                                      q = CGI.escape( keyword )
                                      cont = nil
                                      cache = Cache.new( "dpla" )
                                Severity: Minor
                                Found in fuwatto.rb - About 1 hr to fix

                                  Method wikipedia_ja_search has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                     def wikipedia_ja_search( keyword, opts = {} )
                                        base_uri = "http://ja.wikipedia.org/w/api.php"
                                        q = URI.escape( keyword )
                                        cont = nil
                                        cache_file = cache_xml( "jawikipedia", q, opts[:start] )
                                  Severity: Minor
                                  Found in fuwatto.rb - About 1 hr to fix

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

                                       def jstage_search( keyword, opts = {} )
                                          base_uri = "http://api.jstage.jst.go.jp/searchapi/do"
                                          client_base_uri = "http://www.jstage.jst.go.jp/search/-char/ja?d6=te&typer=on&searchtype=1"
                                          q = URI.escape( keyword )
                                          cont = nil
                                    Severity: Minor
                                    Found in fuwatto.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 cinii_author_search has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                       def cinii_author_search( keyword, opts = {} )
                                          base_uri = "http://ci.nii.ac.jp/opensearch/author"
                                          q = URI.escape( keyword )
                                          cont = nil
                                          cache_file = cache_xml( "cinii_author", q, opts[:start] )
                                    Severity: Minor
                                    Found in fuwatto.rb - About 1 hr to fix

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

                                         def dpla_search( keyword, opts = {} )
                                            base_uri = "http://api.dp.la/v2/items"
                                            q = CGI.escape( keyword )
                                            cont = nil
                                            cache = Cache.new( "dpla" )
                                      Severity: Minor
                                      Found in fuwatto.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 extract_keywords_mecab has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                         def extract_keywords_mecab( str, opts )
                                            return [] if str.strip.empty?
                                            mecab = MeCab::Tagger.new( '--node-format=%m\t%H\t%c\n --unk-format=%m\tUNK\t%c\n' )
                                            lines = mecab.parse( str.toeuc )
                                            #puts lines
                                      Severity: Minor
                                      Found in fuwatto.rb - About 1 hr to fix

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

                                              def load_robots_txt
                                                 robots = []
                                                 open("robots.txt") do |io|
                                               io.each do |line|
                                                 if line =~ /\A\s*User\-Agent\:\s*(.+?)\Z/i
                                        Severity: Minor
                                        Found in fuwatto.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 worldcat_search has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                           def worldcat_search( keyword, opts = {} )
                                              base_uri = "http://worldcat.org/webservices/catalog/search/opensearch"
                                              q = URI.escape( keyword )
                                              cont = nil
                                              cache_file = cache_xml( "worldcat", q, opts[:start] )
                                        Severity: Minor
                                        Found in fuwatto.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

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                search_opts[ :key ] = data[ :opac_hit_u_key ] if data[ :opac_hit_u_key ]
                                        Severity: Major
                                        Found in fuwatto.rb - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if data[ :itemsPerPage ]
                                                                     start += data[ :itemsPerPage ]
                                                                  else
                                                                     start += count
                                                                  end
                                          Severity: Major
                                          Found in fuwatto.rb - About 45 mins to fix

                                            Method cinii_author_nrid_search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                               def cinii_author_nrid_search( name, naid = [] )
                                                  data = cinii_author_search( name )
                                                  result = data
                                                  if not naid.empty?
                                                     entries = []
                                            Severity: Minor
                                            Found in fuwatto.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

                                            Avoid deeply nested control flow statements.
                                            Open

                                                        if search_method == :dpla_search
                                                           search_opts[ :page ] = start / count
                                                        else
                                                                       search_opts[ :start ] = start
                                                        end
                                            Severity: Major
                                            Found in fuwatto.rb - About 45 mins to fix

                                              Method cinii_author_search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                 def cinii_author_search( keyword, opts = {} )
                                                    base_uri = "http://ci.nii.ac.jp/opensearch/author"
                                                    q = URI.escape( keyword )
                                                    cont = nil
                                                    cache_file = cache_xml( "cinii_author", q, opts[:start] )
                                              Severity: Minor
                                              Found in fuwatto.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 output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                    def output( prefix, data = {} )
                                                       #STDERR.puts data.inspect
                                                       case format
                                                       when "html"
                                                          result = eval_rhtml( "./#{ prefix }.rhtml", binding ) if query? and not data.has_key?( :error )
                                              Severity: Minor
                                              Found in fuwatto.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 http_get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                 def http_get( uri, limit = 10 )
                                                    #STDERR.puts uri.to_s
                                                    raise "Too many redirects: #{ uri }" if limit < 0
                                                    http_proxy = ENV[ "http_proxy" ]
                                                    proxy, proxy_port = nil
                                              Severity: Minor
                                              Found in fuwatto.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

                                                 def cinii_research_search( keyword, opts = {} )
                                                    base_uri = "https://cir.nii.ac.jp/opensearch/all"
                                                    q = URI.escape( keyword )
                                                    cont = nil
                                                    cache_file = cache_xml( "cinii_r", q, opts[:start] )
                                              Severity: Major
                                              Found in fuwatto.rb and 1 other location - About 1 day to fix
                                              fuwatto.rb on lines 284..341

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

                                              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

                                                 def cinii_search( keyword, opts = {} )
                                                    base_uri = "http://ci.nii.ac.jp/opensearch/search"
                                                    q = URI.escape( keyword )
                                                    cont = nil
                                                    cache_file = cache_xml( "cinii", q, opts[:start] )
                                              Severity: Major
                                              Found in fuwatto.rb and 1 other location - About 1 day to fix
                                              fuwatto.rb on lines 344..401

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

                                              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

                                                    entries.each do |e|
                                                       title = e.find( "./xhtml:head/pam:article/dc:title", xmlns )[0].content 
                                                       url = e.find( "./xhtml:head/pam:article/prism:url", xmlns )[0].content
                                                       author = e.find( "./xhtml:head/pam:article/dc:creator", xmlns ).to_a.map{|au| au.content }.join( "; " )
                                                       pubname = e.find( "./xhtml:head/pam:article/prism:publicationName", xmlns )[0].content
                                              Severity: Major
                                              Found in fuwatto.rb and 1 other location - About 3 hrs to fix
                                              fuwatto.rb on lines 1213..1239

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

                                              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

                                                    entries.each do |e|
                                                       title = e.find( "./xhtml:head/pam:article/dc:title", xmlns )[0].content 
                                                       url = e.find( "./xhtml:head/pam:article/prism:url", xmlns )[0].content
                                                       author = e.find( "./xhtml:head/pam:article/dc:creator", xmlns ).to_a.map{|au| au.content }.join( "; " )
                                                       pubname = e.find( "./xhtml:head/pam:article/prism:publicationName", xmlns )[0].content
                                              Severity: Major
                                              Found in fuwatto.rb and 1 other location - About 3 hrs to fix
                                              fuwatto.rb on lines 1330..1356

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

                                              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

                                                             vector[ 0..(terms-1) ].map{|k| k[0] }.combination(2) do |v|
                                                                keyword = v.join( " " )
                                                                STDERR.puts keyword
                                                                data = send( search_method, keyword, search_opts )
                                                                if data[ :totalResults ] > 0
                                              Severity: Major
                                              Found in fuwatto.rb and 1 other location - About 1 hr to fix
                                              fuwatto.rb on lines 1573..1578

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 48.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

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

                                                          vector[ 0..(terms-1) ].map{|k| k[0] }.combination(3) do |v|
                                                             keyword = v.join( " " )
                                                             STDERR.puts keyword
                                                             data = send( search_method, keyword, search_opts )
                                                             if data[ :totalResults ] > 0
                                              Severity: Major
                                              Found in fuwatto.rb and 1 other location - About 1 hr to fix
                                              fuwatto.rb on lines 1582..1587

                                              Duplicated Code

                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                              Tuning

                                              This issue has a mass of 48.

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

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

                                                    if File.exist?( cache_file ) and ( Time.now - File.mtime( cache_file ) ) < CACHE_TIME
                                                       cont = open( cache_file ){|io| io.read }
                                                    else
                                                       response = http_get( uri )
                                                       cont = response.body
                                              Severity: Minor
                                              Found in fuwatto.rb and 1 other location - About 35 mins to fix
                                              fuwatto.rb on lines 825..831

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

                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                              Refactorings

                                              Further Reading

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

                                                    if File.exist?( cache_file ) and ( Time.now - File.mtime( cache_file ) ) < CACHE_TIME
                                                       cont = open( cache_file ){|io| io.read }
                                                    else
                                                       response = http_get( uri )
                                                       cont = response.body
                                              Severity: Minor
                                              Found in fuwatto.rb and 1 other location - About 35 mins to fix
                                              fuwatto.rb on lines 1110..1116

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

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

                                                       if date and date[0]
                                                          date = date[0].content
                                                       else
                                                          date = e.find( "./dcterms:modified", "http://purl.org/dc/terms/" )
                                                          if date and date[0]
                                              Severity: Minor
                                              Found in fuwatto.rb and 2 other locations - About 25 mins to fix
                                              fuwatto.rb on lines 570..579
                                              fuwatto.rb on lines 676..685

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

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

                                                       if date and date[0]
                                                          date = date[0].content
                                                       else
                                                          date = e.find( "./dcterms:modified", "http://purl.org/dc/terms/" )
                                                          if date and date[0]
                                              Severity: Minor
                                              Found in fuwatto.rb and 2 other locations - About 25 mins to fix
                                              fuwatto.rb on lines 570..579
                                              fuwatto.rb on lines 770..779

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

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

                                                       if date and date[0]
                                                          date = date[0].content
                                                       else
                                                          date = e.find( "./dcterms:modified", "http://purl.org/dc/terms/" )
                                                          if date and date[0]
                                              Severity: Minor
                                              Found in fuwatto.rb and 2 other locations - About 25 mins to fix
                                              fuwatto.rb on lines 676..685
                                              fuwatto.rb on lines 770..779

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

                                              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