ontohub/ontohub

View on GitHub

Showing 95 of 107 total issues

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

  def ontology_nav(ontology, current_page)
    resource = resource_chain.last

    content_page = ontology.distributed? ? :children : :symbols
    @top_level_pages = [
Severity: Minor
Found in app/helpers/navigation_helper.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 commits_path has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def commits_path(walker, limit, offset, path, &block)
    commits = []

    object = nil
    commit = nil
Severity: Minor
Found in lib/git_repository/history.rb - About 1 hr to fix

    Method suspended_save_ontologies has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def suspended_save_ontologies(options={})
        versions = []
        commits_count = 0
        highest_change_file_count = 0
        user = options.delete(:user)
    Severity: Minor
    Found in lib/ontology_saver.rb - About 1 hr to fix

      Method start_element has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def start_element(name, attributes)
            @path << name
            case name
            when ROOT
              callback(:root, Hash[*[attributes]])
      Severity: Minor
      Found in lib/ontology_parser.rb - About 1 hr to fix

        Method end_element has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def end_element(name)
              @path.pop
        
              case name
              when ONTOLOGY
        Severity: Minor
        Found in lib/ontology_parser.rb - About 1 hr to fix

          Method do_or_set_failed has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def do_or_set_failed(updating_klass = nil, &block)
              raise ArgumentError.new('No block given.') unless block_given?
          
              begin
                yield
          Severity: Minor
          Found in lib/state_updater.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 determine_image_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def determine_image_type(resource)
              if resource.is_a?(Repository) && resource.is_private
                return ['data-type', "Private#{resource.class.to_s}"]
              end
          
          
          Severity: Minor
          Found in app/helpers/link_helper.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 pre_axiom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def pre_axiom(hash)
                if is_annotation_sentence?(hash)
                  m = hash['text'].match(%r{
                    Class:\s+(?<symbol_name>.+?) # Symbol Identifier
                    \s+
          Severity: Minor
          Found in lib/parsing_callback/owl.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 points_through_file? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def points_through_file?(target_path)
              return false if empty?
              return false unless target_path
          
              parts = target_path.split('/')
          Severity: Minor
          Found in lib/git_repository/committing.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_symbol_tree has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def create_symbol_tree
                raise StandardError.new('Ontology is not OWL') unless owl?
          
                # Delete previous set of categories
                delete_edges
          Severity: Minor
          Found in app/models/ontology/symbols.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 procure_ontology has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                def procure_ontology(element, iri)
                  if element['reference'] == 'true'
                    ontology = Ontology.find_with_iri(iri)
                    if ontology.nil?
                      ontology = ExternalRepository.create_ontology(iri)
          Severity: Minor
          Found in lib/hets/dg/node_evaluation_helper.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 validate_each has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate_each(record, attribute, value)
                bad_uris = []
                if value.is_a?(Array)
                  value.each do |elem|
                    if elem.is_a?(String)
          Severity: Minor
          Found in lib/settings_validation_wrapper/validators.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 resource_chain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def resource_chain
              return @resource_chain if @resource_chain
          
              if params[:logic_id]
                @resource_chain = []
          Severity: Minor
          Found in app/helpers/application_helper.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 context_pane has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def context_pane
              if params[:controller] == 'home'
                'shared/user_repositories'
              elsif params[:controller] == 'categories' && params[:action] == 'show'
                'shared/user_ontologies'
          Severity: Minor
          Found in app/helpers/application_helper.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 index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              ontology = Ontology.find params[:ontology_id]
          
              if ontology && (ontology.is?('OWL2') || ontology.is?('OWL'))
                begin
          Severity: Minor
          Found in app/controllers/symbols_controller.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 update_or_create_from_hash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def update_or_create_from_hash(hash, timestamp = Time.now)
                  raise ArgumentError, 'No hash given.' unless hash.is_a? Hash
          
                  e = where(text: hash['text']).first_or_initialize
          
          
          Severity: Minor
          Found in app/models/ontology/symbols.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 fancy_link has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def fancy_link(resource)
              return nil unless resource
          
              data_type, value = determine_image_type(resource)
          
          
          Severity: Minor
          Found in app/helpers/link_helper.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 index has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def index
              ontology = Ontology.find params[:ontology_id]
          
              if ontology && (ontology.is?('OWL2') || ontology.is?('OWL'))
                begin
          Severity: Minor
          Found in app/controllers/symbols_controller.rb - About 1 hr to fix

            Method update_or_create_from_hash has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def update_or_create_from_hash(hash, timestamp = Time.now)
                    raise ArgumentError, 'No hash given.' unless hash.is_a? Hash
            
                    e = where(text: hash['text']).first_or_initialize
            
            
            Severity: Minor
            Found in app/models/ontology/symbols.rb - About 1 hr to fix

              Method determine_image_type has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def determine_image_type(resource)
                  if resource.is_a?(Repository) && resource.is_private
                    return ['data-type', "Private#{resource.class.to_s}"]
                  end
              
              
              Severity: Minor
              Found in app/helpers/link_helper.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language