codevise/pageflow

View on GitHub

Showing 425 of 1,055 total issues

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

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

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

        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(

                    Function onload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    window.onload = function() {
                      browser.detectFeatures().then(function() {
                        var slideshow = $('[data-role=slideshow]');
                        var body = $('body');
                    
                    
                    Severity: Minor
                    Found in entry_types/paged/packages/pageflow-paged/src/frontend/boot.js - About 1 hr to fix

                      Function configure has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        configure: function() {
                          this.tab('general', function() {
                            this.group('general', {supportsTextPositionCenter: true});
                      
                            this.input('additional_title', TextInputView);

                        Function Content has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const Content = withInlineEditingDecorator('ContentDecorator', function Content(props) {
                          const [currentSectionIndex, setCurrentSectionIndexState] = useCurrentSectionIndexState();
                        
                          const entryStructure = useEntryStructure();
                          useSectionChangeEvents(currentSectionIndex);
                        Severity: Minor
                        Found in entry_types/scrolled/package/src/frontend/Content.js - About 1 hr to fix

                          Function LegalInfoMenu has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function LegalInfoMenu(props) {
                            const fileRights = useFileRights();
                            const legalInfo = useLegalInfo();
                            const credits = useCredits();
                            const {t} = useI18n();

                            Function updatePlayer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function updatePlayer(player, playerState, nextPlayerState, playerActions) {
                              if (!playerState.shouldPrebuffer && nextPlayerState.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 default has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function(videoFile, quality, {
                              hasHighBandwidth, forceBestQuality, forceFullhdQuality
                            } = {}) {
                              quality = quality || 'auto';
                            
                            

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

                              set(name, value, options) {
                                const previousValue = this.get('position');
                            
                                Configuration.prototype.set.apply(this, arguments);
                            
                            

                            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