Showing 91 of 109 total issues

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

  def update
    authorize! :update, Iqvoc.config

    # deserialize and save configuration settings
    errors = []
Severity: Minor
Found in app/controllers/instance_configuration_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 import has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def import(file)
    ActiveSupport.run_load_hooks(:skos_importer_before_import, self)

    start = Time.now

Severity: Minor
Found in app/aides/skos_importer.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 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 valid? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def valid?
    valid = true

    if blank_node = initial_value.match(RDFAPI::BLANK_NODE_REGEXP)
      # blank node validation, should not contain special chars
Severity: Minor
Found in app/aides/origin.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize(object, default_namespace_url, logger = Rails.logger, publish = true, verbose = false)
Severity: Minor
Found in app/aides/skos_importer.rb - About 35 mins to fix

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

      def populate_hierarchy(root_concept, scope, max_depth, current_depth = 0,
            include_siblings = false)
    Severity: Minor
    Found in app/controllers/hierarchy_controller.rb - About 35 mins to fix

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

        def add_collections(document)
          @logger.info 'Exporting collections...'
      
          offset = 0
          while true
      Severity: Minor
      Found in app/aides/skos_exporter.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 pref_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def pref_label
          if pref_labels.loaded?
            # use select if association is already loaded
            @cached_pref_labels ||= pref_labels.select(&:published?).each_with_object({}) do |label, hash|
              if hash[label.language]
      Severity: Minor
      Found in app/models/concept/base.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def index
          authorize! :read, Concept::Base
      
          # only initilaize dataset if dataset param is set
          # prevent obsolet http request when using matches widget
      Severity: Minor
      Found in app/controllers/concepts/alphabetical_controller.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 show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def show
          published = params[:published] == '1' || !params[:published]
          scope = Iqvoc::Collection.base_class.by_origin(params[:id])
      
          if published
      Severity: Minor
      Found in app/controllers/collections_controller.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 add_concepts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def add_concepts(document)
          @logger.info 'Exporting concepts...'
      
          offset = 0
          while true
      Severity: Minor
      Found in app/aides/skos_exporter.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 collection_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def collection_index
          authorize! :use, :dashboard
      
          collections = Iqvoc::Collection.base_class.for_dashboard.load
      
      
      Severity: Minor
      Found in app/controllers/dashboard_controller.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 unique_pref_labels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def unique_pref_labels
            if validatable_for_publishing?
              # checks if any other concept already owns the chosen pref labels
              conflicting_pref_labels = pref_labels.select do |l|
                Iqvoc::Concept.base_class.joins(:pref_labels).where(labels: { value: l.value, language: l.language }).where('labelings.owner_id != ?', id).where('concepts.origin != ?', origin).any?
      Severity: Minor
      Found in app/models/concept/validations.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 build_from_rdf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.build_from_rdf(rdf_subject, rdf_predicate, rdf_object)
          # https://github.com/rails/rails/issues/16928
          unless rdf_subject.class.reflections.include?(self.name.to_relation_name.to_s)
            raise "#{self.name}#build_from_rdf: Subject (#{rdf_subject}) must be able to receive this kind of note (#{self.name} => #{self.name.to_relation_name.to_s})."
          end
      Severity: Minor
      Found in app/models/note/skos/base.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          @user = User.find(params[:id])
          authorize! :update, @user
      
          # strip out role and active params so that a non admin
      Severity: Minor
      Found in app/controllers/users_controller.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 create_with_reverse_relation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def create_with_reverse_relation(target_concept, attributes = {})
              relation_class = proxy_association.reflection.class_name.constantize
              ActiveRecord::Base.transaction do
                # The one direction
                scope = relation_class.where(owner_id: proxy_association.owner.id, target_id: target_concept.id)
      Severity: Minor
      Found in app/models/concept/relation/reverse_relation_extension.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 concept_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def concept_index
          authorize! :use, :dashboard
      
          concepts = Iqvoc::Concept.base_class.for_dashboard.load
      
      
      Severity: Minor
      Found in app/controllers/dashboard_controller.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

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

        Avoid too many return statements within this method.
        Open

            render_response :in_processing and return if unpublished_concepts.any?
        Severity: Major
        Found in app/controllers/reverse_matches_controller.rb - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language