Showing 91 of 109 total issues

Method render_hierarchy has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def render_hierarchy(root_origin, depth, unbounded = false)
    default_depth = 3
    max_depth = 4 # XXX: arbitrary

    direction = params[:dir] == 'up' ? 'up' : 'down'
Severity: Minor
Found in app/controllers/hierarchy_controller.rb - About 2 hrs to fix

    Method index has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def index
        base_class = Iqvoc::Concept.base_class
    
        if params[:published] == '0'
          authorize! :update, base_class
    Severity: Minor
    Found in app/controllers/concepts/hierarchical_controller.rb - About 1 hr to fix

      Method merge has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def merge
          scope = Iqvoc::Collection.base_class.by_origin(params[:origin])
      
          current_collection = scope.published.last
          new_version = scope.unpublished.last!
      Severity: Minor
      Found in app/controllers/collections/versions_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 convert_value has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def convert_value(str, type)
          if [TrueClass, FalseClass].include?(type)
            if str == 'true'
              return true
            elsif str == 'false'
      Severity: Minor
      Found in app/controllers/instance_configuration_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 show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def show
          get_concept
          authorize! :read, @concept
      
          if params[:full_consistency_check] && can?(:check_consistency, @concept)
      Severity: Minor
      Found in app/controllers/concepts_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 initialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize(user = nil)
          can :read, Iqvoc::Concept.root_class.instance
          can :read, [::Concept::Base, ::Collection::Base, ::Label::Base], &@@if_published
          can :read, ::Note::Base
      
      
      Severity: Minor
      Found in app/models/ability.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 import has 41 lines of code (exceeds 25 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 1 hr to fix

        Method from_yaml has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.from_yaml(yml)
            data = YAML.load(yml)
        
            labels = {}
            data['labels'].each { |label| # XXX: use omap to simplify format (making `value` the key instead of an attribute)?
        Severity: Minor
        Found in app/aides/maker.rb - About 1 hr to fix

          Function createNote has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          IQVOC.createNote = (function ($) {
          
            var createNote = function(ev) {
              var addButton = $(this);
              var container = addButton.closest("fieldset");
          Severity: Minor
          Found in app/assets/javascripts/iqvoc/create_note.js - About 1 hr to fix

            Method index has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def index
                authorize! :read, Iqvoc::Collection.base_class
            
                respond_to do |format|
                  format.html do
            Severity: Minor
            Found in app/controllers/collections_controller.rb - About 1 hr to fix

              Method index has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  authorize! :read, Iqvoc::Collection.base_class
              
                  respond_to do |format|
                    format.html do
              Severity: Minor
              Found in app/controllers/collections_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 import_first_level_objects has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def import_first_level_objects(types, subject, predicate, object)
                  if (predicate == 'rdf:type' && types[object] && subject =~ /^:(.+)$/)
                    # We've found a subject definition with a class we know and which is in our responsibility (":")
                    origin = $1
              
              
              Severity: Minor
              Found in app/aides/skos_importer.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 onCreateLi has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      onCreateLi: function(node, $li) {
                        var link = buildLink(node.url, node.name);
                        $li.find('.jqtree-title').replaceWith(link);
              
                        // add aditional info if present (e.g. for collections)
              Severity: Minor
              Found in app/assets/javascripts/iqvoc/treeview.js - About 1 hr to fix

                Function EntitySelector has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var EntitySelector = function(node) {
                  if(arguments.length === 0) { // subclassing; skip initialization
                    return;
                  }
                  this.el = $(node).hide(); // XXX: rename
                Severity: Minor
                Found in app/assets/javascripts/iqvoc/entityselect.js - About 1 hr to fix

                  Method import_second_level_objects has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def import_second_level_objects(types, final, line)
                      subject, predicate, object = *extract_triple(line)
                  
                      return unless (subject =~ /^:(.*)$/ && types[predicate]) # We're not responsible for this
                  
                  
                  Severity: Minor
                  Found in app/aides/skos_importer.rb - About 1 hr to fix

                    Function createNote has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var createNote = function(ev) {
                        var addButton = $(this);
                        var container = addButton.closest("fieldset");
                        var source = $("ol li:last-child", container);
                        var inputSelector = "input, select, textarea";
                    Severity: Minor
                    Found in app/assets/javascripts/iqvoc/create_note.js - About 1 hr to fix

                      Method render_concept has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def render_concept(document, concept, suppress_extra_labels = false)
                          # You can not eager load polymorphic associations. That's why we're loading
                          # the collections _one_ time and remember them for further _render_concept_
                          # calls in the future.
                          @rdf_helper_cached_collections ||= Iqvoc::Collection.base_class.select('id, origin').load.each_with_object({}) do |c, hash|
                      Severity: Minor
                      Found in app/helpers/rdf_helper.rb - About 1 hr to fix

                        Method build_rdf has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def build_rdf(document, subject)
                            subject.send(self.rdf_namespace).build_predicate(self.rdf_predicate) do |blank_node|
                              blank_node.Rdfs::comment(self.value, lang: self.language || nil) if self.value
                              self.annotations.order(:namespace, :predicate).each do |annotation|
                                if (IqRdf::Namespace.find_namespace_class(annotation.namespace))
                        Severity: Minor
                        Found in app/models/note/skos/change_note.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 render_concept has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def render_concept(document, concept, suppress_extra_labels = false)
                            # You can not eager load polymorphic associations. That's why we're loading
                            # the collections _one_ time and remember them for further _render_concept_
                            # calls in the future.
                            @rdf_helper_cached_collections ||= Iqvoc::Collection.base_class.select('id, origin').load.each_with_object({}) do |c, hash|
                        Severity: Minor
                        Found in app/helpers/rdf_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 initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def initialize(object, default_namespace_url, logger = Rails.logger, publish = true, verbose = false)
                            @file = case object
                                      when File
                                        File.open(object)
                                      when Array
                        Severity: Minor
                        Found in app/aides/skos_importer.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language