Showing 1,475 of 2,432 total issues
Method apply_nested_records
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def apply_nested_records(json, new_record = false)
self.remove_nested_records if !new_record
self.class.nested_records.each do |nested_record|
# Read the subrecords from our JSON blob and fetch or create
- 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 set_up_base_permissions
has 196 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.set_up_base_permissions
if not Repository[:repo_code => Repository.GLOBAL]
Repository.create(:repo_code => Repository.GLOBAL,
:name => "Global repository",
:json_schema_version => JSONModel(:repository).schema_version,
File bootstrap-accessibility.js
has 492 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* ========================================================================
* Extends Bootstrap v3.1.1
* Copyright (c) <2015> PayPal
File trollop.rb
has 490 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'date'
module Trollop
VERSION = "2.0"
Method archdesc_dates
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def archdesc_dates
unless @archdesc_dates
results = []
dates = self.dates || []
dates.each do |date|
- 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 initImportJobForm
has 188 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initImportJobForm = function () {
var supportsHTML5MultipleFileInput = function () {
var input = document.createElement('input');
input.setAttribute('multiple', 'true');
return input.multiple === true;
Method process_row
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def process_row(row_hash = nil)
#This allows the processing of a single row
if (!row_hash.nil?)
@row_hash = row_hash
end
- 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 ClipboardAction
has 185 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ClipboardAction = (function () {
/**
* @param {Object} options
*/
function ClipboardAction(options) {
Method defaults
has 182 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.defaults
{
'show_suppressed' => false,
'publish' => false,
'rde_sort_alpha' => true,
File rest.rb
has 465 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RESTHelpers
include JSONModel
Method serialize_subnotes
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def serialize_subnotes(subnotes, xml, fragments, include_p = true)
subnotes.each do |sn|
next if sn["publish"] === false && !@include_unpublished
audatt = sn["publish"] === false ? {:audience => 'internal'} : {}
- 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 serialize_subnotes
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def serialize_subnotes(subnotes, xml, fragments, include_p = true)
subnotes.each do |sn|
next if sn["publish"] === false && !@include_unpublished
audatt = sn["publish"] === false ? {:audience => 'internal'} : {}
- 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 migrate_langmaterial_notes
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def migrate_langmaterial_notes
# Find all langmaterial notes
self[:note].each do |note_id|
if note_id[:notes].lit.include?('langmaterial')
- 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 ApplicationController
has 50 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper :all
Class IndexerCommon
has 50 methods (exceeds 20 allowed). Consider refactoring. Open
class IndexerCommon
include JSONModel
@@record_types = IndexerCommonConfig.record_types
Method add_pref_columns
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def add_pref_columns(models)
models = Array(models) unless models.is_a? Array
added = []
skipped = []
if models.length > 1
- 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 TreeLinkingModal
has 172 lines of code (exceeds 25 allowed). Consider refactoring. Open
function TreeLinkingModal(config) {
var self = this;
self.config = config;
self.$modal = AS.openCustomModal(
'linkResourceModal',
Method map_oai_record
has 166 lines of code (exceeds 25 allowed). Consider refactoring. Open
def map_oai_record(record)
jsonmodel = record.jsonmodel_record
result = Nokogiri::XML::Builder.new do |xml|
xml['oai_dcterms'].dcterms('xmlns:dcterms' => 'http://purl.org/dc/terms/',
Method serialize_languages
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def serialize_languages(languages, xml, fragments)
lm = []
language_notes = languages.map {|l| l['notes']}.compact.reject {|e| e == [] }.flatten
if !language_notes.empty?
language_notes.each do |note|
- 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 cleanup_params_for_schema
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def cleanup_params_for_schema(params_hash, schema)
# We're expecting a HashWithIndifferentAccess...
if params_hash.respond_to?(:to_unsafe_hash)
params_hash = params_hash.to_unsafe_hash
end
- 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"