codevise/pageflow

View on GitHub

Showing 451 of 1,081 total issues

Class VideoFile has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class VideoFile < ApplicationRecord
    include UploadableFile
    include MediaEncodingStateMachine
    include OutputSource

Severity: Minor
Found in app/models/pageflow/video_file.rb - About 3 hrs to fix

    File Wavesurfer.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import assign from 'deep-assign';
    import Measure from 'react-measure';
    
    

      Function reducer has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      export function reducer(state, action) {
        switch (action.type) {
          case SET_MODE:
            if (action.value === state.mode) {
              return state;

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

          _create: function() {
      
            var that = this,
                element = this.element,
                scroller;

        Function BeforeAfter has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function BeforeAfter(configuration) {
          const {
            isActive,
            load,
            before_label,

          File DraggableEditorView.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import I18n from 'i18n-js';
          import Marionette from 'backbone.marionette';
          import React, {useEffect, useReducer, useRef} from 'react';
          import ReactDOM from 'react-dom';
          import classNames from 'classnames';

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

            export const AudioPlayer = function(sources, options) {
              options = options || {};
            
              var codecMapping = {
                vorbis: 'audio/ogg',
            Severity: Major
            Found in package/src/frontend/AudioPlayer/AudioPlayer.js - About 2 hrs to fix

              Function Tooltip has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              export function Tooltip({
                area,
                contentElementId, portraitMode, configuration, visible, active,
                panZoomEnabled, imageFile, containerRect, keepInViewport, floatingStrategy,
                aboveNavigationWidgets,
              Severity: Minor
              Found in entry_types/scrolled/package/src/contentElements/hotspots/Tooltip.js - 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

              Function Counter has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              export function Counter({configuration, contentElementId, contentElementWidth, sectionProps}) {
                const updateConfiguration = useContentElementConfigurationUpdate();
                const locale = useLocale();
                const {t} = useI18n({locale: 'ui'});
              
              
              Severity: Minor
              Found in entry_types/scrolled/package/src/contentElements/counter/Counter.js - 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

              Function Scroller has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              function Scroller({
                visibleIndex, setVisibleIndex,
                displayFullscreenToggle,
                customMargin,
                onFullscreenEnter, onFullscreenExit,

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

              export const Agent = function(userAgent) {
                return {
                  matchesSilk: function() {
                    return matches(/\bSilk\b/);
                  },
              Severity: Minor
              Found in package/src/frontend/browser/Agent.js - 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

              Function reducer has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function reducer(state, action) {
                const collectionName = action.payload.collectionName;
                const keyAttribute = action.payload.keyAttribute;
              
                switch (action.type) {
              Severity: Major
              Found in entry_types/scrolled/package/src/collections.js - About 2 hrs to fix

                Method build has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def build(entry)
                        embedded_index_table entry.revisions, :blank_slate_text => I18n.t('pageflow.admin.entries.no_revisions') do
                          scope(:publications)
                          scope(:publications_and_user_snapshots)
                          scope(:frozen)
                Severity: Major
                Found in app/views/components/pageflow/admin/revisions_tab.rb - About 2 hrs to fix

                  File collections.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import {useReducer} from 'react';
                  import {createSelector, createSelectorCreator, defaultMemoize} from 'reselect';
                  
                  const PREFIX = 'PAGEFLOW_SCROLLED_COLLECTION';
                  const RESET = `${PREFIX}_RESET`;
                  Severity: Minor
                  Found in entry_types/scrolled/package/src/collections.js - About 2 hrs to fix

                    File Hotspots.js has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, {useCallback, useMemo, useState} from 'react';
                    import classNames from 'classnames';
                    import {Composite, CompositeItem} from '@floating-ui/react';
                    
                    import {
                    Severity: Minor
                    Found in entry_types/scrolled/package/src/contentElements/hotspots/Hotspots.js - About 2 hrs to fix

                      Function MultiPlayer has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const MultiPlayer = function(pool, options) {
                        if (options.crossFade && options.playFromBeginning) {
                          throw 'pageflow.Audio.MultiPlayer: The options crossFade and playFromBeginning can not be used together at the moment.';
                        }
                      
                      
                      Severity: Minor
                      Found in package/src/frontend/media/MultiPlayer.js - 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

                      Function ExternalLink has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function ExternalLink(props) {
                        const [hideTooltip, setHideTooltip] = useState(true);
                        var {layout} = props.sectionProps;
                        const {t} = useI18n({locale: 'ui'});
                        const {isEditable, isSelected} = useContentElementEditorState();

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

                            def initialize(target_type_name = nil)
                              @target_type_name = target_type_name
                        
                              @paperclip_attachments_version = 'v1'
                              @paperclip_s3_root = 'main'
                        Severity: Major
                        Found in lib/pageflow/configuration.rb - About 2 hrs to fix

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

                          export default function Viewer({
                            imageFile, viewerRef, initialYaw, initialPitch, hidePanoramaIndicator, onReady, onFullscreen
                          }) {
                            const elRef = useRef();
                          
                          
                          Severity: Minor
                          Found in entry_types/scrolled/package/src/frontend/Panorama/Viewer.js - 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

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

                            componentDidUpdate(prevProps) {
                              // update audioFile
                              if (this.props.audioFile !== this.props.audioFile) {
                                this._loadAudio(this.props.audioFile, this.props.audioPeaks);
                              }

                          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