Showing 50 of 85 total issues
Function render
has 212 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
// Return early if there's no inspector options to display.
if ( ! this.hasInspectorSupport() ) {
return '';
}
File inspect.js
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Inspector settings for the Course Information Block.
*
* @since 1.6.0
* @version 2.0.0
Function maybe_filter_block
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function maybe_filter_block( $content, $block ) {
// Allow conditionally filtering the block based on external context.
if ( ! $this->should_filter_block( $block ) ) {
return $content;
- 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 render
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { attributes, setAttributes, block, clientId } = this.props,
{ description, label, options, placeholder, required } = attributes,
editFills = block.supports.llms_edit_fill;
Function render
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
attributes: {
length,
show_cats,
Function default
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ( props ) {
const {
id,
item: instructor,
index,
Function edit
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
edit: ( props ) => {
const { attributes, setAttributes } = props;
const {
length,
show_cats,
Function EditField
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function EditField( props ) {
let { attributes } = props,
shouldSetupAtts = true;
const { name } = props,
Function render
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { onUpdateVisibility, instanceId, visibility } = this.props;
return (
<PluginPostStatusInfo className="llms-post-visibility">
Function EditGroup
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function EditGroup( props ) {
const { attributes, clientId, name, setAttributes } = props,
{ fieldLayout } = attributes,
{ getBlock } = select( blockEditorStore ),
block = getBlock( clientId ),
Function default
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ( props ) {
const [ isOpen, setOpen ] = useState( false ),
[ searchQuery, setSearchQuery ] = useState( '' ),
[ defaultValue, setDefaultValue ] = useState( '' ),
openModal = () => setOpen( true ),
Function fillInspectorControls
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fillInspectorControls = ( attributes, setAttributes ) => {
const {
isConfirmationControlField,
isConfirmationField,
meter,
Function setupAtts
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const setupAtts = ( atts, blockAtts, addingField ) => {
// Merge configured defaults into the block attributes.
Object.keys( blockAtts ).forEach( ( key ) => {
const defaultValue = blockAtts[ key ].__default;
if (
- 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 render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
label,
isMulti,
isDisabled,
Function ensureEmailFieldExists
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ensureEmailFieldExists() {
const emailBlockName = 'llms/form-field-user-email',
noticeId = 'llms-forms-no-email-error-notice',
{ getNotices } = select( 'core/notices' ),
{ createErrorNotice, removeNotice } = dispatch( 'core/notices' );
Function getVisibilityInOptions
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getVisibilityInOptions = () => {
const currentPost = wp.data
.select( 'core/editor' )
.getCurrentPost();
Method maybe_filter_block
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function maybe_filter_block( $content, $block ) {
// Allow conditionally filtering the block based on external context.
if ( ! $this->should_filter_block( $block ) ) {
return $content;
Method add_hooks
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_hooks( $attributes = array(), $content = '' ) {
$attributes = wp_parse_args(
$attributes,
array(
Function Edit
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Edit( props ) {
const { attributes } = props,
{ template } = attributes,
blockProps = useBlockProps();
Function render
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { attributes, setAttributes, block, clientId } = this.props,
{ description, label, options, placeholder, required } = attributes,
editFills = block.supports.llms_edit_fill;
- 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"