codevise/pageflow

View on GitHub

Showing 425 of 1,055 total issues

Function closestPointOnPolygon has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function closestPointOnPolygon(polygon, c, maxDistance = 5) {
  function distance(p1, p2) {
    return Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2);
  }

    Function getAttributesFromBackdropAttribute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getAttributesFromBackdropAttribute() {
        const backdrop = this.attributes.backdrop || {};
    
        if (backdrop.image && backdrop.image.toString().startsWith('#')) {
          return {

      Function getTypographyVariants has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getTypographyVariants({contentElement, prefix}) {
          const typographyRuleNames = Object.keys(
            this.scrolledSeed.config.theme.options.typography || {}
          );
          const legacyTypographyVariants = this.scrolledSeed.legacyTypographyVariants || {}

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

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

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

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

            Function DefaultSelectionRect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function DefaultSelectionRect(props) {
              const {isSelected, select} = useContentElementEditorState();
              const {t} = useI18n({locale: 'ui'});
            
              const [, drag, preview] = useDrag({

              Method smil_definitions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def smil_definitions
                    return [] if skip_smil
              
                    smil_definition = {
                      type: 'playlist',
              Severity: Minor
              Found in lib/pageflow/zencoder_video_output_definition.rb - About 1 hr to fix

                Function seekWithInvalidStateHandling has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const seekWithInvalidStateHandling = function(player) {
                  var originalSeek = player.seek;
                
                  player.seek = function(time) {
                    return retryOnProgress(function() {
                Severity: Minor
                Found in package/src/frontend/AudioPlayer/seekWithInvalidStateHandling.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (!this.isNew() &&
                              (!this.isDestroying || !this.isDestroying()) &&
                              (!this.isDestroyed || !this.isDestroyed()) &&
                              autoSave &&
                              options.autoSave !== false) {
                  Severity: Major
                  Found in package/src/editor/models/mixins/configurationContainer.js - About 1 hr to fix

                    Function default has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function(videoFile, fit, position, wrapperDimensions) {
                      if (!wrapperDimensions || !wrapperDimensions.height ||
                          !fit || fit == 'contain') {
                        return;
                      }

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

                    function deepEqual(a, b) {
                      if (a.length !== b.length) {
                        return false;
                      }
                    
                    

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

                    export function BeforeAfter(configuration) {
                      const {
                        isActive,
                        load,
                        before_label,

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

                      update: function() {
                        var view = this;
                    
                        if (this.model.get('checking')) {
                          view.ui.state.text(I18n.t('pageflow.editor.quotas.loading'));
                    Severity: Minor
                    Found in package/src/editor/views/EntryPublicationQuotaDecoratorView.js - About 55 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      update: function() {
                        if (this.videoPlayer.isPresent() && this.model.hasChanged(this.options.propertyName)) {
                          var paused = this.videoPlayer.paused();
                    
                          this.videoPlayer.src(this.model.getVideoFileSources(this.options.propertyName));
                    Severity: Minor
                    Found in package/src/editor/views/embedded/LazyVideoEmbeddedView.js - About 55 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 deepEqual has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function deepEqual(a, b) {
                      if (a.length !== b.length) {
                        return false;
                      }
                    
                    
                    Severity: Minor
                    Found in entry_types/scrolled/package/src/frontend/MediaPlayer/PlayerContainer.js - About 55 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 Content has a Cognitive Complexity of 9 (exceeds 5 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 55 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 ScrollButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function ScrollButton({type, contentRect, onStep}) {
                      const visible = type === 'start' ? contentRect.scroll.left > 0 :
                                      contentRect.scroll.width > contentRect.client.width &&
                                      contentRect.scroll.left < contentRect.scroll.width - contentRect.client.width;
                      const step = type === 'start' ? -100 : 100;

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

                    export function useTextTracks({file, defaultTextTrackFilePermaId, captionsByDefault}) {
                      let [setting, setSetting] = useSetting('textTrack');
                      setting = setting || {};
                    
                      const {t} = useI18n();
                    Severity: Minor
                    Found in entry_types/scrolled/package/src/frontend/useTextTracks.js - About 55 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 bufferUnderrunWaiting has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const bufferUnderrunWaiting = function(player) {
                      var originalPause = player.pause;
                    
                      player.pause = function() {
                        cancelWaiting();
                    Severity: Minor
                    Found in package/src/frontend/VideoPlayer/bufferUnderrunWaiting.js - About 55 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 rewrite_file_references! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def rewrite_file_references!(hash, keys, files_by_name)
                          return unless hash
                    
                          keys.each do |key|
                            next unless hash[key]
                    Severity: Minor
                    Found in entry_types/scrolled/lib/pageflow_scrolled/seeds.rb - About 55 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

                    Severity
                    Category
                    Status
                    Source
                    Language