concord-consortium/lara

View on GitHub

Showing 418 of 830 total issues

File run.rb has 310 lines of code (exceeds 250 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 3 hrs to fix

    Method new_strategy has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.new_strategy(name,url,client_id,secret)
          site = url
          auth_url = "#{url}#{AuthorizeUrl}"
          access_token_url = "#{url}#{AccessTokenUrl}"
          class_name = "cc_portal_#{name.downcase}".classify
    Severity: Major
    Found in lib/concord/auth_portal.rb - About 3 hrs to fix

      Method handle_jwt_request has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        def handle_jwt_request(path)
          if params[:run_id]
            run = Run.find_by_id(params[:run_id])
            return error(404, "Run not found: #{params[:run_id]}") unless run
            return error(500, "Run has no remote_endpoint") unless run.remote_endpoint && !run.remote_endpoint.empty?
      Severity: Minor
      Found in app/controllers/api/v1/jwt_controller.rb - 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

      Function RuntimeComponent has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      export const RuntimeComponent: React.FC<Props> = ({initMessage}) => {
        const [uploading, setUploading] = useState<boolean>(false);
        const [attachments, setAttachments] = useState<UserAttachmentMap>({});
        const {setInteractiveState} = useInteractiveState<IInteractiveState>();
      
      
      Severity: Minor
      Found in lara-typescript/src/example-interactives/src/attachments/runtime.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

      Function initSort has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function initSort(table, cell, event){
                      if (table.isUpdating) {
                          // let any updates complete before initializing a sort
                          return setTimeout(function(){ initSort(table, cell, event); }, 50);
                      }
      Severity: Major
      Found in app/assets/javascripts/tablesorter.js - About 3 hrs to fix

        Function PluginAuthoring has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const PluginAuthoring: React.FC<PluginAuthoringProps> = (
          props: PluginAuthoringProps
          ) => {
          const { pageItem, authoringApiUrls, onUpdate, closeForm, wrappedItem } = props;
          const { data } = pageItem;
        Severity: Major
        Found in lara-typescript/src/section-authoring/components/plugin-authoring.tsx - About 3 hrs to fix

          Function base has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              jCarousel.base = function(pluginName) {
                  return {
                      version:  jCarousel.version,
                      _options:  {},
                      _element:  null,
          Severity: Major
          Found in app/assets/javascripts/jquery.jcarousel.js - About 3 hrs to fix

            Function setup has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        ts.setup = function(table, c) {
                            // if no thead or tbody, or tablesorter is already present, quit
                            if (!table || !table.tHead || table.tBodies.length === 0 || table.hasInitialized === true) {
                                return c.debug ? log('ERROR: stopping initialization! No table, thead, tbody or tablesorter has already been initialized') : '';
                            }
            Severity: Major
            Found in app/assets/javascripts/tablesorter.js - About 3 hrs to fix

              Class InteractivePagesController has 28 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Api::V1::InteractivePagesController < API::APIController
                layout false
                before_filter :set_interactive_page, except: [
                  :get_library_interactives_list,
                  :get_wrapping_plugins_list,
              Severity: Minor
              Found in app/controllers/api/v1/interactive_pages_controller.rb - About 3 hrs to fix

                Function SectionMoveDialog has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const SectionMoveDialog: React.FC = () => {
                  const { userInterface: { movingSectionId }, actions: { setMovingSectionId }} = React.useContext(UserInterfaceContext);
                  const { moveSection, currentPage } = usePageAPI();
                  const {
                    sections, selectedSectionId,

                  File customize.tsx has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import * as React from "react";
                  import { useState } from "react";
                  import { IManagedInteractive } from "./index";
                  import { ILibraryInteractive } from "../common/hooks/use-library-interactives";
                  import { ReadOnlyFormField } from "../common/components/read-only-form-field";

                    Function getHtmlFragment has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                value: function getHtmlFragment(callback) {
                                  var _this3 = this;
                    
                                  var $element = (0, _jquery2.default)(this.element);
                    
                    
                    Severity: Major
                    Found in app/assets/javascripts/shutterbug.js - About 3 hrs to fix

                      File interactive_page.rb has 297 lines of code (exceeds 250 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 3 hrs to fix

                        Function searchListenerTree has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function searchListenerTree(handlers, type, tree, i) {
                            if (!tree) {
                              return [];
                            }
                            var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
                        Severity: Major
                        Found in app/assets/javascripts/eventemitter2.js - About 3 hrs to fix

                          Class InteractiveRunState has 26 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class InteractiveRunState < ActiveRecord::Base
                            alias_method :original_json, :to_json  # make sure we can still generate json of the base model after including Answer
                            include Embeddable::Answer # Common methods for Answer models
                          
                            attr_accessible :interactive_id, :interactive_type, :run_id, :raw_data, :interactive, :run, :key, :metadata
                          Severity: Minor
                          Found in app/models/interactive_run_state.rb - About 3 hrs to fix

                            Function buildCache has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        function buildCache(table) {
                                            var cc, t, tx, v, i, j, k, $row, rows, cols, cacheTime,
                                                totalRows, rowData, colMax,
                                                c = table.config,
                                                $tb = c.$table.children('tbody'),
                            Severity: Major
                            Found in app/assets/javascripts/tablesorter.js - About 2 hrs to fix

                              File authoring-section.tsx has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import * as React from "react";
                              import { useEffect, useRef, useState } from "react";
                              import { DraggableProvided } from "react-beautiful-dnd";
                              import classNames from "classnames";
                              import { GripLines } from "../../shared/components/icons/grip-lines";

                                Function position has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    publicMethod.position = function (speed, loadedCallback) {
                                        var
                                        css,
                                        top = 0,
                                        left = 0,
                                Severity: Major
                                Found in app/assets/javascripts/jquery.colorbox.js - About 2 hrs to fix

                                  Function renderTabs has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    const renderTabs = () => {
                                      if (!libraryInteractive) {
                                        return undefined;
                                      }
                                  
                                  

                                    Method lookup has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def self.lookup(key, activity, user, portal, seq_id)
                                        if portal && portal.valid?
                                          if user
                                            # if the seq_id is set here, this is an un-handled state
                                            if seq_id
                                    Severity: Minor
                                    Found in app/models/run.rb - About 2 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language