codevise/pageflow

View on GitHub

Showing 1,024 of 1,024 total issues

File rollup.config.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import alias from '@rollup/plugin-alias';
import jst from 'rollup-plugin-jst';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from '@rollup/plugin-replace';
Severity: Minor
Found in rollup.config.js - About 3 hrs to fix

    Function withVisibilityWatching has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function withVisibilityWatching(Component) {
      return class VisibilityWatcher extends React.Component {
        constructor(props) {
          super(props);
    
    

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

    export const DomOrderScrollNavigator = function(slideshow, entryData) {
      this.getLandingPage = function(pages) {
        return pages.first();
      };
    
    

    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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        SubsetCollection.prototype.constructor.call(this, {
          parent: options.chapters,
          parentModel: storyline,
    
          filter: function(item) {
    package/src/editor/collections/ChapterPagesCollection.js on lines 11..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 100.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        SubsetCollection.prototype.constructor.call(this, {
          parent: options.pages,
          parentModel: chapter,
    
          filter: function(item) {
    Severity: Major
    Found in package/src/editor/collections/ChapterPagesCollection.js and 1 other location - About 3 hrs to fix
    package/src/editor/collections/StorylineChaptersCollection.js on lines 11..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 100.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File PageThumbnail-spec.jsx has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {PageThumbnail} from '../PageThumbnail';
    
    import fileExistsFn from 'support/fileExistsFn';
    import {shallow} from 'enzyme';
    
    

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        it('includes high variant if high bandwidth', () => {
          const videoFile = {urls: {
            'medium': 'http://example.com/4/medium.mp4',
            'high': 'http://example.com/4/high.mp4'
          }};
      entry_types/paged/packages/pageflow-paged-react/src/media/components/VideoFilePlayer/__spec__/sources-spec.js on lines 48..57

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 99.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        it('includes medium variant if not high bandwidth', () => {
          const videoFile = {urls: {
            'medium': 'http://example.com/4/medium.mp4',
            'high': 'http://example.com/4/high.mp4'
          }};
      entry_types/paged/packages/pageflow-paged-react/src/media/components/VideoFilePlayer/__spec__/sources-spec.js on lines 37..46

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 99.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        class EntryPolicy < ApplicationPolicy
          class Scope < Scope
            attr_reader :user, :scope, :query
      
            def initialize(user, scope)
      Severity: Minor
      Found in app/policies/pageflow/entry_policy.rb - About 3 hrs to fix

        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

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

            class Revision < ApplicationRecord
              include SerializedConfiguration
          
              PAGE_ORDER = [
                'pageflow_storylines.position ASC',
          Severity: Minor
          Found in app/models/pageflow/revision.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';
            
            

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                it(
                  'falls back to fullhd quality if best quality is forced and 4k not available',
                  () => {
                    const videoFile = {urls: {
                      'high': 'http://example.com/4/high.mp4',
              entry_types/paged/packages/pageflow-paged-react/src/media/components/VideoFilePlayer/__spec__/sources-spec.js on lines 172..185

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 98.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                it(
                  'uses fullhd quality if fullhd quality is forced and 4k not available',
                  () => {
                    const videoFile = {urls: {
                      'high': 'http://example.com/4/high.mp4',
              entry_types/paged/packages/pageflow-paged-react/src/media/components/VideoFilePlayer/__spec__/sources-spec.js on lines 130..143

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 98.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  _initNearBottomEvents: function() {
                    this.iscroll.on('scroll', _.bind(this._triggerNearBottomEvents, this));
                    this.iscroll.on('scrollEnd', _.bind(this._triggerNearBottomEvents, this));
                    this.iscroll.on('afterkeyboard', _.bind(this._triggerNearBottomEvents, this));
                  },
              entry_types/paged/packages/pageflow-paged/src/frontend/Slideshow/scrollerWidget.js on lines 126..130
              entry_types/paged/packages/pageflow-paged/src/frontend/Slideshow/scrollerWidget.js on lines 142..146

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  _initNearTopEvents: function() {
                    this.iscroll.on('scroll', _.bind(this._triggerNearTopEvents, this));
                    this.iscroll.on('scrollEnd', _.bind(this._triggerNearTopEvents, this));
                    this.iscroll.on('afterkeyboard', _.bind(this._triggerNearTopEvents, this));
                  },
              entry_types/paged/packages/pageflow-paged/src/frontend/Slideshow/scrollerWidget.js on lines 126..130
              entry_types/paged/packages/pageflow-paged/src/frontend/Slideshow/scrollerWidget.js on lines 136..140

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  const props = {
                    page: {
                      imageId: 5,
                      backgroundType: 'video'
                    },
              entry_types/paged/packages/pageflow-paged-react/src/components/__spec__/PageThumbnail-spec.jsx on lines 197..220

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  const props = {
                    page: {
                      imageId: 5,
                      backgroundType: 'image'
                    },
              entry_types/paged/packages/pageflow-paged-react/src/components/__spec__/PageThumbnail-spec.jsx on lines 228..251

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  it('unmutes the player when muted changes to false', () => {
                    const {FilePlayer, mockPlayer} = setup();
              
                    const wrapper = mount(<FilePlayer {...requiredProps}
                                                      muted={true} />);
              entry_types/paged/packages/pageflow-paged-react/src/media/components/__spec__/createFilePlayer-spec.jsx on lines 273..282

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  _initMoveEvents: function() {
                    this.iscroll.on('mousewheelup', _.bind(this._triggerMoveEvent, this));
                    this.iscroll.on('mousewheeldown', _.bind(this._triggerMoveEvent, this));
                    this.iscroll.on('afterkeyboard', _.bind(this._triggerMoveEvent, this));
                  },
              entry_types/paged/packages/pageflow-paged/src/frontend/Slideshow/scrollerWidget.js on lines 136..140
              entry_types/paged/packages/pageflow-paged/src/frontend/Slideshow/scrollerWidget.js on lines 142..146

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language