masao/fuwatto

View on GitHub

Showing 53 of 77 total issues

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 analyse has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.analyse(html, opt=nil)
          require "nkf"
          html = NKF.nkf("-w", html)
      
          # frameset or redirect
      Severity: Minor
      Found in extractcontent.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 analyse has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.analyse(html, opt=nil)
                        require "nkf"
                        html = NKF.nkf("-w", html)
                    
                        # frameset or redirect
                    Severity: Major
                    Found in extractcontent.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language