relaton/relaton-bib

View on GitHub

Showing 80 of 86 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 render_person has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def render_person(builder, person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
        render_organization builder, person.affiliation.first&.organization
        if person.name.completename
          builder.parent[:fullname] = person.name.completename.content
        elsif person.name.forename.any?
Severity: Minor
Found in lib/relaton_bib/renderer/bibxml.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 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 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 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 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 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_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_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 method_missing has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def method_missing(method_name, msg = nil, prog = nil, **opts, &block)
Severity: Minor
Found in lib/relaton_bib/util.rb - About 35 mins to fix

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

        def to_asciibib(prefix = "", count = 1) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
          pref = prefix.empty? ? "copyright" : "#{prefix}.copyright"
          out = count > 1 ? "#{pref}::\n" : ""
          owner.each { |ow| out += ow.to_asciibib "#{pref}.owner", owner.size }
          out += "#{pref}.from:: #{from.year}\n" if from
    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_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_hash # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
          hash = { "image" => { "src" => src, "mimetype" => mimetype } }
          hash["image"]["id"] = id if id
          hash["image"]["filename"] = filename if filename
          hash["image"]["width"] = width if width
    Severity: Minor
    Found in lib/relaton_bib/image.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