ruby-rdf/rdf

View on GitHub
lib/rdf/repository.rb

Summary

Maintainability
D
2 days
Test Coverage

Method query_pattern has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

      def query_pattern(pattern, **options, &block)
        snapshot = @data
        if block_given?
          graph_name  = pattern.graph_name
          subject     = pattern.subject
Severity: Minor
Found in lib/rdf/repository.rb - About 6 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 Repository has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Repository < Dataset
    include RDF::Mutable

    include RDF::Transactable

Severity: Minor
Found in lib/rdf/repository.rb - About 3 hrs to fix

    File repository.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module RDF
      ##
      # An RDF repository.
      #
      # @example Creating a transient in-memory repository
    Severity: Minor
    Found in lib/rdf/repository.rb - About 2 hrs to fix

      Method delete_from has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def delete_from(data, statement)
              if has_statement_in?(data, statement)
                s, p, o, g = statement.to_quad
                g = DEFAULT_GRAPH unless supports?(:graph_name)
                g ||= DEFAULT_GRAPH
      Severity: Minor
      Found in lib/rdf/repository.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 query_pattern has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def query_pattern(pattern, **options, &block)
              snapshot = @data
              if block_given?
                graph_name  = pattern.graph_name
                subject     = pattern.subject
      Severity: Minor
      Found in lib/rdf/repository.rb - About 1 hr to fix

        Method insert_to has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def insert_to(data, statement)
                raise ArgumentError, "Statement #{statement.inspect} is incomplete" if statement.incomplete?
        
                unless statement_in?(data, statement)
                  s, p, o, c = statement.to_quad
        Severity: Minor
        Found in lib/rdf/repository.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 delete_insert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def delete_insert(deletes, inserts)
              return super unless supports?(:atomic_write)
        
              transaction(mutable: true) do
                deletes.respond_to?(:each_statement) ? delete(deletes) : delete(*deletes)
        Severity: Minor
        Found in lib/rdf/repository.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 each_statement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def each_statement(&block)
                if block_given?
                  @data.each do |g, ss|
                    ss.each do |s, ps|
                      ps.each do |p, os|
        Severity: Minor
        Found in lib/rdf/repository.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

        There are no issues that match your filters.

        Category
        Status