Showing 91 of 109 total issues

Method single_query has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.single_query(params = {})
    query_str = build_query_string(params)

    scope = by_query_value(query_str).
            by_language(params[:languages].to_a)
Severity: Minor
Found in app/models/note/base.rb - About 1 hr to fix

    Method regenerate_members has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def regenerate_members(target_class, target_origins)
        return if target_origins.nil? # There is nothing to do
        existing = self.members.includes(:target)
        existing = if target_class <= Collection::Base
          existing.select { |m| m.target.is_a?(Collection::Base) }
    Severity: Minor
    Found in app/models/collection/base.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

    Function autocomplete has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    IQVOC.autocomplete = (function($) {
    
    // `field` is the input field to be augmented
    // `source` is a function expected to calculate the results - it is invoked with
    // the respective query string and a callback and expected to invoke that
    Severity: Minor
    Found in app/assets/javascripts/iqvoc/autocomplete.js - About 1 hr to fix

      Method merge has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def merge
          concept_scope = Iqvoc::Concept.base_class.by_origin(params[:origin])
      
          current_concept = concept_scope.published.last
          new_version = concept_scope.unpublished.last
      Severity: Minor
      Found in app/controllers/concepts/versions_controller.rb - About 1 hr to fix

        Method show has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show
            scope = if params[:published] == '0'
              Iqvoc::Concept.base_class.unpublished
            else
              Iqvoc::Concept.base_class.published
        Severity: Minor
        Found in app/controllers/rdf_controller.rb - About 1 hr to fix

          Method link_to_dashboard_item has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def link_to_dashboard_item(item)
              if item.is_a?(Label::Base)
                item.published? ? label_path(id: item.origin) : label_path(published: 0, id: item.origin)
              elsif item.is_a?(Collection::Base)
                item.published? ? collection_path(id: item.origin) : collection_path(published: 0, id: item.origin)
          Severity: Minor
          Found in app/helpers/dashboard_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 nav_link has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def nav_link(item, opts = {})
              active = item[:active?] ? instance_eval(&item[:active?]) : (item[:controller] ? params[:controller] == item[:controller] : false)
          
              css = opts[:class] || 'nav-link'
              css << ' active' if active
          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 error has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def error(job, exception)
              error_type = nil
          
              case exception
              when Faraday::ConnectionFailed
          Severity: Minor
          Found in app/jobs/reverse_match_job.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 move has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def move
              moved_concept = Iqvoc::Concept.base_class.find(params.require(:moved_node_id))
          
              if moved_concept.published?
                authorize! :branch, moved_concept
          Severity: Minor
          Found in app/controllers/concepts_movement_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 single_query has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.single_query(params = {})
              query_str = build_query_string(params)
          
              scope = by_query_value(query_str).
                      by_language(params[:languages].to_a)
          Severity: Minor
          Found in app/models/note/base.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 setup_development has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.setup_development(config)
              # Settings specified here will take precedence over those in config/application.rb.
          
              # In the development environment your application's code is reloaded any time
              # it changes. This slows down response time but is perfect for development
          Severity: Minor
          Found in lib/iqvoc/environments/development.rb - About 1 hr to fix

            Method move has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def move
                moved_concept = Iqvoc::Concept.base_class.find(params.require(:moved_node_id))
            
                if moved_concept.published?
                  authorize! :branch, moved_concept
            Severity: Minor
            Found in app/controllers/concepts_movement_controller.rb - About 1 hr to fix

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

                def sidebar_item(opts = {}, &block)
                  if perms = opts.delete(:perms)
                    return nil if cannot?(*perms)
                  end
              
              
              Severity: Minor
              Found in app/helpers/navigation_helper.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def create
                  authorize! :create, UserSession
              
                  @user_session = UserSession.new(user_session_params.to_h)
                  request.session_options[:skip] = false
              Severity: Minor
              Found in app/controllers/user_sessions_controller.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 build_from_rdf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.build_from_rdf(rdf_subject, rdf_predicate, rdf_object)
                  raise "#{self.name}#build_from_rdf: Subject (#{rdf_subject}) must be a Concept." unless rdf_subject.is_a? Concept::Base
                  raise "#{self.name}#build_from_rdf: Object (#{rdf_object}) must be a Concept."   unless rdf_object.is_a? Concept::Base
              
                  relation_class = RDFAPI::PREDICATE_DICTIONARY[rdf_predicate] || self
              Severity: Minor
              Found in app/models/concept/relation/skos/base.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 nested_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def nested_list(hash, options={})
                  ordered = options[:ordered] || false
                  options.delete(:ordered)
              
                  content_tag(ordered ? 'ol' : 'ul', options) do
              Severity: Minor
              Found in app/helpers/concepts_helper.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

              Function LanguageSelector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              IQVOC.LanguageSelector = (function($) {
              
              "use strict";
              
              var getSelection, setSelection;
              Severity: Minor
              Found in app/assets/javascripts/iqvoc/langselect.js - 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 build_from_rdf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.build_from_rdf(rdf_subject, rdf_predicate, rdf_object)
                  raise "#{self.name}#build_from_rdf: Subject (#{rdf_subject}) must be a Collection."          unless rdf_subject.is_a?(Collection::Base)
                  raise "#{self.name}#build_from_rdf: Object (#{rdf_object}) must be a Collection or Concept." unless rdf_object.is_a?(Collection::Base) or rdf_object.is_a?(Concept::Base)
              
                  member_instance = rdf_subject.members.detect{ |rel| rel.target == rdf_object }
              Severity: Minor
              Found in app/models/collection/member/skos/base.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 prepare_match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def prepare_match
                  begin
                    origin = params.require(:origin)
                    @uri = params.require(:uri)
                    match_class = params.require(:match_class)
              Severity: Minor
              Found in app/controllers/reverse_matches_controller.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 distinct_versions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def distinct_versions
                  query = self.class.by_origin(origin)
                  existing_total = query.count
                  if existing_total >= 2
                    errors.add :base, I18n.t('txt.models.concept.version_error', origin: origin)
              Severity: Minor
              Found in app/models/concerns/first_level_object_validations.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