relaton/relaton-bib

View on GitHub

Showing 81 of 81 total issues

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

    def to_xml(doc) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
      doc.address do
        if formatted_address
          doc.formattedAddress formatted_address
        else
Severity: Minor
Found in lib/relaton_bib/contributor.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 to_asciibib has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def to_asciibib(prefix) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity
      out = "#{prefix}.docnumber:: #{docnumber}\n"
      agency.each { |a| out += "#{prefix}.agency:: #{a}\n" }
      out += "#{prefix}.type:: #{type}\n" if type
      out += "#{prefix}.class:: #{klass}\n" if klass
Severity: Minor
Found in lib/relaton_bib/structured_identifier.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 to_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def to_hash # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
      hash = { "address" => {} }
      if formatted_address
        hash["address"]["formatted_address"] = formatted_address
      else
Severity: Minor
Found in lib/relaton_bib/contributor.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def create_docid(id, ver) # rubocop:disable Metrics/MethodLength
      pref, num = id_to_pref_num(id)
      if RFCPREFIXES.include?(pref)
        pid = "#{pref} #{num.sub(/^-?0+/, '')}"
        type = pubid_type id
Severity: Minor
Found in lib/relaton_bib/bibxml_parser.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
      lid = if type == "URN" && opts[:lang]
              id.sub %r{(?<=:)(?:\w{2},)*?(#{opts[:lang]})(?:,\w{2})*}, '\1'
            else id
            end
Severity: Minor
Found in lib/relaton_bib/document_identifier.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def initialize(**args) # rubocop:disable Metrics/CyclomaticComplexity
      unless args[:formatted_address] || (args[:city] && args[:country])
        raise ArgumentError, "Either formatted address or city and country must be provided"
      end

Severity: Minor
Found in lib/relaton_bib/contributor.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

      def ref_attrs # rubocop:disable Metrics/AbcSize
        discopes = %w[anchor docName number]
        attrs = @bib.docidentifier.each_with_object({}) do |di, h|
          next unless discopes.include?(di.scope)

Severity: Minor
Found in lib/relaton_bib/renderer/bibxml.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def to_asciibib(prfx = "", count = 1) # rubocop:disable Metrics/CyclomaticComplexity
      pref = prfx.empty? ? prfx : "#{prfx}."
      out = count > 1 ? "#{pref}::\n" : ""
      out += "#{pref}name:: #{name}\n"
      out += "#{pref}number:: #{number}\n" if number
Severity: Minor
Found in lib/relaton_bib/workgroup.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
      pref = prefix.empty? ? "medium." : "#{prefix}.medium."
      out = ""
      out += "#{pref}content:: #{content}\n" if content
      out += "#{pref}genre:: #{genre}\n" if genre
Severity: Minor
Found in lib/relaton_bib/medium.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def to_xml(builder) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
      return unless content

      if content.is_a?(Array)
        content.each { |c| builder.variant { c.to_xml builder } }
Severity: Minor
Found in lib/relaton_bib/localized_string.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
      pref = prefix.empty? ? "image." : "#{prefix}.image."
      out = "#{pref}id:: #{id}\n"
      out += "#{pref}src:: #{src}\n"
      out += "#{pref}mimetype:: #{mimetype}\n"
Severity: Minor
Found in lib/relaton_bib/image.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def initialize(owner:, from:, to: nil, scope: nil)
      unless owner.any?
        raise ArgumentError, "at least one owner should exist."
      end

Severity: Minor
Found in lib/relaton_bib/copyright_association.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def initialize(name: nil, city: nil, region: [], country: []) # rubocop:disable Metrics/CyclomaticComplexity
      if name.nil? && city.nil?
        raise ArgumentError, "`name` or `city` should be provided"
      end

Severity: Minor
Found in lib/relaton_bib/place.rb - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

    def to_xml(**opts)
      opts[:builder].copyright do |builder|
        builder.from from ? from.year : "unknown"
        builder.to to.year if to
        owner.each { |o| builder.owner { o.to_xml(**opts) } }
Severity: Minor
Found in lib/relaton_bib/copyright_association.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 to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_s(options = {}) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
      if options.key?(:filter)
        opts = options.reject { |k,| k == :filter || (k == :quotes && (!atomic? || symbol?)) }
        return convert(options[:filter]).to_s(opts)
      end
Severity: Minor
Found in lib/relaton_bib/renderer/bibtex_builder.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 to_asciibib has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_asciibib(prefix = "", count = 1)
      pref = prefix.empty? ? prefix : prefix + "."
      has_attrs = !(type.nil? || type.empty?)
      out = count > 1 && has_attrs ? "#{pref}biblionote::\n" : ""
      out += "#{pref}biblionote.type:: #{type}\n" if type
Severity: Minor
Found in lib/relaton_bib/biblio_note.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 link has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def link(reference, url, ver)
      l = []
      l << { type: "xml", content: url } if url
      l << { type: "src", content: reference[:target] } if reference[:target]
      if /^I-D/.match? reference[:anchor]
Severity: Minor
Found in lib/relaton_bib/bibxml_parser.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 to_asciibib has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_asciibib(prefix = "", count = 1)
      pref = prefix.empty? ? "link" : "#{prefix}.link"
      out = count > 1 ? "#{pref}::\n" : ""
      out += "#{pref}.type:: #{type}\n" if type
      out += "#{pref}.content:: #{content}\n"
Severity: Minor
Found in lib/relaton_bib/typed_uri.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 worker has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def worker(&block)
      @threads = Array.new @num_workers do
        Thread.new do
          until (item = @queue.pop) == :END
            @result << yield(item) if block
Severity: Minor
Found in lib/relaton_bib/workers_pool.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 render_authors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def render_authors(builder) # rubocop:disable Metrics/AbcSize
        @bib.contributor.each do |c|
          builder.author do |xml|
            xml.parent[:role] = "editor" if c.role.detect { |r| r.type == "editor" }
            if c.entity.is_a?(Person) then render_person xml, c.entity
Severity: Minor
Found in lib/relaton_bib/renderer/bibxml.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

Severity
Category
Status
Source
Language