Showing 418 of 830 total issues
File logger.js
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
function LoggerUtils(logger) {
this._logger = logger;
};
LoggerUtils.instances = {};
Function 2
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./structured-clone":4}],2:[function(require,module,exports){
var ParentEndpoint = require('./parent-endpoint');
var getIFrameEndpoint = require('./iframe-endpoint');
// Not a real UUID as there's an RFC for that (needed for proper distributed computing).
Function 2
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./structured-clone":4}],2:[function(require,module,exports){
var ParentEndpoint = require('./parent-endpoint');
var getIFrameEndpoint = require('./iframe-endpoint');
// Not a real UUID as there's an RFC for that (needed for proper distributed computing).
Class ManagedInteractive
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ManagedInteractive < ActiveRecord::Base
include BaseInteractive
include Embeddable
include HasAspectRatio
Function emit
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
EventEmitter.prototype.emit = function() {
this._events || init.call(this);
var type = arguments[0];
Function SidebarPanel
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const SidebarPanel = (props: ISidebarPanelProps) => {
const { updateSettingsFunction } = props;
const [editMode, setEditMode] = React.useState(false);
const [title, setTitle] = React.useState(props.title);
const [content, setContent] = React.useState(props.content);
Function launch
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function launch(target) {
if (!closing) {
element = target;
Function SectionItemMoveDialog
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
export const SectionItemMoveDialog: React.FC = () => {
const { moveItem, getSections } = usePageAPI();
const { userInterface: {movingItemId}, actions: {setMovingItemId}} = React.useContext(UserInterfaceContext);
const [selectedColumn, setSelectedColumn] = useState(SectionColumns.PRIMARY);
const [selectedOtherItemId, setSelectedOtherItemId] = useState("");
- 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
File plugin-context.spec.ts
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { generateRuntimePluginContext,
IEmbeddableContextOptions,
IPluginRuntimeContextOptions,
IPluginAuthoringContextOptions,
generateAuthoringPluginContext} from "./plugin-context";
Function addPopup
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const addPopup = (_options: IPopupOptions): IPopupController => {
const options = $.extend({}, ADD_POPUP_DEFAULT_OPTIONS, _options);
if (!options.content) {
throw new Error("LARA.addPopup - content option is required");
}
Function InteractiveAuthoring
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const InteractiveAuthoring: React.FC<Props> = (props) => {
const {interactive, onAuthoredStateChange, onLinkedInteractivesChange, allowReset, authoringApiUrls} = props;
const [authoringSupported, setAuthoringSupported] = useState(false);
const [authoredState, setAuthoredState] = useState<object|null>(
typeof interactive.authored_state === "string"
Function slideshow
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var slideshow = (function(){
var active,
className = prefix + "Slideshow_",
click = "click." + prefix,
timeOut;
Function addSidebar
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const addSidebar = (_options: ISidebarOptions): ISidebarController => {
const options = $.extend({}, ADD_SIDEBAR_DEFAULT_OPTIONS, _options);
if (options.icon === "default") {
options.icon = $("<i class='default-icon fa fa-arrow-circle-left'>")[0] as string & HTMLElement;
}
Function ManagedInteractiveAuthoring
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
export const ManagedInteractiveAuthoring: React.FC<Props> = (props) => {
const {
libraryInteractive,
managedInteractive,
defaultClickToPlayPrompt,
- 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 interactive_form_helper
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function interactive_form_helper(interactive) {
function el(prefix) {
var selector = "#" + prefix + "_" + (interactive.id ? interactive.id : "");
return $(selector);
File item-edit-dialog.tsx
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as React from "react";
import { useEffect, useCallback, useState } from "react";
import { ISectionItem, ITextBlockData } from "../api/api-types";
import { Modal, ModalButtons } from "../../shared/components/modal/modal";
import { TextBlockEditForm } from "./text-block-edit-form";
Class LightweightActivity
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class LightweightActivity < ActiveRecord::Base
include Publishable # defines methods to publish to portals
include PublicationStatus # defines publication status scopes and helpers
include FixedWidthLayout # defines fixed width options
include Accessible # defines font options
Class ApplicationController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationController < ActionController::Base
# Run authorization on all actions
# check_authorization
protect_from_forgery
Function PreviewLinks
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(props: IPreviewLinksProps) => {
const { previewLinks } = props;
const [ previewLink, setPreviewLink ] = useState<string|false>(false);
const [ previewer, setPreviewer ] = useState<string|undefined>("");
Function applyWidget
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ts.applyWidget = function(table, init) {
table = $(table)[0]; // in case this is called externally
var c = table.config,
wo = c.widgetOptions,
tableClass = ' ' + c.table.className + ' ',