codevise/pageflow

View on GitHub

Showing 451 of 1,081 total issues

Function BackgroundAsset has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function BackgroundAsset(props) {
  const backgroundFile = useBackgroundFile({
    file: props.backdrop.video || props.backdrop.image,
    motifArea: props.backdrop.motifArea,
    effects: props.backdrop.effects,

    Function WaveformPlayerControls has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function WaveformPlayerControls(props) {
      const darkBackground = useDarkBackground();
      const theme = useTheme();
    
      return (

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

            def build(account)
              embedded_index_table(account.memberships.on_accounts.includes(:user)
                                    .accessible_by(current_ability, :index)
                                                  .where('pageflow_memberships.user_id IS NOT NULL'),
                                   blank_slate_text: I18n.t('pageflow.admin.accounts.no_members')) do
      Severity: Minor
      Found in app/views/components/pageflow/admin/users_tab.rb - About 1 hr to fix

        Function asyncPlay has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const asyncPlay = function(player) {
          var originalPlay = player.play;
          var originalPause = player.pause;
        
          var intendingToPlay = false;
        Severity: Minor
        Found in package/src/frontend/mediaPlayer/asyncPlay.js - About 1 hr to fix

          Function createMediaPlayer has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const createMediaPlayer = function (options) {
            let isAudio = options.tagName == 'AUDIO';
          
            const player = new VideoPlayer(options.mediaElement, {
              controlBar: false,
          Severity: Minor
          Found in package/src/frontend/media/createMediaPlayer.js - About 1 hr to fix

            Function Heading has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            export function Heading({configuration, sectionProps, contentElementWidth}) {
              const level = configuration.level || sectionProps.sectionIndex;
              const firstSectionInEntry = level === 0;
              const updateConfiguration = useContentElementConfigurationUpdate();
              const {t} = useI18n({locale: 'ui'});
            Severity: Minor
            Found in entry_types/scrolled/package/src/contentElements/heading/Heading.js - About 1 hr 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 updatePlayerState has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            export function updatePlayerState(player, prevPlayerState, playerState, playerActions){
              if (!prevPlayerState.shouldPrebuffer && playerState.shouldPrebuffer) {
                player.prebuffer().then(() => setTimeout(playerActions.prebuffered, 0));
              }
            
            

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

            export function InlineAudio({contentElementId, configuration}) {
              const audioFile = useFileWithInlineRights({
                configuration,
                collectionName: 'audioFiles',
                propertyName: 'id',

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

                  def build(user)
                    embedded_index_table(user.memberships.on_entries
                                           .includes(:entry, entry: :account).references(:pageflow_entries)
                                           .accessible_by(current_ability, :index),
                                         blank_slate_text: t('pageflow.admin.users.no_entries')) do
            Severity: Minor
            Found in app/views/components/pageflow/admin/user_entries_tab.rb - About 1 hr 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 create_files has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def create_files(draft_entry, file_type, file_data_by_name, skip_encoding = false)
                  file_data_by_name.transform_values do |data|
                    say("     creating #{file_type} file from #{data['url']}")
            
                    file_state = %i[image text_track].include?(file_type) ? 'processed' : 'uploading'
            Severity: Minor
            Found in entry_types/scrolled/lib/pageflow_scrolled/seeds.rb - About 1 hr 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 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor(props, context) {
                super(props, context);
            
                this.state = {
                  subMenuVisible: false

              Function DelayedStart has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const DelayedStart = (function($) {
                return function() {
                  var waitDeferred = new $.Deferred();
                  var promises = [];
                  var performed = false;

                Function updatePoints has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function updatePoints(state, index, position, selectionPosition) {
                  if (state.mode === 'polygon') {
                    return {
                      ...state,
                      points: [

                  Function MediaPage has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function MediaPage(props) {
                    const page = props.page;
                    const playerState = props.playerState;
                  
                    const infoBox = {

                    Function MediaPlayerControls has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function MediaPlayerControls(props) {
                      const playerState = props.playerState;
                      const playerActions = props.playerActions;
                    
                      const {t} = useI18n();
                    Severity: Minor
                    Found in entry_types/scrolled/package/src/frontend/MediaPlayerControls.js - About 1 hr to fix

                      Function configurationEditor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        configurationEditor({entry}) {
                          this.listenTo(this.model, 'change:hyphens', this.refresh);
                      
                          const modelDelegator = entry.createLegacyTypographyVariantDelegator({
                            model: this.model,
                      Severity: Minor
                      Found in entry_types/scrolled/package/src/contentElements/heading/editor.js - About 1 hr to fix

                        Function renderDropTargets has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function renderDropTargets(targets, contentElementId) {
                          function handleDrop(item, index) {
                            if (index === 0) {
                              postMoveContentElementMessage({
                                id: item.id,

                          Function buildEntry has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function buildEntry(entry, contentElement, item, getPreviewConfiguration) {
                            const section = contentElement.section;
                          
                            const fakeContentElement = new Backbone.Model(
                              contentElement.attributes,

                            Method sample_scrolled_entry has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def sample_scrolled_entry(attributes:, options: {})
                                  entry = Pageflow::Entry.where(type_name: 'scrolled')
                                                         .where(attributes.slice(:account, :title))
                                                         .first
                            
                            
                            Severity: Minor
                            Found in entry_types/scrolled/lib/pageflow_scrolled/seeds.rb - About 1 hr to fix

                              Function insertContentElement has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                insertContentElement(attributes, {id, at, splitPoint}) {
                                  if (at === 'backdropOfSection') {
                                    const section = this.sections.get(id)
                              
                                    const contentElement = this.insertContentElement(
                                Severity
                                Category
                                Status
                                Source
                                Language