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');
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
Function EntitySelector
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
IQVOC.EntitySelector = (function($) {
"use strict";
var EntitySelector = function(node) {
- Read upRead up
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) {
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
- Read upRead up
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'
- Read upRead up
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
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
- Read upRead up
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])
- Read upRead up
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|
- Read upRead up
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
- Read upRead up
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])
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)?
- Read upRead up
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)
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
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
Function LanguageSelector
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
IQVOC.LanguageSelector = (function($) {
"use strict";
var getSelection, setSelection;
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
- Read upRead up
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
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