concord-consortium/lara

View on GitHub

Showing 418 of 830 total issues

File shutterbug.js has 417 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function webpackUniversalModuleDefinition(root, factory) {
  if(typeof exports === 'object' && typeof module === 'object')
    module.exports = factory(require("jquery"));
  else if(typeof define === 'function' && define.amd)
    define(["jquery"], factory);
Severity: Minor
Found in app/assets/javascripts/shutterbug.js - About 6 hrs to fix

    Function ManagedInteractiveAuthoring has 149 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function getLibraryInteractives has 149 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const getLibraryInteractives = () => {
        const libraryInteractives: ILibraryInteractive[] = [
          {
            id: 1,
            serializeable_id: "LibraryInteractive_1",
      Severity: Major
      Found in lara-typescript/src/section-authoring/api/mock-api-provider.ts - About 5 hrs to fix

        Function load has 148 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function load () {
                var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
        
                active = true;
        
        
        Severity: Major
        Found in app/assets/javascripts/jquery.colorbox.js - About 5 hrs to fix

          Function AuthoringSection has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

          export const AuthoringSection: React.FC<ISectionProps> = ({
            id,
            can_collapse_small,
            updateFunction,
            layout: initLayout = defaultLayout,

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

          export const MWInteractiveAuthoring: React.FC<Props> = (props) => {
            const {
              interactive,
              defaultClickToPlayPrompt,
              authoringApiUrls,
          Severity: Major
          Found in lara-typescript/src/page-item-authoring/mw-interactives/index.tsx - About 5 hrs to fix

            File api.ts has 387 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              IInitInteractive,
              ISupportedFeaturesRequest,
              INavigationOptions,
              IAuthInfo,
            Severity: Minor
            Found in lara-typescript/src/interactive-api-client/api.ts - About 5 hrs to fix

              Function InteractiveIframe has 132 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const InteractiveIframe: React.FC<Props> = (props) => {
                const {
                  src, width, initMsg, onAuthoredStateChange, onLinkedInteractivesChange, resetCount,
                  onSupportedFeaturesUpdate, authoredAspectRatio, authoredAspectRatioMethod,
                  authoringApiUrls

                File project-settings-form.tsx has 382 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import * as React from "react";
                import { useEffect, useState } from "react";
                import { SlateContainer, slateToHtml, htmlToSlate } from "@concord-consortium/slate-editor";
                import { IProject, IProjectAdmin } from "../types";
                import { camelToSnakeCaseKeys, snakeToCamelCaseKeys } from "../../shared/convert-keys";
                Severity: Minor
                Found in lara-typescript/src/projects/components/project-settings-form.tsx - About 5 hrs to fix

                  Class Run has 39 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Run < ActiveRecord::Base
                  
                    # NOTE: additional status flags should use bitmask values (0x2, 0x4, etc) so that multiple flags can be set at the same time
                    SentToReportServiceStatusFlag = 0x1
                  
                  
                  Severity: Minor
                  Found in app/models/run.rb - About 5 hrs to fix

                    Function SectionItemMoveDialog has 126 lines of code (exceeds 25 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("");

                      Method initialize has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def initialize(user)
                          # Define abilities for the passed in user here.
                          #
                          # See the wiki for details:
                          # https://github.com/ryanb/cancan/wiki/Defining-Abilities
                      Severity: Major
                      Found in app/models/ability.rb - About 4 hrs to fix

                        Function prep has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            publicMethod.prep = function (object) {
                                if (!open) {
                                    return;
                                }
                        
                        
                        Severity: Major
                        Found in app/assets/javascripts/jquery.colorbox.js - About 4 hrs to fix

                          Function ModalApiPlugin has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const ModalApiPlugin = (iframePhone: IFramePhoneStub) => {
                            const modalMap: Record<string, ModalState> = {};
                          
                            function showAlert(options: IShowAlert) {
                              const { style, title: _title, text } = options;
                          Severity: Major
                          Found in lara-typescript/src/interactive-api-lara-host/modal-api-plugin.ts - About 4 hrs to fix

                            Consider simplifying this complex logical expression.
                            Open

                                elsif user.is_project_admin?
                                  can :create, Glossary
                                  can :duplicate, Glossary
                                  can :export, Glossary
                                  can :import, Glossary
                            Severity: Critical
                            Found in app/models/ability.rb - About 4 hrs to fix

                              Method duplicate has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def duplicate(helper=nil, new_page_id=nil)
                                  helper = LaraDuplicationHelper.new if helper.nil?
                                  new_section = Section.new(to_hash)
                                  if new_page_id.nil?
                                    new_section.position = new_section.position + 1
                              Severity: Minor
                              Found in app/models/section.rb - 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 ModalApiPlugin has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const ModalApiPlugin = (iframePhone: IFramePhoneStub) => {
                                const modalMap: Record<string, ModalState> = {};
                              
                                function showAlert(options: IShowAlert) {
                                  const { style, title: _title, text } = options;
                              Severity: Minor
                              Found in lara-typescript/src/interactive-api-lara-host/modal-api-plugin.ts - 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

                              Class InteractivePage has 35 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class InteractivePage < ActiveRecord::Base
                                attr_accessible :lightweight_activity, :name, :position, :layout, :sidebar, :show_header,
                                                :show_sidebar, :show_interactive, :show_info_assessment, :toggle_info_assessment,
                                                :embeddable_display_mode, :sidebar_title, :is_hidden, :additional_sections, :is_completion
                              
                              
                              Severity: Minor
                              Found in app/models/interactive_page.rb - About 4 hrs to fix

                                File lightweight_activity.rb has 354 lines of code (exceeds 250 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 4 hrs to fix

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

                                  export const PageNavMenu: React.FC<IPageNavMenuProps> = ({
                                    pages,
                                    currentPageId,
                                    copyingPage,
                                    addPage,

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language