Showing 91 of 109 total issues

Function Treeview has 199 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function Treeview(container) {
    this.container = container.jquery ? container : $(container);

    $(container).each(function() {
      var url = $(this).data('url');
Severity: Major
Found in app/assets/javascripts/iqvoc/treeview.js - About 7 hrs to fix

    File base.rb has 407 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Concept::Base < ApplicationRecord
      attr_accessor :reverse_match_service
      self.table_name = 'concepts'
    
      class_attribute :default_includes
    Severity: Minor
    Found in app/models/concept/base.rb - About 5 hrs to fix

      Function EntitySelector has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

      IQVOC.EntitySelector = (function($) {
      
      "use strict";
      
      var EntitySelector = function(node) {
      Severity: Minor
      Found in app/assets/javascripts/iqvoc/entityselect.js - About 5 hrs 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 EntitySelector has 143 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      IQVOC.EntitySelector = (function($) {
      
      "use strict";
      
      var EntitySelector = function(node) {
      Severity: Major
      Found in app/assets/javascripts/iqvoc/entityselect.js - About 5 hrs to fix

        Method index has a Cognitive Complexity of 37 (exceeds 5 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 5 hrs 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_hierarchy has a Cognitive Complexity of 33 (exceeds 5 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 4 hrs 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

        Class Base has 33 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Concept::Base < ApplicationRecord
          attr_accessor :reverse_match_service
          self.table_name = 'concepts'
        
          class_attribute :default_includes
        Severity: Minor
        Found in app/models/concept/base.rb - About 4 hrs to fix

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

            def index
              authorize! :read, Concept::Base
              # TODO: requires a dedicated :search permission because this covers more
              # than just concepts
          
          
          Severity: Minor
          Found in app/controllers/search_results_controller.rb - About 3 hrs 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 24 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.single_query(params = {})
              query_str = build_query_string(params)
          
              scope = includes(:target).order(Arel.sql("LENGTH(#{Label::Base.table_name}.value), #{Label::Base.table_name}.value ASC"))
              languages = Array(params[:languages])
          Severity: Minor
          Found in app/models/labeling/skos/base.rb - About 3 hrs 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_rdf has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

            def build_rdf(document, subject)
              if annotations.any?
                subject.send(rdf_namespace).build_predicate(rdf_predicate) do |blank_node|
                  blank_node.Rdfs::comment(value, lang: language || nil) if value
                  annotations.order(:namespace, :predicate).each do |annotation|
          Severity: Minor
          Found in app/models/note/skos/base.rb - About 3 hrs 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_second_level_objects has a Cognitive Complexity of 21 (exceeds 5 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 2 hrs 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 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.single_query(params = {})
              query_str = build_query_string(params)
          
              scope = includes(:target).order(Arel.sql("LENGTH(#{Label::Base.table_name}.value), #{Label::Base.table_name}.value ASC"))
              languages = Array(params[:languages])
          Severity: Major
          Found in app/models/labeling/skos/base.rb - About 2 hrs to fix

            Method from_yaml has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def show
                get_concept
                authorize! :read, @concept
            
                if params[:full_consistency_check] && can?(:check_consistency, @concept)
            Severity: Major
            Found in app/controllers/concepts_controller.rb - About 2 hrs to fix

              File skos_importer.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class SkosImporter
                class_attribute :first_level_object_classes, :second_level_object_classes
                self.first_level_object_classes = [
                  Iqvoc::Concept.base_class,
                  Iqvoc::Collection.base_class
              Severity: Minor
              Found in app/aides/skos_importer.rb - About 2 hrs to fix

                Class Base has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Collection::Base < Concept::Base
                
                  Iqvoc::Collection.include_modules.each do |mod|
                    include mod
                  end
                Severity: Minor
                Found in app/models/collection/base.rb - About 2 hrs to fix

                  Function LanguageSelector has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  IQVOC.LanguageSelector = (function($) {
                  
                  "use strict";
                  
                  var getSelection, setSelection;
                  Severity: Major
                  Found in app/assets/javascripts/iqvoc/langselect.js - About 2 hrs to fix

                    Method merge has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def index
                        authorize! :read, Concept::Base
                        # TODO: requires a dedicated :search permission because this covers more
                        # than just concepts
                    
                    
                    Severity: Major
                    Found in app/controllers/search_results_controller.rb - About 2 hrs to fix

                      Method initialize has 51 lines of code (exceeds 25 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: Major
                      Found in app/models/ability.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language