relaton/relaton-doi

View on GitHub

Showing 6 of 6 total issues

Class Parser has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Parser
    COUNTRIES = %w[USA].freeze

    TYPES = {
      "book-chapter" => "inbook",
Severity: Minor
Found in lib/relaton_doi/parser.rb - About 6 hrs to fix

    File parser.rb has 409 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module RelatonDoi
      class Parser
        COUNTRIES = %w[USA].freeze
    
        TYPES = {
    Severity: Minor
    Found in lib/relaton_doi/parser.rb - About 5 hrs to fix

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

          def parse_place # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
            pub_location = @src["publisher-location"] || fetch_location
            return [] unless pub_location
      
            pls1, pls2 = pub_location.split(", ")
      Severity: Minor
      Found in lib/relaton_doi/parser.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 parse_series has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_series # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
            types = %w[inbook incollection inproceedings]
            return [] if !@src["container-title"] || types.include?(@item[:type]) || @src["type"] == "report-component"
      
            con_ttl = if main_sub_titles.any? || project_titles.any?
      Severity: Minor
      Found in lib/relaton_doi/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 get_by_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_by_id(id)
            # resp = Serrano.works ids: id
            n = 0
            url = "https://api.crossref.org/works/#{CGI.escape(id)}"
            loop do
      Severity: Minor
      Found in lib/relaton_doi/crossref.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 parse_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_link # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
            disprefered_links = %w[similarity-checking text-mining]
            links = []
            if @src["URL"]
              links << RelatonBib::TypedUri.new(type: "DOI", content: @src["URL"])
      Severity: Minor
      Found in lib/relaton_doi/parser.rb - About 25 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