CalderaWP/caldera-admin

View on GitHub

Showing 25 of 770 total issues

Function getFormEntryViewerState has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getFormEntryViewerState()     {
        const {state} = this;

        const setEntries = (entries: Object) => {
            this.setState({
Severity: Major
Found in src/CalderaAdminWithState.js - About 3 hrs to fix

    File EntryViewer.test.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {EntryViewer} from "./EntryViewer";
    import renderer from "react-test-renderer";
    import React from 'react';
    import {shallow} from 'enzyme';
    import Enzyme from 'enzyme';
    Severity: Minor
    Found in src/components/EntryViewer/EntryViewer.test.js - About 3 hrs to fix

      Function Entry has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const Entry = (props) => {
          const {gridCollapse,gridGap} = props;
      
      
          return (
      Severity: Major
      Found in src/components/EntryViewer/Entry.js - About 2 hrs to fix

        Function render has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render() {
        
                const activeForm = this.props.form.hasOwnProperty('form_draft')
                    ? this.props.form.form_draft
                    : false;
        Severity: Major
        Found in src/components/FormsList/Form.js - About 2 hrs to fix

          File CalderaAdminWithState.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          
          import React, {Component} from 'react';
          import type {calderaAdminProps} from "./types/calderaAdminProps";
          
          import {cfAdmin} from "./apiClients";
          Severity: Minor
          Found in src/CalderaAdminWithState.js - About 2 hrs to fix

            Function render has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                render() {
            
                    const {
                        forms,
                        templates,
            Severity: Major
            Found in src/CalderaAdminWithState.js - About 2 hrs to fix

              Function render has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  render() {
                      const {settings,onSettingsSave} = this.props;
                      return (
                          <div>
                              <TabPanel
              Severity: Major
              Found in src/components/Settings/Settings.js - About 2 hrs to fix

                Function TopNav has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const TopNav = (props: {
                    setActive: Function,
                    active: string,
                    mainStatus: statusType
                }) => {
                Severity: Major
                Found in src/components/admin/TopNav.js - About 2 hrs to fix

                  Function getFormsStore has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      getFormsStore() {
                          /**
                           * Util function to set forms in state
                           *
                           * @param {Object} forms
                  Severity: Minor
                  Found in src/CalderaAdminWithState.js - About 2 hrs to fix

                    Function render has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        render() {
                            const {formsStore, formEntryViewerState,entryPage} = this.props;
                            if (!formsStore.hasForms()) {
                                return (
                                    <Notice
                    Severity: Minor
                    Found in src/components/admin/FormsSection.js - About 2 hrs to fix

                      Method enqueue_assets has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function enqueue_assets( $directory, $opts = [] ) {
                          $defaults = [
                              'base_url' => '',
                              'handle'   => basename( $directory ),
                              'scripts'  => [],
                      Severity: Minor
                      Found in ReactWPScripts.php - About 1 hr to fix

                        Function FormListSort has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const FormListSort = (props) => {
                        
                            const sortOptions = {
                                id: 'cf-form-sort-options',
                                label: 'Sort Forms By',
                        Severity: Minor
                        Found in src/components/FormsList/FormListSort.js - About 1 hr to fix

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

                          function enqueue_assets( $directory, $opts = [] ) {
                              $defaults = [
                                  'base_url' => '',
                                  'handle'   => basename( $directory ),
                                  'scripts'  => [],
                          Severity: Minor
                          Found in ReactWPScripts.php - 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 topControls has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              topControls() {
                                  const {entryListOnly} = this.state;
                                  const summaryOnlyFieldConfig = {
                                      id: 'cf-form-entry-viewer-summary-only',
                                      label: 'Summary Fields Only?',
                          Severity: Minor
                          Found in src/components/EntryViewer/FormEntryViewer.js - About 1 hr to fix

                            Function exports has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            module.exports = function( grunt ) {
                            
                                'use strict';
                                var banner = '/**\n * <%= pkg.homepage %>\n * Copyright (c) <%= grunt.template.today("yyyy") %>\n * This file is generated automatically. Do not edit.\n */\n';
                                // Project configuration
                            Severity: Minor
                            Found in Gruntfile.js - About 1 hr to fix

                              Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  render() {
                                      const {currentEntry} = this.state;
                              
                                      if (!currentEntry) {
                                          return (
                              Severity: Minor
                              Found in src/components/EntryViewer/FormEntryViewer.js - About 1 hr to fix

                                Function pagination has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    pagination() {
                                        return <div>
                                            {true === this.showPreviousNav() &&
                                            <Button
                                                className={EntryViewer.classNames.nextNav}
                                Severity: Minor
                                Found in src/components/EntryViewer/EntryViewer.js - About 1 hr to fix

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

                                      getFieldComponents(){
                                          let fields = {};
                                          const {props} = this;
                                          const {fieldConfigs,templates} = props;
                                          fieldConfigs.forEach( fieldConfig => {
                                  Severity: Minor
                                  Found in src/components/NewForm/NewForm.js - About 1 hr to fix

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

                                    export const EntryRowActions = (props) => {
                                    
                                            return(
                                                <div>
                                                    <Button
                                    Severity: Minor
                                    Found in src/components/EntryViewer/EntryRowActions.js - About 1 hr to fix

                                      Function FormList has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export const FormList = (props) => {
                                          let isAlternate = true;
                                          const forms = Array.isArray(props.form) ? props.form : Object.values(props.forms);
                                          return (
                                              <table className="widefat fixed">
                                      Severity: Minor
                                      Found in src/components/FormsList/FormList.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language