Showing 219 of 2,584 total issues
Method read_response_domain
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def read_response_domain(node)
if node.name == 'CodeDomain'
cl = ::CodeList.find_by_identifier(
'urn',
extract_urn_identifier(node.at_xpath('./CodeListReference'))
- 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
rescue
if (label = child.at_xpath('./Label/Content')).nil?
cc_c.label = label
else
cc_c.label = 'Missing label'
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
elsif child.name == 'Loop'
cc_l = CcLoop.new(urn: extract_urn_identifier(child))
@instrument.cc_loops << cc_l
start_node = child.at_xpath('./InitialValue/Command/CommandContent')
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
rescue
cc_c.literal = 'Missing text'
- Create a ticketCreate a ticket
Method parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse
hash = {}
matchers = { question_item: './QuestionItem', category: './Category', code_list: './CodeList', instruction: './Instruction'}
@node.xpath('//Fragment').each do | n |
- 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
Consider simplifying this complex logical expression. Open
if(!isEmpty(topicId)) {
variableOptions = variableOptions.filter(opt => {
return (
get(opt.topic, 'id') == topicId ||
get(opt.resolved_topic, 'id') == topicId ||
- Create a ticketCreate a ticket
Function BuildContainer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const BuildContainer = (props) => {
let history = useHistory();
const { instrumentId, selectionPath = () => { }, heading = "Code Lists", itemId, itemType, objectType = "CodeList", stateKey = "codeLists", fetch = [], formRenderer = () => { }, defaultValues = { used_by: [], min_responses: 1, max_responses: 1 }} = props;
const { findSelectedItem = (items, itemId, itemType) => { return get(items, itemId, {}) }, listItemLabel = (item) => { return item.label }, listItemValue = (item) => { return item.used_by.length }, headingContent = (instrumentId) => { return '' } } = props;
- 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 ObjectStatusBar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const ObjectStatusBar = (props) => {
const {id, type} = props
const status = ObjectStatus(id, type)
if(!isEmpty(status) && !isNil(status.error)){
- 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 member_imports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def member_imports
imports = params[:imports].nil? ? [] : params[:imports]
head :ok, format: :json if imports.empty?
begin
imports.each do |import|
- 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 find_by_identifier
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_by_identifier(id_type, value)
cache_result = $redis.hget 'identifiers', id_type + ':' + value.to_s
if cache_result.nil?
Identifier.includes(:item).where(item_type: self.class.name).find_by_id_type_and_value(id_type, value)&.item
else
- 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 create_instructions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_instructions(instructions=[])
instructions.each do | instruction_hash |
urn = instruction_hash.fetch(:urn, '')
parsed_urn = parse_urn(urn)
if @instrument.prefix != parsed_urn[:instrument_prefix]
- 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 import
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def import
files = params[:files].nil? ? [] : params[:files]
options = {}
options[:prefix] = params[:instrument_prefix] if params.has_key? :instrument_prefix
options[:agency] = params[:instrument_agency] if params.has_key? :instrument_agency
- 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 build_loop_while
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_loop_while(cc)
command = ''
unless cc.end_val.nil?
command += cc.loop_var + ' < ' + cc.end_val
end
- 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 create_codes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_codes(codes, code_list)
codes.reverse.each do | code_hash |
code_hash[:code_list_id] = code_list.id
urn = code_hash.fetch(:urn, '')
category_urn = code_hash.delete(:category_urn)
- 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 member_imports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def member_imports
imports = params[:imports].nil? ? [] : params[:imports]
head :ok, format: :json if imports.empty?
begin
imports.each do |import|
- 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 create_code_lists
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_code_lists(code_lists=[])
code_lists.reverse.each do | code_list_hash |
urn = code_list_hash.fetch(:urn, '')
codes = code_list_hash.delete(:codes)
parsed_urn = parse_urn(urn)
- 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 too many return
statements within this function. Open
return (
<Button variant='outlined'>
<Link to={to}>{label}</Link>
</Button>
);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return { ...state, ...{ [key]: { error: true, errors: action.payload.error, errorMessage: '' } } }
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return <Route {...props} />;
- Create a ticketCreate a ticket