codevise/pageflow

View on GitHub

Showing 407 of 1,024 total issues

Consider simplifying this complex logical expression.
Open

  if (!(at === 'before' && !range && sibling === after) &&
      !(at === 'after' && !range && sibling === before)) {
    sourceBatch.remove(contentElement);

    if (at === 'before') {

    Consider simplifying this complex logical expression.
    Open

        if (lastPosition.current &&
            position &&
            (lastPosition.current.top !== position.top ||
             lastPosition.current.left !== position.left ||
             lastPosition.current.width !== position.width ||
    Severity: Major
    Found in entry_types/scrolled/package/src/frontend/v1/MotifArea.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

        if (backdrop.color ||
            (backdrop.image && backdrop.image.toString().startsWith('#'))) {
          return {
            type: 'color',
            color: backdrop.color || backdrop.image
      Severity: Major
      Found in entry_types/scrolled/package/src/frontend/v2/useBackdrop.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

          else if (section.backdrop?.color ||
              (section.backdrop?.image && section.backdrop.image.toString().startsWith('#'))) {
            return {
              color: section.backdrop.color || section.backdrop.image
            }
        Severity: Major
        Found in entry_types/scrolled/package/src/frontend/v1/useBackdrop.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                if (deleteCharacter(editor, node, path, /\n\n/) ||
                    deleteCharacter(editor, node, path, new RegExp(`^\n`)) ||
                    deleteCharacter(editor, node, path, new RegExp(`${shy}\\s`)) ||
                    deleteCharacter(editor, node, path, new RegExp(`^${shy}`)) ||
                    deleteCharacter(editor, node, path, new RegExp(`\\s${shy}`), 1) ||

            Function initPlayer has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export function initPlayer(player, getPlayerState, playerActions, prevFileId, fileId) {

              Function deleteCharacter has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export function deleteCharacter(editor, node, path, regExp, offset = 0) {

                Function getMotifAreaPadding has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  contentRequiresPadding, transitions, motifAreaDimension, backdropContentElement, empty
                Severity: Minor
                Found in entry_types/scrolled/package/src/frontend/v1/useMotifAreaState.js - About 35 mins to fix

                  Function useScrollPosition has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  export function useScrollPosition(effect, deps, element, useWindow, wait) {
                  Severity: Minor
                  Found in entry_types/scrolled/package/src/frontend/useScrollPosition.js - About 35 mins to fix

                    Function className has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function className(isSectionSelected, transitionSelection, isHighlighted, isBackdropElementSelected, transitions) {

                      Function renderChapters has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function renderChapters(entryStructure,
                                              currentSectionIndex,
                                              setCurrentSection,
                                              scrollTargetSectionIndex,
                                              setScrollTargetSectionIndex) {
                      Severity: Minor
                      Found in entry_types/scrolled/package/src/frontend/Content.js - About 35 mins to fix

                        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def initialize(entry, template, configuration, property_base_name, options)
                        Severity: Minor
                        Found in app/helpers/pageflow/background_image_helper.rb - About 35 mins to fix

                          Function fadeSound has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            fadeSound: function(media, endVolume, fadeTime) {
                              var fadeResolution = 10;
                              var startVolume = media.volume();
                              var steps = fadeTime / fadeResolution;
                              var leap = (endVolume - startVolume) / steps;

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

                          export const History = function(slideshow, adapter) {
                            slideshow.on('slideshowchangepage', function(event, options) {
                              var hash = slideshow.currentPage().attr('id');
                          
                              if (options.back) {

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

                          function selfClear(items, index) {
                            const item = items[index];
                            const next = items[index + 1];
                          
                            if (supportsWrappingAroundFloats(item) ||
                          Severity: Minor
                          Found in entry_types/scrolled/package/src/frontend/layouts/Center.js - About 35 mins 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 comparator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            comparator: function(pageA, pageB) {
                              if (pageA.storylinePosition() > pageB.storylinePosition()) {
                                return 1;
                              }
                              else if (pageA.storylinePosition() < pageB.storylinePosition()) {
                          Severity: Minor
                          Found in package/src/editor/collections/PagesCollection.js - About 35 mins 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            update: function() {
                              if (this.model) {
                                var stage = this.model.currentStage();
                          
                                if (stage) {
                          Severity: Minor
                          Found in package/src/editor/views/FileThumbnailView.js - About 35 mins 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 FitViewport has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function FitViewport({file, aspectRatio, opaque, children, fill, scale = 1}) {
                            const {height} = useFullscreenDimensions();
                          
                            if (!file && !aspectRatio) return children;
                          
                          
                          Severity: Minor
                          Found in entry_types/scrolled/package/src/frontend/FitViewport.js - About 35 mins 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 translateStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            translateStatus: function(xhr) {
                              if (xhr.status === 401) {
                                return 'Sie müssen angemeldet sein, um diese Aktion auszuführen.';
                              }
                              else if (xhr.status === 403) {
                          Severity: Minor
                          Found in package/src/editor/models/mixins/failureTracking.js - About 35 mins 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            initialize: function() {
                              this.listenTo(this, 'change:main', function(model, value) {
                                if (value) {
                                  this.each(function(storyline) {
                                    if (storyline.isMain() && storyline !== model) {
                          Severity: Minor
                          Found in package/src/editor/collections/StorylinesCollection.js - About 35 mins 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