ontohub/ontohub

View on GitHub

Showing 95 of 107 total issues

Method perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def perform(repo_path, oldrev, newrev, refname, key_id)
Severity: Minor
Found in lib/repository_update_worker.rb - About 35 mins to fix

    Method import_remote has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def import_remote(type, user, source, name, params={})
    Severity: Minor
    Found in app/models/repository/importing.rb - About 35 mins to fix

      Method commits_path has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def commits_path(walker, limit, offset, path, &block)
      Severity: Minor
      Found in lib/git_repository/history.rb - About 35 mins to fix

        Method subnavigation has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def subnavigation(resource, pages, current_page, options = {},
            additional_actions = [], partial: '/shared/subnavigation')
        Severity: Minor
        Found in app/helpers/navigation_helper.rb - About 35 mins to fix

          Method add_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def add_file(userinfo, tmp_path, target_path, message, &block)
          Severity: Minor
          Found in lib/git_repository/committing.rb - About 35 mins to fix

            Method commit_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def commit_file(userinfo, file_contents, target_path, message, &block)
            Severity: Minor
            Found in lib/git_repository/committing.rb - About 35 mins to fix

              Method update_redis has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def self.update_redis(repo_path, oldrev, newrev, refname, key_id)
              Severity: Minor
              Found in git/lib/git_update.rb - About 35 mins to fix

                Method update_or_create_from_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def update_or_create_from_hash(hash, _user, timestamp = Time.now)
                        raise ArgumentError, 'No hash given.' unless hash.is_a? Hash
                        # hash['name'] # maybe nil, in this case, we need to generate a name
                        mapping_iri   = locid_for_child(hash['name'] || hash['linkid'])
                        mapping_name  = hash['name']
                Severity: Minor
                Found in app/models/ontology/mappings.rb - About 35 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 generate_ontology_iri has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def generate_ontology_iri(internal_iri, current_element)
                        if current_element['reference'] == 'true'
                          ontology = Ontology.find_with_iri(internal_iri)
                          if ontology.nil?
                            ontohub_iri = ExternalRepository.determine_iri(internal_iri)
                Severity: Minor
                Found in lib/hets/dg/node_evaluation_helper.rb - About 35 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 generate_fingerpint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def generate_fingerpint
                    self.fingerprint = nil
                    return unless key?
                
                    output = ''
                Severity: Minor
                Found in app/models/key/fingerprint.rb - About 35 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 save_ontology has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def save_ontology(commit_oid, ontology_version_options, changed_files: [],
                                    do_parse: true)
                    # We expect that this method is only called, when we can expect an ontology
                    # in this file.
                    file_extension = File.extname(ontology_version_options.filepath)
                Severity: Minor
                Found in lib/ontology_saver.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def characters(text)
                      case @path.last
                        when DESCRIPTION
                          if @current_logic
                            @current_logic.description ||= ''
                Severity: Minor
                Found in lib/logicgraph_parser.rb - About 35 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 flash_messages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def flash_messages
                    out = ''
                    flash.each do |type, message|
                      unless type == :recaptcha_error
                        type    = :info unless FLASH_TYPES.include?(type)
                Severity: Minor
                Found in app/helpers/flash_helper.rb - About 35 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 fetch_uri_content has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def fetch_uri_content(uri, limit: 10, write_file: nil, prev_resp: nil)
                    raise TooManyRedirectionsError.new(last_response: prev_resp) if limit == 0
                    Net::HTTP.get_response(URI(uri)) do |response|
                      response.read_body
                      if has_actual_content?(response)
                Severity: Minor
                Found in lib/uri_fetcher.rb - About 35 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

                Avoid too many return statements within this method.
                Open

                      return true if perm.role == 'owner' and role == :reader
                Severity: Major
                Found in lib/permissionable.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return true if perm.role == 'editor' and role == :reader
                  Severity: Major
                  Found in lib/permissionable.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          return true if perm.role == 'owner' and role == :editor
                    Severity: Major
                    Found in lib/permissionable.rb - About 30 mins to fix

                      Method assign_path_parameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def assign_path_parameters(request, element)
                          ontology = element.is_a?(Ontology) ? element : element.ontology
                      
                          proof_attempt = element.proof_attempt if @map[:proof_attempt]
                          theorem = element.theorem if @map[:theorem]
                      Severity: Minor
                      Found in lib/router_constraints.rb - About 25 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 theorem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def theorem(current_element)
                              if logic_callback.pre_theorem(current_element)
                                theorem = ontology.theorems.update_or_create_from_hash(
                                  current_element, importer.now)
                                ontology.theorems_count += 1
                      Severity: Minor
                      Found in lib/hets/dg/node_evaluator.rb - About 25 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 imported_axiom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def imported_axiom(current_element)
                              if logic_callback.pre_axiom(current_element)
                                current_element['imported'] = true
                                axiom = ontology.axioms.update_or_create_from_hash(
                                  current_element, importer.now)
                      Severity: Minor
                      Found in lib/hets/dg/node_evaluator.rb - About 25 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