codevise/pageflow

View on GitHub

Showing 392 of 1,004 total issues

Function handleMessage has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  handleMessage(message) {
    const postMessage = message => {
      this.iframeWindow.postMessage(message, window.location.origin);
    };

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

  onRender() {
    this.externalLink = new Backbone.Model();
    this.externalLink.modelName = 'externalLink';

    this.ui.urlContainer.prepend(

    Function fileTypes has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      fileTypes: function(fn) {
        var fileTypes = new FileTypes();
        var fileTypesSetupArray = [];
    
        var builder = {
    Severity: Major
    Found in package/src/testHelpers/factories.js - About 2 hrs to fix

      Function volumeBinding has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const volumeBinding = function(player, settings, options) {
        options = options || {};
      
        var originalPlay = player.play;
        var originalPause = player.pause;
      Severity: Major
      Found in package/src/frontend/mediaPlayer/volumeBinding.js - About 2 hrs to fix

        Function ExternalLink has 58 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();

          Function save has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            save: function() {
              var publishedUntil = null;
          
              if (this.$el.hasClass('publishing')) {
                return;
          Severity: Major
          Found in package/src/editor/views/PublishEntryView.js - About 2 hrs to fix

            Function PageTypeRegistry has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function PageTypeRegistry() {
              const pageTypes = [];
            
              this.register = function(name, {component, reduxModules = [], ...options}) {
                if (!component) {

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

            export function moveContentElement(entry, contentElement, {range, sibling, at, splitPoint}) {
              const sourceBatch = new Batch(entry, contentElement.section);
            
              // If we move content elements between sections, merges will need to
              // be performed in the section where the content element came from.

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

            export function sources(videoFile, quality = 'auto') {
              if (typeof window !== 'undefined') {
                if (!browser.has('video')) {
                  return [];
                }
            Severity: Minor
            Found in entry_types/scrolled/package/src/frontend/VideoPlayer/sources.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 configurationEditor has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              configurationEditor() {
                migrateLegacyAutoplay(this.model);
            
                this.tab('general', function() {
                  this.input('id', FileInputView, {

              Function Visited has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const Visited = function(entryId, pages, events, cookies) {
                var cookieName = '_pageflow_visited';
              
                var unvisitedPages = [];
              
              
              Severity: Major
              Found in entry_types/paged/packages/pageflow-paged/src/frontend/Visited.js - About 2 hrs to fix

                Function exampleContentElements has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function exampleContentElements(sectionId) {
                    if (layout === 'center') {
                      return [
                        exampleHeading({sectionId, text: 'Content element widths center', width: contentElementWidths.xl}),
                        ...[3, 2, 1, 0, -1, -2, -3].flatMap(width => [

                  Function Test has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function Test() {
                    const file = useFile({collectionName: 'audioFiles',permaId: filePermaId('audioFiles', 'quicktime_jingle')});
                    const ref = useRef();
                    const audioElement = useRef();
                  
                  

                    File factories.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import Backbone from 'backbone';
                    import _ from 'underscore';
                    
                    import {
                      EditorApi,
                    Severity: Minor
                    Found in package/src/testHelpers/factories.js - About 2 hrs to fix

                      Function Lazy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const Lazy = function(template, options) {
                        var placeholder = $('<span class="video_placeholder" />'),
                            that = this,
                            readyCallbacks = new $.Callbacks(),
                            disposeTimeout, videoTag, videoPlayer, html;

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

                      export function modelLifecycleTrackingView({classNames}) {
                        return {
                          events: {
                            [`click .${classNames.retryButton}`]: function() {
                              editor.failures.retry();
                      Severity: Minor
                      Found in package/src/editor/views/mixins/modelLifecycleTrackingView.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 prebuffering has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const prebuffering = function(player) {
                        let prebufferPromiseReject;
                      
                        player.isBufferedAhead = function(delta, silent) {
                          // video.js only gives us one time range starting from 0 here. We
                      Severity: Minor
                      Found in package/src/frontend/VideoPlayer/prebuffering.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 constructor has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        constructor: function(options) {
                          var adding = false;
                          var sorting = false;
                          var parentSorting = false;
                      
                      
                      Severity: Major
                      Found in package/src/editor/collections/SubsetCollection.js - About 2 hrs to fix

                        File createReducer.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import {
                          PLAY, PLAYING, PLAY_FAILED, PAUSE, PAUSED, SCRUB_TO, SEEK_TO,
                          FADE_OUT_AND_PAUSE, PLAY_AND_FADE_IN,
                          CHANGE_VOLUME_FACTOR,
                          PREBUFFER, PREBUFFERED,

                          File createSaga-spec.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import createSaga, {createMiddleware} from '../createSaga';
                          import createReducer from '../createReducer';
                          import createItemSelector from '../createItemSelector';
                          import {reset, add, remove} from '../actions';
                          
                          
                            Severity
                            Category
                            Status
                            Source
                            Language