File fuwatto.rb
has 1512 lines of code (exceeds 250 allowed). Consider refactoring. Open
$:.unshift "."
require "net/http"
require "net/https"
#require "pp"
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
- Read upRead up
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
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] )
- Read upRead up
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] )
- Read upRead up
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] )
- Read upRead up
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] )
- Read upRead up
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] )
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] )
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] )
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] )
- Read upRead up
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] )
- Read upRead up
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] )
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
- Read upRead up
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 )
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"
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 )
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
- Read upRead up
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] )
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] )
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"
- Read upRead up
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] )
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] )
- Read upRead up
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
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] )
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
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 )
- Read upRead up
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 )
- Read upRead up
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" )
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] )
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
- Read upRead up
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] )
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" )
- Read upRead up
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
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
- Read upRead up
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] )
- Read upRead up
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 ]
Avoid deeply nested control flow statements. Open
if data[ :itemsPerPage ]
start += data[ :itemsPerPage ]
else
start += count
end
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 = []
- Read upRead up
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
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] )
- Read upRead up
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 )
- Read upRead up
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
- Read upRead up
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] )
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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] )
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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]
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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]
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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]
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76