codevise/pageflow

View on GitHub

Showing 407 of 1,024 total issues

Function onRender has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  onRender: function() {
    this.ui.input.addClass(this.options.size);
    this.load();
    this.updatePlaceholder();

Severity: Minor
Found in package/src/ui/views/inputs/TextAreaInputView.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

Method build has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def build(entry)
        embedded_index_table(entry.memberships.includes(:user).references(:users),
                             blank_slate_text: I18n.t('pageflow.admin.entries.no_members')) do
          table_for_collection class: 'memberships', sortable: true, i18n: Pageflow::Membership do
            column :user, sortable: 'users.last_name', class: 'name' do |membership|
Severity: Minor
Found in app/views/components/pageflow/admin/members_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

Function browser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export const browser = (function(){
  var tests = {},
      results = {},
      featureDetectionComplete = false;

Severity: Minor
Found in package/src/frontend/browser/browser.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

Method social_share_entry_image_tags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def social_share_entry_image_tags(entry)
      share_images = []
      image_file = find_file_in_entry(ImageFile, entry.share_image_id, entry)

      if image_file
Severity: Minor
Found in app/helpers/pageflow/social_share_helper.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 render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {editing, t, requestedVendors, visible} = this.props;

    if (visible || editing) {
      return (

    Function exampleSeed has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function exampleSeed(transition1, transition2) {
      return normalizeAndMergeFixture({
        sections: [
          {
            id: 1,

      Function onRender has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        onRender: function() {
          var fileType = this.model.fileType();
          var entry = this.options.entry || state.entry;
      
          var tab = new ConfigurationEditorTabView({
      Severity: Minor
      Found in package/src/editor/views/EditFileView.js - About 1 hr to fix

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

          configurationEditor({entry, contentElement}) {
            this.listenTo(contentElement.transientState,
                          'change:exampleNode',
                          () => this.refresh());
        
        

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

            initialize: function(options) {
              this.theme = options.theme;
          
              this.files = _(_.keys(options.files || {})).reduce(function(memo, collectionName) {
                memo[collectionName] = _(options.files[collectionName]).reduce(function(result, file) {

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

                    Method configure has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def configure(config)
                          config.features.register('scrolled_entry_type') do |feature_config|
                            feature_config.entry_types.register(PageflowScrolled.entry_type)
                          end
                    
                    
                    Severity: Minor
                    Found in entry_types/scrolled/lib/pageflow_scrolled/plugin.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 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

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language