Showing 219 of 2,583 total issues
Method V3_2
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def V3_2(seq_id)
if seq_id.is_a? ::CcSequence
cc = seq_id
else
cc = ::CcSequence.find seq_id
- Create a ticketCreate a ticket
Method all
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def all
instruments = Rails.cache.fetch('instruments.json&#{auth_token}', version: Instrument.maximum(:updated_at).to_i) do
connection = ActiveRecord::Base.connection
sql = %|
SELECT instruments.id, instruments.agency, instruments.version, instruments.prefix, instruments.label, instruments.slug, instruments.study, instruments.signed_off, COUNT(DISTINCT(control_constructs.id)) as ccs, COUNT(DISTINCT(qv_mappings.id)) as qvs
- Create a ticketCreate a ticket
Method perform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(id)
begin
exp = Exporters::XML::DDI::InstrumentComplete.new
exp.add_root_attributes
i = ::Instrument.find(id)
- Create a ticketCreate a ticket
Function generateButtons
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const generateButtons = (node, path) => {
var buttons = []
if (canHaveChildren(node)) {
const newNode = {
title: `Click to select construct type`,
- Create a ticketCreate a ticket
Method perform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(id)
begin
exp = Exporters::XML::DDI::Instrument.new
exp.add_root_attributes
i = ::Instrument.find(id)
- Create a ticketCreate a ticket
Method find_nearest_parent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_nearest_parent(target_class)
columns = ['id', 'parent_id', 'construct_id', 'construct_type']
columns_joined = columns.join(',')
sql =
<<-SQL
- Create a ticketCreate a ticket
Function find
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
find: (type, id) => {
if (type === 'CcLoop') {
item = get(cc_loops, id.toString(), {})
item.type = 'loop'
}
- Create a ticketCreate a ticket
Method V3_2
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def V3_2(qc_id)
if qc_id.is_a? ::CcQuestion
cc = qc_id
else
cc = ::CcQuestion.find qc_id
- Create a ticketCreate a ticket
Method format_output_hash
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def format_output_hash(variables)
vars = get_variables
questions = get_questions(variables.map{|v|v["questions"]}.flatten.uniq)
topics = get_topics(variables.map{|v|v["sources_topic"]}.flatten.uniq + variables.map{|v|v["topic"]}.flatten.uniq)
- Create a ticketCreate a ticket
Function statuses
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const statuses = (state = {}, action) => {
var key;
switch (action.type) {
- Read upRead up
- Create a ticketCreate a ticket
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 V3_2
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def V3_2(qitem_id)
@klass = ::QuestionItem
super do |qitem, qi|
build_response_domain = lambda do |rd|
- Read upRead up
- Create a ticketCreate a ticket
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_question
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_question(object, &block)
if block.call object
if params.has_key? :instruction
object.instruction = params[:instruction]
object.save!
- Read upRead up
- Create a ticketCreate a ticket
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 ObjectFinder
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const ObjectFinder = (instrumentId, type, id) => {
const sequences = useSelector(state => state.cc_sequences);
const cc_sequences = get(sequences, instrumentId, {})
const statements = useSelector(state => state.cc_statements);
const cc_statements = get(statements, instrumentId, {})
- Read upRead up
- Create a ticketCreate a ticket
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 deeply nested control flow statements. Open
if(params.subtype === 'question_items'){
crumbs.push(
{
text: 'Question Items',
link: url(routes.instruments.instrument.build.questionItems.all, { instrument_id: instrumentId })
- Create a ticketCreate a ticket
Function ObjectFinder
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const ObjectFinder = (instrumentId, type, id) => {
const sequences = useSelector(state => state.cc_sequences);
const cc_sequences = get(sequences, instrumentId, {})
const statements = useSelector(state => state.cc_statements);
const cc_statements = get(statements, instrumentId, {})
- Read upRead up
- Create a ticketCreate a ticket
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 CcQuestionForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const CcQuestionForm = (props) => {
const {ccQuestion, instrumentId, onChange, path, onDelete, onCreate} = props;
const questions = useSelector(state => state.cc_questions);
const cc_questions = get(questions, instrumentId, {})
- Read upRead up
- Create a ticketCreate a ticket
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 AuthButton
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const AuthButton = (props) => {
const isAuthUser = useSelector(state => state.auth.isAuthUser);
const user = useSelector(state => get(state.auth, 'user'));
- Read upRead up
- Create a ticketCreate a ticket
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 association_stats
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def association_stats
key = self.class.name + self.id.to_s + 'counts'
begin
counts = $redis.get key
rescue Redis::CannotConnectError
- Read upRead up
- Create a ticketCreate a ticket
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 deeply nested control flow statements. Open
if (label = child.at_xpath('./Label/Content')).nil?
cc_q.label = label
else
cc_q.label = 'Missing label'
end
- Create a ticketCreate a ticket
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(thing, options)
if thing.is_a? String
@doc = open(thing) { |f| Importers::TXT::TabDelimited.new(f) }
else
document = ::Document.find thing
- Read upRead up
- Create a ticketCreate a ticket
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"