concord-consortium/lara

View on GitHub

Showing 418 of 830 total issues

Function SectionItemPicker has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

export const SectionItemPicker: React.FC<IProps> = (props) => {
  const api = usePageAPI();
  const allItems = useMemo(() => {
    if (!api.getAllEmbeddables.data) {
      return undefined;

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 1 has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.iframePhone=e():"undefined"!=typeof global?global.iframePhone=e():"undefined"!=typeof self&&(self.iframePhone=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  var structuredClone = require('./structured-clone');
  var HELLO_INTERVAL_LENGTH = 200;
  var HELLO_TIMEOUT_LENGTH = 60000;

Severity: Major
Found in app/assets/javascripts/iframe-phone.js - About 4 hrs to fix

    Function 3 has 107 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      },{"./iframe-endpoint":1,"./parent-endpoint":3}],3:[function(require,module,exports){
      var structuredClone = require('./structured-clone');
    
      /**
        Call as:
    Severity: Major
    Found in app/assets/javascripts/iframe-phone.js - About 4 hrs to fix

      Function CustomizeManagedInteractive has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      export const CustomizeManagedInteractive: React.FC<Props> = (props) => {
        const { managedInteractive, libraryInteractive, defaultClickToPlayPrompt } = props;
        const {
          inherit_aspect_ratio_method,
          custom_aspect_ratio_method,

      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 ProjectSettingsForm has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      export const ProjectSettingsForm: React.FC<IProjectSettingsFormProps> = ({id}: IProjectSettingsFormProps) => {
        const newProject: IProject = {
          about: "",
          collaborators: "",
          collaboratorsImageUrl: "",
      Severity: Minor
      Found in lara-typescript/src/projects/components/project-settings-form.tsx - About 4 hrs to fix

      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 scroll has 106 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              scroll: function(target, animate, callback) {
                  if (this.animating) {
                      return this;
                  }
      
      
      Severity: Major
      Found in app/assets/javascripts/jquery.jcarousel.js - About 4 hrs to fix

        File iframe-saver.spec.ts has 343 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { mockIFramePhone, MockedIframePhoneManager, setAutoConnect } from "./mock-iframe-phone";
        import { IFrameSaver } from "./iframe-saver";
        import { IAttachmentUrlRequest } from "../interactive-api-host";
        
        const parentEl = document.createElement("iframe");
        Severity: Minor
        Found in lara-typescript/src/interactive-api-lara-host/iframe-saver.spec.ts - About 4 hrs to fix

          Function ParentEndpoint has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            module.exports = function ParentEndpoint(targetWindowOrIframeEl, targetOrigin, afterConnectedCallback) {
              var postMessageQueue = [];
              var connected = false;
              var handlers = {};
              var targetWindowIsIframeElement;
          Severity: Major
          Found in app/assets/javascripts/iframe-phone.js - About 4 hrs to fix

            Function 1 has 103 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.iframePhone=e():"undefined"!=typeof global?global.iframePhone=e():"undefined"!=typeof self&&(self.iframePhone=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
            var structuredClone = require('./structured-clone');
            var HELLO_INTERVAL_LENGTH = 200;
            var HELLO_TIMEOUT_LENGTH = 60000;
            
            
            Severity: Major
            Found in public/demo-interactives/iframe-phone.js - About 4 hrs to fix

              Function 3 has 102 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              },{"./iframe-endpoint":1,"./parent-endpoint":3}],3:[function(require,module,exports){
              var structuredClone = require('./structured-clone');
              
              /**
                Call as:
              Severity: Major
              Found in public/demo-interactives/iframe-phone.js - About 4 hrs to fix

                Function getAllEmbeddables has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const getAllEmbeddables = () => {
                  const allEmbeddables: Array<ISectionItemType|ISectionItemPlugin> = [
                    {
                      id: "1",
                      serializeable_id: "LibraryInteractive_1",
                Severity: Major
                Found in lara-typescript/src/section-authoring/api/mock-api-provider.ts - About 4 hrs to fix

                  Function ProjectList has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const ProjectList: React.FC = () => {
                    const [isAdmin, setIsAdmin] = useState(false);
                    const [projects, setProjects] = useState<IProject[]|null>(null);
                    const [projectsUpdated, setProjectsUpdated] = useState(false);
                    const [alertMessage, setAlertMessage] = useState<string|undefined>(undefined);
                  Severity: Major
                  Found in lara-typescript/src/projects/components/project-list.tsx - About 4 hrs to fix

                    Function ParentEndpoint has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function ParentEndpoint(targetWindowOrIframeEl, targetOrigin, afterConnectedCallback) {
                      var postMessageQueue = [];
                      var connected = false;
                      var handlers = {};
                      var targetWindowIsIframeElement;
                    Severity: Major
                    Found in public/demo-interactives/iframe-phone.js - About 3 hrs to fix

                      Function _prepare has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              _prepare: function(item) {
                                  var index  = this.index(item),
                                      idx    = index,
                                      wh     = this.dimension(item),
                                      clip   = this.clipping(),
                      Severity: Major
                      Found in app/assets/javascripts/jquery.jcarousel.js - About 3 hrs to fix

                        Function phoneAnswered has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private phoneAnswered() {
                            // Workaround IframePhone problem - phone_answered callback can be triggered multiple times:
                            // https://www.pivotaltracker.com/story/show/89602814
                            if (this.alreadySetup) {
                              return;
                        Severity: Major
                        Found in lara-typescript/src/interactive-api-lara-host/iframe-saver.ts - About 3 hrs to fix

                          Function IFrameEndpoint has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function IFrameEndpoint() {
                              var listeners = {};
                              var isInitialized = false;
                              var connected = false;
                              var postMessageQueue = [];
                          Severity: Major
                          Found in app/assets/javascripts/iframe-phone.js - About 3 hrs to fix

                            Function ItemEditDialog has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const ItemEditDialog: React.FC<IItemEditDialogProps> = ({
                              errorMessage
                              }: IItemEditDialogProps) => {
                              const {
                                userInterface: {editingItemId, wrappedItemId},
                            Severity: Minor
                            Found in lara-typescript/src/section-authoring/components/item-edit-dialog.tsx - About 3 hrs to fix

                            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 iframe-phone.js has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            //
                            // version 1.3.1
                            //
                            // NOTE: once the files like interactive_iframe.js.coffee that exist outside of lara-typescript use iframe-phone
                            //       this file needs to stay in the build (referenced in application.js)
                            Severity: Minor
                            Found in app/assets/javascripts/iframe-phone.js - About 3 hrs to fix

                              Function IFrameEndpoint has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function IFrameEndpoint() {
                                var listeners = {};
                                var isInitialized = false;
                                var connected = false;
                                var postMessageQueue = [];
                              Severity: Major
                              Found in public/demo-interactives/iframe-phone.js - About 3 hrs to fix

                                File iframe-phone.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.iframePhone=e():"undefined"!=typeof global?global.iframePhone=e():"undefined"!=typeof self&&(self.iframePhone=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
                                var structuredClone = require('./structured-clone');
                                var HELLO_INTERVAL_LENGTH = 200;
                                var HELLO_TIMEOUT_LENGTH = 60000;
                                
                                
                                Severity: Minor
                                Found in public/demo-interactives/iframe-phone.js - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language