codevise/pageflow

View on GitHub

Showing 451 of 1,081 total issues

Method call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def call(image_file, entry:)
      {
        default: {
          desktop: image_file.ready? ? image_file.attachment.url(desktop_style(entry)) : '',
          mobile: image_file.ready? ? image_file.attachment.url(:medium) : ''
Severity: Minor
Found in app/models/pageflow/image_file_css_background_image_urls.rb - About 45 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 allocatePlayer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  allocatePlayer({
    playerType, playerId, playsInline, mediaEventsContextData,
    hooks, poster, loop = false, controls = false, altText,
    onRelease
  }) {
Severity: Minor
Found in package/src/frontend/media/MediaPool.js - About 45 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

Method navigation_bar_css_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def navigation_bar_css_class(entry, options = {})
      [
        options[:class],
        entry.home_button.enabled? ? 'with_home_button' : nil,
        entry.overview_button.enabled? ? 'with_overview_button' : nil,
Severity: Minor
Found in app/helpers/pageflow/navigation_bar_helper.rb - About 45 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

Method build_folder_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def build_folder_list(folders)
        ul(class: 'folders') do
          folders.each do |folder|
            li('data-id' => folder.id) do
              text_node(link_to_folder(folder))
Severity: Minor
Found in app/views/components/pageflow/admin/grouped_folder_list.rb - About 45 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

Consider simplifying this complex logical expression.
Open

  if (((index === 0 || index >= 6) && position[0] > startPoints[0][0]) ||
      (index >= 2 && index <= 4 && position[0] < startPoints[0][0])) {
    index = (10 - index) % 8;
  }

    Consider simplifying this complex logical expression.
    Open

      if ((index >= 0 && index <= 3 && position[1] > startPoints[0][1]) ||
          (index >= 4 && index <= 6 && position[1] < startPoints[0][1])){
        index = 6 - index;
      }

      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 (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) ||

          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

                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

                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

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

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

                  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

                      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 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 deleteCharacter has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

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

                            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

                              Severity
                              Category
                              Status
                              Source
                              Language