ontohub/ontohub

View on GitHub

Showing 107 of 107 total issues

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

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

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

        Method do_or_set_failed has 27 lines of code (exceeds 25 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

          Method list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def list
              typeIri = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
              labelIri = 'http://www.w3.org/2000/01/rdf-schema#label'
              commentIri = 'http://www.w3.org/2000/01/rdf-schema#comment'
              definedIri = 'http://www.w3.org/2000/01/rdf-schema#isDefinedBy'
          Severity: Minor
          Found in lib/logic_population.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 list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def list
              typeIri = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
              labelIri = 'http://www.w3.org/2000/01/rdf-schema#label'
              commentIri = 'http://www.w3.org/2000/01/rdf-schema#comment'
              definedIri = 'http://www.w3.org/2000/01/rdf-schema#isDefinedBy'
          Severity: Minor
          Found in lib/language_population.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 characters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def characters(text)
                  case @path.last
                  when SYMBOL
                    @current_symbol['text'] << text if @current_symbol
                  when TEXT
          Severity: Minor
          Found in lib/hets/dg/nokogiri_listener.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 state_message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def state_message
              msg = [state]
              if last_error
                lines = last_error.split("\n")
                if (ind=lines.index("*** Error:")) and (out = lines[ind+1]).present?
          Severity: Minor
          Found in app/models/ontology_version/states.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 commit_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def commit_file(userinfo, file_contents, target_path, message, &block)
              # throw exception if path is below a file
              if points_through_file?(target_path)
                raise GitRepository::PathBelowFileException
              end
          Severity: Minor
          Found in lib/git_repository/committing.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 characters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def characters(text)
                case @path.last
                when SYMBOL
                  @current_symbol['text'] << text if @current_symbol
                when TEXT
          Severity: Minor
          Found in lib/ontology_parser.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 matches? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def matches?(request, path = nil)
              path ||= Journey::Router::Utils.
                unescape_uri(request.original_fullpath)
              # retrieves the hierarchy and member portions of loc/id's
              hierarchy_member = path.split('?', 2).first.split('///', 2).first
          Severity: Minor
          Found in lib/router_constraints.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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              def characters(text)
                case @path.last
                when SYMBOL
                  @current_symbol['text'] << text if @current_symbol
                when TEXT
          Severity: Minor
          Found in lib/ontology_parser.rb and 1 other location - About 45 mins to fix
          lib/hets/dg/nokogiri_listener.rb on lines 93..101

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 41.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                def characters(text)
                  case @path.last
                  when SYMBOL
                    @current_symbol['text'] << text if @current_symbol
                  when TEXT
          Severity: Minor
          Found in lib/hets/dg/nokogiri_listener.rb and 1 other location - About 45 mins to fix
          lib/ontology_parser.rb on lines 85..93

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 41.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method exec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def exec
              if Settings.data_root.join("maintenance.txt").exist?
                STDERR.puts "System in maintenance mode. Please try again later."
                exit 1
              end
          Severity: Minor
          Found in git/lib/git_shell.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 call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def call
              Semaphore.exclusively(lock_key, expiration: MUTEX_EXPIRATION) do
                unless finished
                  transaction do
                    preprocess unless other_finished_sine_axiom_selections.any?
          Severity: Minor
          Found in app/models/sine_axiom_selection.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 commits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def commits(start_oid: nil, stop_oid: nil, path: nil, limit: nil, offset: 0, walk_order: nil, &block)
              return [] if @repo.empty?
              start_oid ||= head_oid
              offset = 0 if offset < 0
              stop_oid = nil if stop_oid =~ /\A0+\z/
          Severity: Minor
          Found in lib/git_repository/history.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 start_element has a Cognitive Complexity of 8 (exceeds 5 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 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 exec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def exec
              # If its push over ssh
              # we need to check user persmission per branch first
              if ssh?
                if api.allowed?('git-receive-pack', @repo_name, @key_id, @branch_name)
          Severity: Minor
          Found in git/lib/git_update.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 start_element has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def start_element(name, attributes)
                  order = :start
                  @path << name
                  case name
                  when ROOT
          Severity: Minor
          Found in lib/hets/dg/nokogiri_listener.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 active_navigation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def active_navigation(controller)
              alternatives = [controller.to_s, controller.to_s.gsub('_', '/')]
              if params[:repository_id]
                if params[:ontology_id]
                  'active' if controller == :ontologies
          Severity: Minor
          Found in app/helpers/navigation_helper.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

          Severity
          Category
          Status
          Source
          Language