ruby-rdf/rdf

View on GitHub

Showing 213 of 213 total issues

File uri.rb has 690 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'cgi'

module RDF
  ##
  # A Uniform Resource Identifier (URI).
Severity: Major
Found in lib/rdf/model/uri.rb - About 1 day to fix

    Class URI has 80 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class URI
        include RDF::Resource
    
        # IRI components
        UCSCHAR = %(
    Severity: Major
    Found in lib/rdf/model/uri.rb - About 1 day to fix

      File vocabulary.rb has 606 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module RDF
        ##
        # A {Vocabulary} represents an RDFS or OWL vocabulary.
        #
        # A {Vocabulary} can also serve as a Domain Specific Language (DSL) for generating an RDF Graph definition for the vocabulary (see {RDF::Vocabulary#to_enum}).
      Severity: Major
      Found in lib/rdf/vocabulary.rb - About 1 day to fix

        Method from_graph has a Cognitive Complexity of 61 (exceeds 5 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: Minor
        Found in lib/rdf/vocabulary.rb - About 1 day 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 owl.rb has 527 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rdf'
        module RDF
          # @!parse
          #   # Vocabulary for <http://www.w3.org/2002/07/owl#>
          #   #
        Severity: Major
        Found in lib/rdf/vocab/owl.rb - About 1 day to fix

          Class List has 55 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class RDF::List
              include RDF::Enumerable
              include RDF::Value
              include Comparable
          
          
          Severity: Major
          Found in lib/rdf/model/list.rb - About 7 hrs to fix

            Class Vocabulary has 54 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Vocabulary
                extend ::Enumerable
            
                autoload :Format, 'rdf/vocab/writer'
                autoload :Writer, 'rdf/vocab/writer'
            Severity: Major
            Found in lib/rdf/vocabulary.rb - About 7 hrs to fix

              File cli.rb has 481 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'rdf'
              require 'rdf/ntriples'
              require 'rdf/nquads'
              require 'rdf/vocab/writer'
              require 'logger'
              Severity: Minor
              Found in lib/rdf/cli.rb - About 7 hrs to fix

                Method write_epilogue has a Cognitive Complexity of 46 (exceeds 5 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: Minor
                Found in lib/rdf/vocab/writer.rb - About 7 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 a Cognitive Complexity of 43 (exceeds 5 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: Minor
                Found in lib/rdf/cli.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

                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

                Method attribute_value has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                      def attribute_value(prop)
                        values = attributes[prop]
                        return nil if values.nil?
                        values = [values].compact unless values.is_a?(Array)
                        prop_values = values.map do |value|
                Severity: Minor
                Found in lib/rdf/vocabulary.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

                Method content_type has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.content_type(type = nil, options = {})
                      if type.nil?
                        [@@content_type[self], @@content_types.map {
                          |ct, cl| (cl.include?(self) && ct != @@content_type[self]) ?  ct : nil }].flatten.compact
                      else
                Severity: Minor
                Found in lib/rdf/format.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

                Method qname has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                Open

                    def qname(prefixes: nil)
                      if prefixes
                        prefixes.each do |prefix, uri|
                          return [prefix, self.to_s[uri.length..-1].to_sym] if self.start_with?(uri)
                        end
                Severity: Minor
                Found in lib/rdf/model/uri.rb - About 5 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 Writer has 37 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Writer
                    extend  ::Enumerable
                    extend  RDF::Util::Aliasing::LateBound
                    include RDF::Util::Logger
                    include RDF::Writable
                Severity: Minor
                Found in lib/rdf/writer.rb - About 4 hrs to fix

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

                      def execute(queryable, bindings: {}, solutions: Solution.new, graph_name: nil, name: nil, **options, &block)
                        # Use provided solutions to allow for query chaining
                        # Otherwise, a quick empty solution simplifies the logic below; no special case for
                        # the first pattern
                        @solutions = Query::Solutions(solutions)
                  Severity: Minor
                  Found in lib/rdf/query.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 order has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def order(*variables)
                        if variables.empty? && !block_given?
                          raise ArgumentError, "wrong number of arguments (0 for 1)"
                        else
                          self.sort! do |a, b|
                  Severity: Minor
                  Found in lib/rdf/query/solutions.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 open_url has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def self.open_url(base_uri, proxy: nil, headers: {}, verify_none: false, **options)
                          ssl_verify = verify_none ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
                  
                          redirect_count = 0
                          max_redirects = 5
                  Severity: Minor
                  Found in lib/rdf/util/file.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

                  Class Reader has 34 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Reader
                      extend  ::Enumerable
                      extend  RDF::Util::Aliasing::LateBound
                      include RDF::Util::Logger
                      include RDF::Readable
                  Severity: Minor
                  Found in lib/rdf/reader.rb - About 4 hrs to fix

                    File list.rb has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module RDF
                      ##
                      # An RDF list.
                      #
                      # @example Constructing a new list
                    Severity: Minor
                    Found in lib/rdf/model/list.rb - About 4 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language