ruby-rdf/rdf

View on GitHub

Showing 213 of 213 total issues

Class Literal has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Literal

  private
    @@subclasses       = [] # @private
    @@datatype_map     = nil # @private
Severity: Minor
Found in lib/rdf/model/literal.rb - About 4 hrs to fix

    Class Statement has 33 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Statement
        include RDF::Resource
    
        ##
        # @private
    Severity: Minor
    Found in lib/rdf/model/statement.rb - About 4 hrs to fix

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

          def parse(value)
            value = value.to_s.dup.force_encoding(Encoding::ASCII_8BIT)
            parts = {}
            if matchdata = IRI_PARTS.match(value)
              scheme, authority, path, query, fragment = matchdata[1..-1]
      Severity: Minor
      Found in lib/rdf/model/uri.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 each has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.each(file_name: nil,
                        file_extension: nil,
                        content_type: nil,
                        has_reader: false,
                        has_writer: false,
      Severity: Minor
      Found in lib/rdf/format.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 query has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def query(pattern, **options, &block)
            raise TypeError, "#{self} is not readable" if respond_to?(:readable?) && !readable?
      
            case pattern
              # A basic graph pattern (BGP) query:
      Severity: Minor
      Found in lib/rdf/mixin/queryable.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 valid? has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          def valid?
            li = subject
            list_nodes = []
            while li != RDF.nil do
              return false if list_nodes.include?(li)
      Severity: Minor
      Found in lib/rdf/model/list.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

      Method write_epilogue has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def write_epilogue
              class_name = options[:class_name]
              module_name = options.fetch(:module_name, "RDF")
              source = options.fetch(:location, base_uri)
              strict = options.fetch(:strict, false)
      Severity: Major
      Found in lib/rdf/vocab/writer.rb - About 3 hrs to fix

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

              def initialize(body, options = {})
                options.each do |key, value|
                  # de-quote charset
                  matchdata = value.match(/^["'](.*)["']$/.freeze) if key == "charset"
                  value = matchdata[1] if matchdata
        Severity: Minor
        Found in lib/rdf/util/file.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

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

              def to_ruby(indent: "")
                "term(" +
                (self.uri? ? self.to_s.inspect + ",\n" : "\n") +
                "#{indent}  " +
                attributes.keys.sort.map do |k|
        Severity: Minor
        Found in lib/rdf/vocabulary.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 Numeric has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Numeric < Literal
            ##
            # Compares this literal to `other` for sorting purposes.
            #
            # @param  [Object] other
        Severity: Minor
        Found in lib/rdf/model/literal/numeric.rb - About 3 hrs to fix

          Method open has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.open(filename, format: nil, **options, &block)
                # If we're the abstract reader, and we can figure out a concrete reader from format, use that.
                if self == RDF::Reader && format && reader = self.for(format)
                  return reader.open(filename, format: format, **options, &block)
                end
          Severity: Minor
          Found in lib/rdf/reader.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

          File reader.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module RDF
            ##
            # The base class for RDF parsers.
            #
            # @example Loading an RDF reader implementation
          Severity: Minor
          Found in lib/rdf/reader.rb - About 3 hrs to fix

            Class Solution has 29 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Solution
                # Undefine all superfluous instance methods:
                alias_method :__send, :send
            
                # Temporarily remember instance method for deprecation message in `method_missing`.
            Severity: Minor
            Found in lib/rdf/query/solution.rb - About 3 hrs to fix

              File enumerable.rb has 308 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module RDF
                ##
                # An RDF statement enumeration mixin.
                #
                # Classes that include this module must implement an `#each` method that
              Severity: Minor
              Found in lib/rdf/mixin/enumerable.rb - About 3 hrs to fix

                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

                  Method initialize has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def initialize(subject: nil, graph: nil, values: nil, wrap_transaction: false, &block)
                        @subject = subject || RDF.nil
                        @graph   = graph   || RDF::Graph.new
                        is_empty = @graph.query({subject: subject, predicate: RDF.first}).empty?
                  
                  
                  Severity: Minor
                  Found in lib/rdf/model/list.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

                  Method execute has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def execute(queryable, bindings = {}, &block)
                        bindings = bindings.to_h if bindings.is_a?(Solution)
                        query = {
                          subject:    subject.is_a?(Variable)     && bindings[subject.to_sym]     ? bindings[subject.to_sym]    : subject,
                          predicate:  predicate.is_a?(Variable)   && bindings[predicate.to_sym]   ? bindings[predicate.to_sym]  : predicate,
                  Severity: Minor
                  Found in lib/rdf/query/pattern.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

                  Method exec has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.exec(args, output: $stdout, option_parser: nil, messages: {}, **options)
                        option_parser ||= self.options(args)
                        options[:logger] ||= option_parser.options[:logger]
                        output.set_encoding(Encoding::UTF_8) if output.respond_to?(:set_encoding) && RUBY_PLATFORM == "java"
                  
                  
                  Severity: Major
                  Found in lib/rdf/cli.rb - About 3 hrs to fix

                    Method write_statement has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def write_statement(statement)
                          statement = statement.canonicalize! if canonicalize?
                    
                          # Make sure BNodes in statement use unique identifiers
                          if statement.node?
                    Severity: Minor
                    Found in lib/rdf/writer.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

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

                          def from_graph(graph, url: nil, class_name: nil, extra: nil)
                            vocab = case class_name
                            when RDF::Vocabulary
                              class_name.instance_variable_set(:@ontology, nil)
                              class_name.instance_variable_set(:@properties, nil)
                    Severity: Major
                    Found in lib/rdf/vocabulary.rb - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language