gocodebox/lifterlms-blocks

View on GitHub

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 '';
        }
Severity: Major
Found in src/js/blocks/form-fields/inspect.js - About 1 day to fix

    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
    Severity: Minor
    Found in src/js/blocks/form-fields/inspect.js - About 7 hrs to fix

      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;
      Severity: Minor
      Found in includes/class-llms-blocks-visibility.php - About 5 hrs 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 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;
      
      
      Severity: Major
      Found in src/js/blocks/form-fields/field.js - About 4 hrs to fix

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

            render() {
                const {
                    attributes: {
                        length,
                        show_cats,
        Severity: Major
        Found in src/js/blocks/course-information/inspect.js - About 4 hrs to fix

          Function default has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function ( props ) {
              const {
                      id,
                      item: instructor,
                      index,
          Severity: Major
          Found in src/js/sidebar/instructors/list-item.js - About 4 hrs to fix

            Function edit has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                edit: ( props ) => {
                    const { attributes, setAttributes } = props;
                    const {
                        length,
                        show_cats,
            Severity: Major
            Found in src/js/blocks/course-information/index.js - About 3 hrs to fix

              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,
              Severity: Major
              Found in src/js/blocks/form-fields/edit.js - About 3 hrs to fix

                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">
                Severity: Major
                Found in src/js/post-visibility/component.js - About 2 hrs to fix

                  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 ),
                  Severity: Major
                  Found in src/js/blocks/form-fields/edit.js - About 2 hrs to fix

                    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 ),
                    Severity: Major
                    Found in src/js/formats/shortcodes/edit.js - About 2 hrs to fix

                      Function fillInspectorControls has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const fillInspectorControls = ( attributes, setAttributes ) => {
                          const {
                                  isConfirmationControlField,
                                  isConfirmationField,
                                  meter,
                      Severity: Major
                      Found in src/js/blocks/form-fields/fields/user-password.js - About 2 hrs to fix

                        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 (
                        Severity: Minor
                        Found in src/js/blocks/form-fields/edit.js - About 2 hrs 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 render has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            render() {
                                const {
                                        label,
                                        isMulti,
                                        isDisabled,
                        Severity: Major
                        Found in src/js/components/search/index.js - About 2 hrs to fix

                          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' );
                          Severity: Minor
                          Found in src/js/dom-ready/forms/index.js - About 1 hr to fix

                            Function getVisibilityInOptions has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    const getVisibilityInOptions = () => {
                                        const currentPost = wp.data
                                            .select( 'core/editor' )
                                            .getCurrentPost();
                            
                            
                            Severity: Minor
                            Found in src/js/block-visibility/inspect.js - About 1 hr to fix

                              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;
                              Severity: Minor
                              Found in includes/class-llms-blocks-visibility.php - About 1 hr to fix

                                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(
                                Severity: Minor
                                Found in includes/blocks/class-llms-blocks-course-information-block.php - About 1 hr to fix

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

                                  function Edit( props ) {
                                      const { attributes } = props,
                                          { template } = attributes,
                                          blockProps = useBlockProps();
                                  
                                  
                                  Severity: Minor
                                  Found in src/js/blocks/php-template/index.js - About 1 hr to fix

                                    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;
                                    
                                    
                                    Severity: Minor
                                    Found in src/js/blocks/form-fields/field.js - 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language