codevise/pageflow

View on GitHub

Showing 451 of 1,081 total issues

Function Audio has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Audio = function(options) {
  this.getSources = options.getSources || function(audioFileId) {
    return options.audioFiles[audioFileId] || '';
  };

Severity: Minor
Found in package/src/frontend/Audio/Audio.js - About 1 hr to fix

    Function handleFailedPlay has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const handleFailedPlay = function(player, options) {
      var originalPlay = player.play;
    
      player.play = function(/* arguments */) {
        var result = originalPlay.apply(player, arguments);
    Severity: Minor
    Found in package/src/frontend/mediaPlayer/handleFailedPlay.js - About 1 hr to fix

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

        function setup() {
          const promise = new Promise((r) => resolve = r);
          const consentApi = {
            requested: async function() {
              const {vendors} = await promise;

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

          export default function*(options = {}) {
            const sagas = [
              togglePlaying(),
              muteBackgroundMediaOnPlayFailed(),
              disableScrollIndicatorDuringPlayback()

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

            export const phoneLandscapeFullscreen = function() {
              if (window.screen.orientation) {
                if (browser.has('phone platform') && !browser.has('iphone platform')) {
                  window.screen.orientation.onchange = function() {
                    if (isLandscape()) {

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

                onRender: function () {
                  var configurationEditor = new ConfigurationEditorView({
                    model: this.model,
                    attributeTranslationKeyPrefixes: ['pageflow_scrolled.editor.content_elements.externalLinkList.attributes'],
                    tabTranslationKeyPrefix: 'pageflow_scrolled.editor.content_elements.externalLinkList.tabs'

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

                  const steps = useMemo(() => {
                    if (!enabled || !containerWidth) {
                      return;
                    }
                
                

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

                    const scrollFromTo = useCallback((from, to) => {
                      const scroller = scrollerRef.current;
                      const step = scroller.children[to + 1];
                  
                      scroller.scrollTo(Math.abs(scroller.offsetLeft - step.offsetLeft), 0);

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

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

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

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

                              export function LegalInfoLink(props) {
                                // eslint-disable-next-line no-script-url
                                if (props.url === 'javascript:pageflowDisplayPrivacySettings()' && props.label) {
                                  return (
                                    <div>

                                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

                                  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

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

                                      function mapIndexOfRectHandleCrossingOver(index, position, startPoints) {
                                        if ((index >= 0 && index <= 3 && position[1] > startPoints[0][1]) ||
                                            (index >= 4 && index <= 6 && position[1] < startPoints[0][1])){
                                          index = 6 - index;
                                        }

                                      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