codevise/pageflow

View on GitHub

Showing 425 of 1,055 total issues

Avoid too many return statements within this function.
Open

      return Promise.resolve('fulfilled');
Severity: Major
Found in package/src/frontend/Consent/index.js - About 30 mins to fix

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

      onRender: function () {
        const options = this.options;
    
        const configurationEditor = new ConfigurationEditorView({
          model: this.model,

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

      resume: function() {
        if (this.multiPlayer.paused()) {
          if (this.disabled || this.backgroundMedia.muted) {
            return new $.Deferred().resolve().promise();
          }
    Severity: Minor
    Found in entry_types/paged/packages/pageflow-paged/src/frontend/Slideshow/Atmo.js - About 25 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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function(collectionName, {namespace} = {}) {
      return function itemsSelector(state) {
        if (namespace) {
          if (!state[namespace]) {
            throw new Error(`Cannot select from unknown namespace ${namespace}.`);

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

    export const HashAdapter = function() {
      var counter = 0;
    
      this.back = function() {
        if (counter > 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 getAttributesFromBackdropAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getAttributesFromBackdropAttribute() {
        const backdrop = this.attributes.backdrop || {};
    
        if (backdrop.image && backdrop.image.toString().startsWith('#')) {
          return {
    Severity: Minor
    Found in entry_types/scrolled/package/src/editor/models/SectionConfiguration.js - About 25 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 autoTextTrackFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function autoTextTrackFile(textTrackFiles, defaultTextTrackFileId, locale, volume) {
      if (defaultTextTrackFileId) {
        const defaultTextTrackFile = textTrackFiles.find(textTrackFile =>
          textTrackFile.permaId == defaultTextTrackFileId
        );
    Severity: Minor
    Found in entry_types/paged/packages/pageflow-paged-react/src/media/selectors.js - About 25 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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function({
      tagName,
      sources,
      poster = () => {},
      emulateTextTracksDisplay = 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 IframeEmbed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function IframeEmbed({configuration}) {
      const {shouldLoad} = useContentElementLifecycle();
      const {isEditable, isSelected} = useContentElementEditorState();
      const portraitOrientation = usePortraitOrientation();
    
    

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

    function motifAreaDisabled([
      backdropType,
      backdropImageMotifArea, backdropImageMobileMotifArea, backdropVideoMotifArea,
      backdropImage, backdropImageMobile, backdropVideo
    ]) {
    Severity: Minor
    Found in entry_types/scrolled/package/src/editor/views/EditSectionView.js - About 25 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 pageflowScrolledRegisterUpdateSeedHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    global.pageflowScrolledRegisterUpdateSeedHandler = function() {
      if (window.parent !== window) {
        window.addEventListener('message', receive);
      }
    
    
    Severity: Minor
    Found in entry_types/scrolled/package/src/frontend/index.js - About 25 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 insertContentElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      insertContentElement(attributes, {id, at, splitPoint}) {
        if (at === 'backdropOfSection') {
          const section = this.sections.get(id)
    
          const contentElement = this.insertContentElement(
    Severity: Minor
    Found in entry_types/scrolled/package/src/editor/models/ScrolledEntry/index.js - About 25 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 playerStateReducer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function playerStateReducer(state, action){
      switch(action.type){
        case PLAY:
          return {
            ...state,
    Severity: Minor
    Found in entry_types/scrolled/package/src/frontend/MediaPlayer/usePlayerState.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
    Open

      update: function() {
        this.$el.toggleClass('files_pending', this.model.get('uploading_files_count') > 0 || this.model.get('pending_files_count') > 0);
        this.$el.toggleClass('published', this.model.get('published'));
    
        this.ui.revisionsLink.attr('href', '/admin/entries/' + this.model.id);
    Severity: Minor
    Found in package/src/editor/views/PublishEntryView.js - About 25 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 getAspectRatioClassName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function getAspectRatioClassName(aspectRatio, fullscreenDimensions, mobile) {
      if (fullscreenDimensions.height) {
        return (!mobile || isPortrait(fullscreenDimensions)) &&
               hasAspectRatio(fullscreenDimensions, {min: aspectRatio}) &&
               'minAspectRatio';

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

    function getMotifAreaMinHeight(fullHeight, transitions, motifAreaDimension) {
      if (fullHeight) {
        return;
      }
    
    
    Severity: Minor
    Found in entry_types/scrolled/package/src/frontend/v1/useMotifAreaState.js - About 25 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 ScrollPointMessageHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function ScrollPointMessageHandler() {
      const scrollPoint = useRef();
    
      const receiveMessage = useCallback(data => {
        if (data.type === 'SAVE_SCROLL_POINT') {
    Severity: Minor
    Found in entry_types/scrolled/package/src/frontend/inlineEditing/scrollPoints.js - About 25 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 OptIn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function OptIn({children, providerName, wrapper, icon}) {
      const {t} = useI18n();
      const {contentElementId} = useContentElementAttributes();
      const contentElementConsentVendor = useContentElementConsentVendor({contentElementId});
    
    
    Severity: Minor
    Found in entry_types/scrolled/package/src/frontend/thirdPartyConsent/OptIn.js - About 25 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 MenuBarButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function MenuBarButton(props) {
      const {subMenuItems, onClick} = props;
    
      const [subMenuExpanded, setSubMenuExpanded] = useState(props.subMenuExpanded);
      const closeMenuTimeout = 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

    Function withLineBreakNormalization has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function withLineBreakNormalization(editor) {
      const { normalizeNode } = editor;
    
      editor.normalizeNode = ([node, path]) => {
        if (node.text) {

    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