codevise/pageflow

View on GitHub

Showing 425 of 1,055 total issues

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

  save: function() {
    var publishedUntil = null;

    if (this.$el.hasClass('publishing')) {
      return;
Severity: Minor
Found in package/src/editor/views/PublishEntryView.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 LinkTooltipProvider has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function LinkTooltipProvider({
  disabled, position, children, align = 'left', gap = 10
}) {
  const [state, setState] = useState();
  const outerRef = useRef();

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

        def status_tag_column(name, texts, types)
          column name do |resource|
            value = resource.send(name)

            status = value ? 'yes' : 'no'
Severity: Minor
Found in lib/pageflow/active_admin_patches/views/table_for.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 initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  initialize: function() {
    if (this.options.collection) {
      this.options.values = _.pluck(this.options.collection, this.options.valueProperty);

      if (this.options.textProperty) {
Severity: Minor
Found in package/src/ui/views/inputs/SelectInputView.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 PlayerSourceIDMap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const PlayerSourceIDMap = function (media, {playerOptions} = {}) {
  return {
    current: undefined,
    previous: undefined,
    mapSources: function (id, sources) {
Severity: Minor
Found in package/src/frontend/media/PlayerSourceIDMap.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 status_tag_row has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def status_tag_row(name, texts, types)
          row(name, class: 'status_tag_row') do |record|
            value = record.send(name)

            status = value ? 'yes' : 'no'
Severity: Minor
Found in lib/pageflow/active_admin_patches/views/attributes_table.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 History has 35 lines of code (exceeds 25 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) {

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

      onRender() {
        this.updateTransition();
    
        if (this.updateActive()) {
          setTimeout(() => this.$el[0].scrollIntoView({block: 'nearest'}), 10)
    Severity: Minor
    Found in entry_types/scrolled/package/src/editor/views/SectionItemView.js - About 1 hr to fix

      Function createScrollPositionLifecycleProvider has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function createScrollPositionLifecycleProvider(Context) {
        return function ScrollPositionLifecycleProvider({
          children, onActivate, entersWithFadeTransition
        }) {
          const ref = useRef();

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

          initialize: function() {
            if (this.options.collection) {
              this.options.values = _.pluck(this.options.collection, this.options.valueProperty);
        
              if (this.options.textProperty) {
        Severity: Minor
        Found in package/src/ui/views/inputs/SelectInputView.js - About 1 hr to fix

          Function videoFileWithTextTrackFiles has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            videoFileWithTextTrackFiles: function(options) {
              var fileTypes = this.fileTypes(function() {
                this.withVideoFileType(options.videoFileTypeOptions);
                this.withTextTrackFileType(options.textTrackFileTypeOptions);
              });
          Severity: Minor
          Found in package/src/testHelpers/factories.js - About 1 hr to fix

            Function widgets has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const widgets = (function() {
              return {
                isPresent: function(name) {
                  return !!$('div.' + className(name)).length;
                },
            Severity: Minor
            Found in entry_types/paged/packages/pageflow-paged/src/frontend/widgets.js - About 1 hr to fix

              Function mediaTagHTML has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                mediaTagHTML() {
                  const wrapper = document.createElement('div');
                  const mediaElement = document.createElement(this.props.tagName);
              
                  mediaElement.setAttribute('preload', 'none');

                Function configure has 34 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 goTo has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    this.goTo = function(page, options) {
                      options = options || {};
                  
                      if (page.length && !page.is(currentPage)) {
                        var cancelled = false;

                    Function watchPlayer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function watchPlayer(player, actions) {
                      player.on('loadedmetadata', () => actions.metaDataLoaded(player.currentTime(), player.duration()));
                      player.on('loadeddata', () => actions.dataLoaded());
                    
                      player.on('progress', () => actions.progress(player.bufferedEnd()));

                      Function renderControlBar has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function renderControlBar(props, darkBackground, fadedOut) {
                        return (
                          <div onFocus={props.onFocus}
                               onBlur={props.onBlur}
                               onMouseEnter={props.onMouseEnter}

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

                          initialize: function(attributes, options) {
                            options = options || {};
                        
                            this.metadata = new EntryMetadata(this.get('metadata') || {});
                            this.metadata.parent = this;
                        Severity: Minor
                        Found in package/src/editor/models/Entry.js - About 1 hr to fix

                          Method video_file_video_tag has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def video_file_video_tag(video_file, options = {})
                                defaults = {
                                  crossorigin: 'anonymous',
                                  class: [
                                    'player video-js video-viewport vjs-default-skin',
                          Severity: Minor
                          Found in app/helpers/pageflow/video_files_helper.rb - About 1 hr to fix

                            Method create_files has 34 lines of code (exceeds 25 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
                              Severity
                              Category
                              Status
                              Source
                              Language