datacite/orcid_client

View on GitHub

Showing 12 of 19 total issues

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

  class Work
    include OrcidClient::Base
    include OrcidClient::Author
    include OrcidClient::Date
    include OrcidClient::WorkType
Severity: Minor
Found in lib/orcid_client/work.rb - About 2 hrs to fix

    Method orcid_work_type has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def orcid_work_type(internal_work_type, internal_work_subtype)
          type =  case  internal_work_type
                  when 'Text'
                    case internal_work_subtype
                    when /^(Article|Articles|Journal Article|JournalArticle)$/i
    Severity: Minor
    Found in lib/orcid_client/work_type.rb - About 1 hr to fix

      Method update_work has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_work(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "ORCID access token missing" }] }) unless orcid_token.present?
            return OpenStruct.new(body: { "errors" => [{ "title" => "Put code missing" }] }) unless put_code.present?
      
            self.visibility = nil
      Severity: Minor
      Found in lib/orcid_client/api.rb - About 1 hr 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_work has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_work(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "ORCID access token missing" }] }) unless orcid_token.present?
      
            orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
      
      
      Severity: Minor
      Found in lib/orcid_client/api.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 insert_pub_date has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def insert_pub_date(xml)
            if publication_date['year']
              xml.send(:'common:publication-date') do
                xml.year(publication_date.fetch('year'))
                xml.month(publication_date.fetch('month', nil)) if publication_date['month']
      Severity: Minor
      Found in lib/orcid_client/work.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_external_identifier has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_external_identifier(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "ORCID access token missing" }] }) unless orcid_token.present?
      
            orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
      
      
      Severity: Minor
      Found in lib/orcid_client/api.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_notification has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_notification(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "Notification access token missing" }] }) unless notification_access_token.present?
      
            orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
      
      
      Severity: Minor
      Found in lib/orcid_client/api.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 delete_notification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def delete_notification(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "Notification access token missing" }] }) unless notification_access_token.present?
            return OpenStruct.new(body: { "errors" => [{ "title" => "Put code missing" }] }) unless put_code.present?
      
            orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
      Severity: Minor
      Found in lib/orcid_client/api.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

      Method get_notification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_notification(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "Notification access token missing" }] }) unless notification_access_token.present?
            return OpenStruct.new(body: { "errors" => [{ "title" => "Put code missing" }] }) unless put_code.present?
      
            orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
      Severity: Minor
      Found in lib/orcid_client/api.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

      Method delete_work has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def delete_work(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "ORCID access token missing" }] }) unless orcid_token.present?
            return OpenStruct.new(body: { "errors" => [{ "title" => "Put code missing" }] }) unless put_code.present?
      
            orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
      Severity: Minor
      Found in lib/orcid_client/api.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

      Method orcid_work_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def orcid_work_type(internal_work_type, internal_work_subtype)
            type =  case  internal_work_type
                    when 'Text'
                      case internal_work_subtype
                      when /^(Article|Articles|Journal Article|JournalArticle)$/i
      Severity: Minor
      Found in lib/orcid_client/work_type.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

      Method delete_external_identifier has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def delete_external_identifier(options={})
            return OpenStruct.new(body: { "errors" => [{ "title" => "ORCID access token missing" }] }) unless orcid_token.present?
            return OpenStruct.new(body: { "errors" => [{ "title" => "Put code missing" }] }) unless put_code.present?
      
            orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
      Severity: Minor
      Found in lib/orcid_client/api.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