Showing 25 of 770 total issues
Function getFormEntryViewerState
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getFormEntryViewerState() {
const {state} = this;
const setEntries = (entries: Object) => {
this.setState({
File EntryViewer.test.js
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {EntryViewer} from "./EntryViewer";
import renderer from "react-test-renderer";
import React from 'react';
import {shallow} from 'enzyme';
import Enzyme from 'enzyme';
Function Entry
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Entry = (props) => {
const {gridCollapse,gridGap} = props;
return (
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const activeForm = this.props.form.hasOwnProperty('form_draft')
? this.props.form.form_draft
: false;
File CalderaAdminWithState.js
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, {Component} from 'react';
import type {calderaAdminProps} from "./types/calderaAdminProps";
import {cfAdmin} from "./apiClients";
Function render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
forms,
templates,
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {settings,onSettingsSave} = this.props;
return (
<div>
<TabPanel
Function TopNav
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const TopNav = (props: {
setActive: Function,
active: string,
mainStatus: statusType
}) => {
Function getFormsStore
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getFormsStore() {
/**
* Util function to set forms in state
*
* @param {Object} forms
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {formsStore, formEntryViewerState,entryPage} = this.props;
if (!formsStore.hasForms()) {
return (
<Notice
Method enqueue_assets
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function enqueue_assets( $directory, $opts = [] ) {
$defaults = [
'base_url' => '',
'handle' => basename( $directory ),
'scripts' => [],
Function FormListSort
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const FormListSort = (props) => {
const sortOptions = {
id: 'cf-form-sort-options',
label: 'Sort Forms By',
Function enqueue_assets
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
function enqueue_assets( $directory, $opts = [] ) {
$defaults = [
'base_url' => '',
'handle' => basename( $directory ),
'scripts' => [],
- Read upRead up
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
Open
topControls() {
const {entryListOnly} = this.state;
const summaryOnlyFieldConfig = {
id: 'cf-form-entry-viewer-summary-only',
label: 'Summary Fields Only?',
Function exports
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {currentEntry} = this.state;
if (!currentEntry) {
return (
Function pagination
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
pagination() {
return <div>
{true === this.showPreviousNav() &&
<Button
className={EntryViewer.classNames.nextNav}
Function getFieldComponents
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getFieldComponents(){
let fields = {};
const {props} = this;
const {fieldConfigs,templates} = props;
fieldConfigs.forEach( fieldConfig => {
Function EntryRowActions
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const EntryRowActions = (props) => {
return(
<div>
<Button
Function FormList
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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">