Showing 418 of 830 total issues
Method update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
set_page
input_params = get_interactive_params
# linked_interactives param follows ISetLinkedInteractives interface format. It isn't a regular attribute.
# It requires special treatment and should be removed from params before .update_attributes is called.
- 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 lookup_or_create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.lookup_or_create(sequence, user, portal)
if portal.valid? && user.nil?
raise ActiveRecord::RecordNotFound.new(
"user must be logged in to access a SequenceRun via portal parameters"
)
- 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 status
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def status(user)
last_publication = @publishable.last_publication(@portal)
if last_publication
return "publish_ok" if last_publication.success
return "publish_fail" if @publishable.portal_publications.where("portal_url = ? AND success = ?", @portal.publishing_url, true).size > 0
- 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 parse_interactive_select_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_interactive_select_value
# Parse the interactive form select input value
# Turn it into a type of interactive, or nil.
if interactive_select_value
_interactive = nil
- 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 can_use_index
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def can_use_index
# allow json reads of index by authors
if request.format.json?
raise CanCan::AccessDenied unless current_user.author? or current_user.admin?
else
- 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 generateEmbeddableRuntimeContext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const generateEmbeddableRuntimeContext = (context: IEmbeddableContextOptions): IEmbeddableRuntimeContext => {
return {
container: context.container,
laraJson: context.laraJson,
getInteractiveState: () => getInteractiveState(context.interactiveStateUrl),
- 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 loadInteractive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private loadInteractive(callback: () => void) {
if (!this.learnerStateSavingEnabled()) {
this.initInteractive();
callback();
return;
- 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 run_for_activity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_for_activity(activity)
run = runs.find {|run| run.activity_id == activity.id}
if run.nil?
if !sequence.lightweight_activities.exists?(activity.id)
# probably need a better exception here, technically it would be possible for an
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
respond_to do |format|
mca_params = params['embeddable_multiple_choice_answer']
unless mca_params
AdminEvent.create(kind: "missing_params", message: "missing embeddable_multiple_choice_answer param in params: #{params}")
- 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 export
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def export(item)
results = item.export
results[:type] = item.class.name
results[:ref_id] = key(item)
if item.respond_to?(:interactive) && item.interactive
- 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_sections
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_sections
authorize! :update, @interactive_page
param_sections = params['sections'] || [] # array of [{:id,:layout}]
old_sections = @interactive_page.sections
# Put them in the correct order:
- 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 AuthoringComponent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const AuthoringComponent: React.FC<Props> = ({initMessage}) => {
const [selectedAuthoringApi, setSelectedAuthoringApi] = useState<IAuthoringClientMessage>("getInteractiveList");
const [authoringApiError, setAuthoringApiError] = useState<any>();
const [authoringApiOutput, setAuthoringApiOutput] = useState<any>();
const { authoredState, setAuthoredState } = useAuthoredState<IAuthoredState>();
- 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 ReadOnlyFormField
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const ReadOnlyFormField: React.FC<Props> = ({ legend, value, inherit, inherited, inheritedValue, children }) => {
const renderValue = () => {
const renderedValue = inherit
? (inherited ? `${inheritedValue} (inherited)` : `${value} (customized)`)
- 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 InteractiveAuthoringPreview
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const InteractiveAuthoringPreview: React.FC<Props> = ({interactive, user}) => {
const authoredState = typeof interactive.authored_state === "string"
? interactive.authored_state
: JSON.stringify(interactive.authored_state || "{}");
const [prevAuthoredState, setPrevAuthoredState] = useState<string|null>(authoredState);
- 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 TextBlockEditForm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const TextBlockEditForm: React.FC<ITextBlockEditFormProps> = ({
pageItem, handleUpdateItemPreview
}: ITextBlockEditFormProps) => {
const { content, name, isCallout, isHalfWidth } = pageItem?.data as ITextBlockData;
const editorRef = useRef<any>(null);
- 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 removeListener
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public removeListener(message: ServerMessage, requestId?: number, callback?: iframePhone.ListenerCallback) {
if (this.listeners[message]) {
// When callback is provided, remove this particular callback.
// Otherwise try to use requestId.
if (callback) {
- 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 PageCopyDialog
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const PageCopyDialog: React.FC<IPageCopyDialogProps> = ({
pageId,
pages,
currentPageIndex,
selectedPosition: initSelectedPosition = "after",
- 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 findSection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const findSection = (pages: IPage[], sectionId: SectionId): ISection|null => {
for (const page of pages) {
for (const section of page.sections) {
if (section.id === sectionId) {
return section;
- 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"