myGrid/ruby-ro-bundle

View on GitHub

Showing 10 of 10 total issues

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

  class Manifest < ZipContainer::ManagedFile
    include Provenance

    FILE_NAME = "manifest.json" # :nodoc:
    DEFAULT_CONTEXT = "https://w3id.org/bundle/context" # :nodoc:
Severity: Minor
Found in lib/ro-bundle/ro/manifest.rb - About 3 hrs to fix

    Method add_annotation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_annotation(target, body = nil, options = {})
          options = { :aggregate => false }.merge(options)
    
          if target.is_a?(Annotation) || annotatable?(target)
            if body.nil? || aggregate?(body)
    Severity: Minor
    Found in lib/ro-bundle/file.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(object, mediatype = nil)
          super()
    
          if object.instance_of?(Hash)
            init_json(object)
    Severity: Minor
    Found in lib/ro-bundle/ro/aggregate.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 remove_annotation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove_annotation(object)
          if object.is_a?(Annotation)
            removed = [structure[:annotations].delete(object)].compact
          else
            removed = remove_annotation_by_field(object)
    Severity: Minor
    Found in lib/ro-bundle/ro/manifest.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 remove_aggregate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove_aggregate(object)
          removed = nil
    
          if object.is_a?(Aggregate)
            removed = structure[:aggregates].delete(object)
    Severity: Minor
    Found in lib/ro-bundle/ro/manifest.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 cleanup_annotation_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def cleanup_annotation_data
          container.glob("#{@annotations_directory.full_name}/*",
            :include_hidden => true) do |file|
    
            found = false
    Severity: Minor
    Found in lib/ro-bundle/ro/directory.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(first, uri = nil, orcid = nil)
          if first.instance_of?(Hash)
            name = first[:name]
            uri = first[:uri]
            orcid = first[:orcid]
    Severity: Minor
    Found in lib/ro-bundle/ro/agent.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 aggregate? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def aggregate?(entry)
          return true if entry == @manifest.id
    
          if Util.is_absolute_uri?(entry)
            entry = entry.to_s
    Severity: Minor
    Found in lib/ro-bundle/file.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 add_annotation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_annotation(object, content = nil)
          if object.instance_of?(Annotation)
            # If the supplied Annotation object is already registered then it is
            # the annotation itself we are annotating!
            if container.annotation?(object)
    Severity: Minor
    Found in lib/ro-bundle/ro/manifest.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 write_annotation_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_annotation_data(source, options)
          uuid = UUID.generate
    
          if options[:aggregate]
            entry = uuid
    Severity: Minor
    Found in lib/ro-bundle/ro/directory.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