datacite/levriero

View on GitHub

Showing 65 of 369 total issues

Method push_item has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.push_item(item)
    attributes = item.fetch("attributes", {})
    doi = attributes.fetch("doi", nil)
    return nil unless doi.present? && cached_doi_ra(doi) == "DataCite"

Severity: Major
Found in app/models/related_identifier.rb - About 4 hrs to fix

    Method push_item has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.push_item(item)
        attributes = item.fetch("attributes", {})
        doi = attributes.fetch("doi", nil)
        return nil unless doi.present? && cached_doi_ra(doi) == "DataCite"
    
    
    Severity: Minor
    Found in app/models/related_identifier.rb - About 4 hrs 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 push_item has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.push_item(item)
        attributes = item.fetch("attributes", {})
        doi = attributes.fetch("doi", nil)
        return nil if doi.blank?
    
    
    Severity: Major
    Found in app/models/name_identifier.rb - About 4 hrs to fix

      File base.rb has 335 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "bolognese"
      
      class Base
        include Importable
        include Cacheable
      Severity: Minor
      Found in app/models/base.rb - About 4 hrs to fix

        Method push_item has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.push_item(item)
            attributes = item.fetch("attributes", {})
            doi = attributes.fetch("doi", nil)
            return nil if doi.blank?
        
        
        Severity: Minor
        Found in app/models/name_identifier.rb - About 3 hrs 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

        Class Base has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Base
          include Importable
          include Cacheable
          include ::Bolognese::MetadataUtils
        
        
        Severity: Minor
        Found in app/models/base.rb - About 3 hrs to fix

          Method parse_record has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def parse_record(sqs_msg: nil, data: nil)
                id = "https://doi.org/#{data['id']}"
                response = get_datacite_json(id)
                related_identifiers = Array.wrap(response.fetch("relatedIdentifiers",
                                                                nil)).select do |r|
          Severity: Major
          Found in app/models/concerns/importable.rb - About 3 hrs to fix

            Method push_item has 89 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.push_item(item)
                doi = item.fetch("DOI", nil)
                return nil if doi.blank?
            
                pid = normalize_doi(doi)
            Severity: Major
            Found in app/models/crossref_related.rb - About 3 hrs to fix

              Method push_item has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.push_item(item)
                  attributes = item.fetch("attributes", {})
                  related_identifiers = Array.wrap(attributes.fetch("relatedIdentifiers",
                                                                    nil))
                  skip_doi = related_identifiers.any? do |related_identifier|
              Severity: Major
              Found in app/models/orcid_affiliation.rb - About 3 hrs to fix

                Method push_item has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.push_item(item)
                    attributes = item.fetch("attributes", {})
                    doi = attributes.fetch("doi", nil)
                    return nil if doi.blank?
                
                
                Severity: Major
                Found in app/models/affiliation_identifier.rb - About 3 hrs to fix

                  Method push_item has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def self.push_item(item)
                      doi = item.fetch("doi")
                      pid = normalize_doi(doi)
                      related_identifiers = item.fetch("relatedIdentifier", [])
                      skip_doi = related_identifiers.any? do |related_identifier|
                  Severity: Major
                  Found in app/models/orcid_claim.rb - About 2 hrs to fix

                    Method push_item has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.push_item(item)
                        attributes = item.fetch("attributes", {})
                        doi = attributes.fetch("doi", nil)
                        return nil if doi.blank?
                    
                    
                    Severity: Major
                    Found in app/models/funder_identifier.rb - About 2 hrs to fix

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

                        def self.push_item(item)
                          attributes = item.fetch("attributes", {})
                          related_identifiers = Array.wrap(attributes.fetch("relatedIdentifiers",
                                                                            nil))
                          skip_doi = related_identifiers.any? do |related_identifier|
                      Severity: Minor
                      Found in app/models/orcid_affiliation.rb - About 2 hrs 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 push_item has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.push_item(item)
                          doi = item.fetch("DOI", nil)
                          return nil if doi.blank?
                      
                          pid = normalize_doi(doi)
                      Severity: Minor
                      Found in app/models/crossref_related.rb - About 2 hrs 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 push_item has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def self.push_item(item)
                          attributes = item.fetch("attributes", {})
                          doi = attributes.fetch("doi", nil)
                          return nil if doi.blank?
                      
                      
                      Severity: Major
                      Found in app/models/related_handle.rb - About 2 hrs to fix

                        Method push_item has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def self.push_item(item)
                            attributes = item.fetch("attributes", {})
                            doi = attributes.fetch("doi", nil)
                            return nil if doi.blank?
                        
                        
                        Severity: Major
                        Found in app/models/related_igsn.rb - About 2 hrs to fix

                          Method push_item has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def self.push_item(item)
                              attributes = item.fetch("attributes", {})
                              doi = attributes.fetch("doi", nil)
                              return nil if doi.blank?
                          
                          
                          Severity: Major
                          Found in app/models/related_pmid.rb - About 2 hrs to fix

                            Method push_item has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def self.push_item(item)
                                attributes = item.fetch("attributes", {})
                                doi = attributes.fetch("doi", nil)
                                return nil if doi.blank?
                            
                            
                            Severity: Major
                            Found in app/models/related_url.rb - About 2 hrs to fix

                              Method push_item has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def self.push_item(item)
                                  doi = item.fetch("DOI", nil)
                                  return nil if doi.blank?
                              
                                  pid = normalize_doi(doi)
                              Severity: Major
                              Found in app/models/crossref_funder.rb - About 2 hrs to fix

                                Method push_item has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def self.push_item(item)
                                    doi = item.fetch("DOI", nil)
                                    return nil if doi.blank?
                                
                                    pid = normalize_doi(doi)
                                Severity: Major
                                Found in app/models/crossref_orcid.rb - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language