gocodebox/lifterlms-blocks

View on GitHub

Showing 85 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export const settings = getSettingsFromBase(
          baseSettings,
          {
              title: __( 'User Email', 'lifterlms' ),
              description: __(
      Severity: Major
      Found in src/js/blocks/form-fields/fields/user-email.js and 1 other location - About 7 hrs to fix
      src/js/blocks/form-fields/fields/user-display-name.js on lines 37..81

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 177.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export const settings = getSettingsFromBase(
          baseSettings,
          {
              title: __( 'User Display Name', 'lifterlms' ),
              description: __(
      Severity: Major
      Found in src/js/blocks/form-fields/fields/user-display-name.js and 1 other location - About 7 hrs to fix
      src/js/blocks/form-fields/fields/user-email.js on lines 40..84

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 177.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        attributes: {
                            id: {
                                __default: 'llms_billing_country',
                            },
                            label: {
                Severity: Major
                Found in src/js/blocks/form-fields/fields/user-address-country.js and 1 other location - About 3 hrs to fix
                src/js/blocks/form-fields/fields/user-address-state.js on lines 59..84

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 104.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        attributes: {
                            id: {
                                __default: 'llms_billing_state',
                            },
                            label: {
                Severity: Major
                Found in src/js/blocks/form-fields/fields/user-address-state.js and 1 other location - About 3 hrs to fix
                src/js/blocks/form-fields/fields/user-address-country.js on lines 60..85

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 104.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                        Similar blocks of code found in 6 locations. Consider refactoring.
                        Open

                                            <ToggleControl
                                                label={ __( 'Display Tracks', 'lifterlms' ) }
                                                checked={ !! show_tracks }
                                                onChange={ () =>
                                                    setAttributes( { show_tracks: ! show_tracks } )
                        Severity: Major
                        Found in src/js/blocks/course-information/inspect.js and 5 other locations - About 2 hrs to fix
                        src/js/blocks/course-information/inspect.js on lines 76..87
                        src/js/blocks/course-information/inspect.js on lines 89..102
                        src/js/blocks/course-information/inspect.js on lines 117..131
                        src/js/blocks/course-information/inspect.js on lines 133..144
                        src/js/blocks/form-fields/fields/redeem-voucher.js on lines 48..60

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 79.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 6 locations. Consider refactoring.
                        Open

                                            <ToggleControl
                                                label={ __( 'Display Categories', 'lifterlms' ) }
                                                checked={ !! show_cats }
                                                onChange={ () =>
                                                    setAttributes( { show_cats: ! show_cats } )
                        Severity: Major
                        Found in src/js/blocks/course-information/inspect.js and 5 other locations - About 2 hrs to fix
                        src/js/blocks/course-information/inspect.js on lines 76..87
                        src/js/blocks/course-information/inspect.js on lines 89..102
                        src/js/blocks/course-information/inspect.js on lines 104..115
                        src/js/blocks/course-information/inspect.js on lines 133..144
                        src/js/blocks/form-fields/fields/redeem-voucher.js on lines 48..60

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 79.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 6 locations. Consider refactoring.
                        Open

                                            <ToggleControl
                                                label={ __( 'Display Tags', 'lifterlms' ) }
                                                checked={ !! show_tags }
                                                onChange={ () =>
                                                    setAttributes( { show_tags: ! show_tags } )
                        Severity: Major
                        Found in src/js/blocks/course-information/inspect.js and 5 other locations - About 2 hrs to fix
                        src/js/blocks/course-information/inspect.js on lines 76..87
                        src/js/blocks/course-information/inspect.js on lines 89..102
                        src/js/blocks/course-information/inspect.js on lines 104..115
                        src/js/blocks/course-information/inspect.js on lines 117..131
                        src/js/blocks/form-fields/fields/redeem-voucher.js on lines 48..60

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 79.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 6 locations. Consider refactoring.
                        Open

                                <ToggleControl
                                    label={ __( 'Toggleable', 'lifterlms' ) }
                                    checked={ !! toggleable }
                                    onChange={ () => setAttributes( { toggleable: ! toggleable } ) }
                                    help={
                        Severity: Major
                        Found in src/js/blocks/form-fields/fields/redeem-voucher.js and 5 other locations - About 2 hrs to fix
                        src/js/blocks/course-information/inspect.js on lines 76..87
                        src/js/blocks/course-information/inspect.js on lines 89..102
                        src/js/blocks/course-information/inspect.js on lines 104..115
                        src/js/blocks/course-information/inspect.js on lines 117..131
                        src/js/blocks/course-information/inspect.js on lines 133..144

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 79.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language