relaton/relaton-bib

View on GitHub

Showing 89 of 89 total issues

Class XMLParser has 51 methods (exceeds 20 allowed). Consider refactoring.
Open

class XMLParser
class << self
#
# Parse XML bibdata
#
Severity: Major
Found in lib/relaton_bib/xml_parser.rb - About 7 hrs to fix

    Method to_hash has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    def to_hash(embedded: false) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
    hash = {}
    hash["schema-version"] = schema unless embedded
    hash["id"] = id if id
    hash["title"] = title.to_hash if title&.any?
    Severity: Minor
    Found in lib/relaton_bib/bibliographic_item.rb - About 7 hrs to fix

    File xml_parser.rb has 431 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "nokogiri"
     
    module RelatonBib
    class XMLParser
    class << self
    Severity: Minor
    Found in lib/relaton_bib/xml_parser.rb - About 6 hrs to fix

      File hash_converter.rb has 429 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module RelatonBib
      module HashConverter
      extend self
      # @param args [Hash]
      # @return [Hash]
      Severity: Minor
      Found in lib/relaton_bib/hash_converter.rb - About 6 hrs to fix

        File bibliographic_item.rb has 417 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "relaton_bib/typed_uri"
        require "relaton_bib/document_identifier"
        require "relaton_bib/copyright_association"
        require "relaton_bib/formatted_string"
        require "relaton_bib/contribution_info"
        Severity: Minor
        Found in lib/relaton_bib/bibliographic_item.rb - About 6 hrs to fix

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

          def initialize(**args)
          if args[:type] && !TYPES.include?(args[:type])
          Util.warn %{Type `#{args[:type]}` is invalid.}
          end
           
           
          Severity: Minor
          Found in lib/relaton_bib/bibliographic_item.rb - About 4 hrs to fix

          Method render_address has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          def render_address(builder, contrib) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
          address, contact = address_contact contrib.entity.contact
          if address || contact.any?
          builder.address do |xml|
          # address = contrib.entity.contact.detect { |cn| cn.is_a? Address }
          Severity: Minor
          Found in lib/relaton_bib/renderer/bibxml.rb - About 4 hrs to fix

          Method render_xml has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          def render_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
          root = opts[:bibdata] ? :bibdata : :bibitem
          xml = opts[:builder].send(root) do |builder| # rubocop:disable Metrics/BlockLength
          builder.fetched fetched if fetched
          title.to_xml(**opts)
          Severity: Minor
          Found in lib/relaton_bib/bibliographic_item.rb - About 3 hrs to fix

          Class BibtexBuilder has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class BibtexBuilder
          ATTRS = %i[
          type id title author editor booktitle series number edition contributor
          date address note relation extent classification keyword docidentifier
          timestamp link
          Severity: Minor
          Found in lib/relaton_bib/renderer/bibtex_builder.rb - About 3 hrs to fix

            Method initialize has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def initialize(**args)
            if args[:type] && !TYPES.include?(args[:type])
            Util.warn %{Type `#{args[:type]}` is invalid.}
            end
             
             
            Severity: Major
            Found in lib/relaton_bib/bibliographic_item.rb - About 2 hrs to fix

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

              def scan_xml(parts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
              return "" unless parts.any?
               
              out = ""
              while parts.any? && (parts.first[3] || parts.first[4])
              Severity: Minor
              Found in lib/relaton_bib/formatted_string.rb - About 2 hrs to fix

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

              def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
              opts[:builder].name do |builder|
              builder.abbreviation { abbreviation.to_xml builder } if abbreviation
              if completename
              builder.completename { completename.to_xml builder }
              Severity: Minor
              Found in lib/relaton_bib/full_name.rb - About 2 hrs to fix

              Class BibliographicItem has 24 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class BibliographicItem
              include RelatonBib
               
              TYPES = %W[article book booklet manual proceedings presentation
              thesis techreport standard unpublished map electronic\sresource
              Severity: Minor
              Found in lib/relaton_bib/bibliographic_item.rb - About 2 hrs to fix

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

                def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
                pref = prefix.empty? ? prefix : "#{prefix}."
                out = prefix.empty? ? "[%bibitem]\n== {blank}\n" : ""
                out += "#{pref}id:: #{id}\n" if id
                out += "#{pref}fetched:: #{fetched}\n" if fetched
                Severity: Minor
                Found in lib/relaton_bib/bibliographic_item.rb - About 2 hrs to fix

                Method docids has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                def docids(reference, ver) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
                ret = []
                si = reference.at("./seriesInfo[@name='Internet-Draft']",
                "./front/seriesInfo[@name='Internet-Draft']")
                if si
                Severity: Minor
                Found in lib/relaton_bib/bibxml_parser.rb - About 2 hrs to fix

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

                def render_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
                root = opts[:bibdata] ? :bibdata : :bibitem
                xml = opts[:builder].send(root) do |builder| # rubocop:disable Metrics/BlockLength
                builder.fetched fetched if fetched
                title.to_xml(**opts)
                Severity: Major
                Found in lib/relaton_bib/bibliographic_item.rb - About 2 hrs to fix

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

                  def to_xml(builder)
                  xml = builder.structuredidentifier do |b|
                  agency&.each { |a| b.agency a }
                  b.class_ klass if klass
                  b.docnumber docnumber
                  Severity: Minor
                  Found in lib/relaton_bib/structured_identifier.rb - About 2 hrs to fix

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

                  def to_xml(builder) # rubocop:disable Metrics/MethodLength
                  xml = builder.series do
                  formattedref&.to_xml builder
                  builder.title { title.to_xml builder }
                  builder.place place if place
                  Severity: Minor
                  Found in lib/relaton_bib/series.rb - About 2 hrs to fix

                  File bibxml_parser.rb has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module RelatonBib
                  module BibXMLParser
                  # SeriesInfo what should be saved as docidentifiers in the Relaton model.
                  SERIESINFONAMES = ["DOI"].freeze
                  RFCPREFIXES = %w[RFC BCP FYI STD].freeze
                  Severity: Minor
                  Found in lib/relaton_bib/bibxml_parser.rb - About 2 hrs to fix

                    Method to_hash has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def to_hash(embedded: false) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
                    hash = {}
                    hash["schema-version"] = schema unless embedded
                    hash["id"] = id if id
                    hash["title"] = title.to_hash if title&.any?
                    Severity: Minor
                    Found in lib/relaton_bib/bibliographic_item.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language