Showing 91 of 109 total issues

Avoid too many return statements within this method.
Open

      return str.to_i
Severity: Major
Found in app/controllers/instance_configuration_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          render_response :unknown_referer and return
    Severity: Major
    Found in app/controllers/reverse_matches_controller.rb - About 30 mins to fix

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

        def render_match_association(hash, concept, association_classes, further_options = {})
          matches_html = ''
          association_classes.each do |association_class|
            matches_html += if association_class.respond_to?(:hidden?) && association_class.hidden?(concept)
              ''
      Severity: Minor
      Found in app/helpers/concepts_helper.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 build_from_rdf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.build_from_rdf(rdf_subject, rdf_predicate, rdf_object)
          unless rdf_subject.is_a?(Concept::Base)
            raise "#{self.name}#build_from_rdf: Subject (#{rdf_subject}) must be a Concept."
          end
      
      
      Severity: Minor
      Found in app/models/labeling/skos/base.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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def index
          authorize! :read, Concept::Base
      
          respond_to do |format|
            format.html do
      Severity: Minor
      Found in app/controllers/concepts_controller.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 labels_for_labeling_class_and_language has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def labels_for_labeling_class_and_language(labeling_class, lang = :en, only_published = true)
          # Convert lang to string in case it's not nil.
          # nil values play their own role for labels without a language.
          if lang == 'none'
            lang = nil
      Severity: Minor
      Found in app/models/concept/base.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 nav_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def nav_items(items)
          items.map do |item|
            if nav_item_authorized?(item)
              if item[:items]
                content_tag :li, class: 'nav-item dropdown' do
      Severity: Minor
      Found in app/helpers/navigation_helper.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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def index
          authorize! :sync, :triplestore
      
          flash.now[:info] = [I18n.t('txt.controllers.triplestore_sync.batch_hint',
              host: root_url(lang: nil))]
      Severity: Minor
      Found in app/controllers/triplestore_sync_controller.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 letter_selector has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def letter_selector(letters = ('A'..'Z').to_a, &block)
          fallback = (@letters&.include?('A')) ? 'a' : @letters&.first
          highlighted_letter = params[:prefix] || fallback || 'a'
          content_tag :ul, class: 'letter-selector list-unstyled' do
            letters.map do |letter|
      Severity: Minor
      Found in app/helpers/concepts_helper.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 nav_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def nav_item(item)
          active = item[:active?] ? instance_eval(&item[:active?]) : (item[:controller] ? params[:controller] == item[:controller] : false)
          css = 'nav-item'
          css << ' active' if active
          content_tag :li, class: css do
      Severity: Minor
      Found in app/helpers/navigation_helper.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 item_listing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def item_listing(items, &block)
          return '&nbsp;'.html_safe if items.empty?
      
          content_tag :ul, class: 'entity_list' do
            items.map do |item|
      Severity: Minor
      Found in app/helpers/application_helper.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