concord-consortium/lara

View on GitHub

Showing 418 of 830 total issues

File logger.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function LoggerUtils(logger) {
  this._logger = logger;
};

LoggerUtils.instances = {};
Severity: Minor
Found in app/assets/javascripts/logger.js - About 2 hrs to fix

    Function 2 has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    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).
    Severity: Major
    Found in public/demo-interactives/iframe-phone.js - About 2 hrs to fix

      Function 2 has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      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).
      Severity: Major
      Found in app/assets/javascripts/iframe-phone.js - About 2 hrs to fix

        Class ManagedInteractive has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class ManagedInteractive < ActiveRecord::Base
          include BaseInteractive
          include Embeddable
          include HasAspectRatio
        
        
        Severity: Minor
        Found in app/models/managed_interactive.rb - About 2 hrs to fix

          Function emit has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            EventEmitter.prototype.emit = function() {
          
              this._events || init.call(this);
          
              var type = arguments[0];
          Severity: Major
          Found in app/assets/javascripts/eventemitter2.js - About 2 hrs to fix

            Function SidebarPanel has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            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

                  function launch(target) {
                      if (!closing) {
              
                          element = target;
              
              
              Severity: Major
              Found in app/assets/javascripts/jquery.colorbox.js - About 2 hrs to fix

                Function SectionItemMoveDialog has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                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("");

                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

                import { generateRuntimePluginContext,
                         IEmbeddableContextOptions,
                         IPluginRuntimeContextOptions,
                         IPluginAuthoringContextOptions,
                         generateAuthoringPluginContext} from "./plugin-context";
                Severity: Minor
                Found in lara-typescript/src/plugins/plugin-context.spec.ts - About 2 hrs to fix

                  Function addPopup has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  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");
                    }
                  Severity: Major
                  Found in lara-typescript/src/plugin-api/popup.ts - About 2 hrs to fix

                    Function InteractiveAuthoring has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    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

                          var slideshow = (function(){
                              var active,
                                  className = prefix + "Slideshow_",
                                  click = "click." + prefix,
                                  timeOut;
                      Severity: Major
                      Found in app/assets/javascripts/jquery.colorbox.js - About 2 hrs to fix

                        Function addSidebar has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        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;
                          }
                        Severity: Major
                        Found in lara-typescript/src/plugin-api/sidebar.ts - About 2 hrs to fix

                          Function ManagedInteractiveAuthoring has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const ManagedInteractiveAuthoring: React.FC<Props> = (props) => {
                            const {
                              libraryInteractive,
                              managedInteractive,
                              defaultClickToPlayPrompt,

                          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

                          function interactive_form_helper(interactive) {
                          
                            function el(prefix) {
                              var selector = "#" + prefix + "_" + (interactive.id ? interactive.id : "");
                              return $(selector);
                          Severity: Major
                          Found in app/assets/javascripts/interactive-form-helper.js - About 2 hrs to fix

                            File item-edit-dialog.tsx has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                            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";
                            Severity: Minor
                            Found in lara-typescript/src/section-authoring/components/item-edit-dialog.tsx - About 2 hrs to fix

                              Class LightweightActivity has 23 methods (exceeds 20 allowed). Consider refactoring.
                              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
                              Severity: Minor
                              Found in app/models/lightweight_activity.rb - About 2 hrs to fix

                                Class ApplicationController has 23 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                class ApplicationController < ActionController::Base
                                
                                  # Run authorization on all actions
                                  # check_authorization
                                  protect_from_forgery
                                Severity: Minor
                                Found in app/controllers/application_controller.rb - About 2 hrs to fix

                                  Function PreviewLinks has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    (props: IPreviewLinksProps) => {
                                  
                                    const { previewLinks } = props;
                                    const [ previewLink, setPreviewLink ] = useState<string|false>(false);
                                    const [ previewer, setPreviewer ] = useState<string|undefined>("");
                                  Severity: Major
                                  Found in lara-typescript/src/section-authoring/components/preview-links.tsx - About 2 hrs to fix

                                    Function applyWidget has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                    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 + ' ',
                                    Severity: Major
                                    Found in app/assets/javascripts/tablesorter.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language