gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Method get_data has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function get_data( $key, $data ) {

        $course = llms_get_post( $data );

        switch ( $key ) {
Severity: Minor
Found in includes/admin/reporting/tables/llms.table.courses.php - About 1 hr to fix

    Method get_orders has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_orders( $params = array() ) {
    
            $params = wp_parse_args(
                $params,
                array(
    Severity: Minor
    Found in includes/models/model.llms.student.php - About 1 hr to fix

      Method convert_to_hours_minutes_string has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function convert_to_hours_minutes_string( $time ) {
              $decimal_part = $time - floor( $time );
              settype( $time, 'integer' );
              if ( $time < 1 ) {
                  return;
      Severity: Minor
      Found in includes/class.llms.date.php - About 1 hr to fix

        Method get_test_settings has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function get_test_settings( $type ) {
        
                if ( 'email' !== $type ) {
                    return;
                }

          Method llms_is_post_restricted_by_membership has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function llms_is_post_restricted_by_membership( $post_id, $user_id = null ) {
          
              // don't check these posts types.
              $skip = apply_filters(
                  'llms_is_post_restricted_by_membership_skip_post_types',
          Severity: Minor
          Found in includes/functions/llms.functions.access.php - About 1 hr to fix

            Method set_merge_data has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function set_merge_data( $code ) {
            
                    $attempt = new LLMS_Quiz_Attempt( $this->notification->get( 'post_id' ) );
                    if ( ! $attempt->exists() ) {
                        return '';

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

                              array(
                                  'class'             => 'llms-select2-post',
                                  'custom_attributes' => array(
                                      'data-allow-clear' => true,
                                      'data-post-type'   => 'page',
              Severity: Major
              Found in includes/admin/settings/class.llms.settings.memberships.php and 1 other location - About 1 hr to fix
              includes/admin/settings/class.llms.settings.memberships.php on lines 65..78

              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 110.

              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

                              array(
                                  'class'             => 'llms-select2-post',
                                  'custom_attributes' => array(
                                      'data-allow-clear' => true,
                                      'data-post-type'   => 'llms_membership',
              Severity: Major
              Found in includes/admin/settings/class.llms.settings.memberships.php and 1 other location - About 1 hr to fix
              includes/admin/settings/class.llms.settings.memberships.php on lines 97..110

              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 110.

              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

                              <PanelRow>
                                  <TextControl
                                      label={ __( 'Login redirect URL', 'lifterlms' ) }
                                      value={ attributes.login_redirect }
                                      onChange={ ( value ) => setAttributes( {
              Severity: Major
              Found in src/blocks/my-account/index.jsx and 1 other location - About 1 hr to fix
              src/blocks/login/index.jsx on lines 66..74

              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 64.

              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

                              <PanelRow>
                                  <TextControl
                                      label={ __( 'Login redirect URL', 'lifterlms' ) }
                                      value={ attributes.redirect }
                                      onChange={ ( value ) => setAttributes( {
              Severity: Major
              Found in src/blocks/login/index.jsx and 1 other location - About 1 hr to fix
              src/blocks/my-account/index.jsx on lines 41..49

              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 64.

              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 Edit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Edit = ( props ) => {
                  const { attributes } = props;
                  const blockProps = useBlockProps();
                  const courseOptions = usePostOptions();
              
              
              Severity: Minor
              Found in src/blocks/course-reviews/index.jsx - About 1 hr to fix

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

                const Edit = ( props ) => {
                    const { attributes } = props;
                    const blockProps = useBlockProps();
                    const courseOptions = usePostOptions();
                
                
                Severity: Minor
                Found in src/blocks/course-meta-info/index.jsx - About 1 hr to fix

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

                  const Edit = ( props ) => {
                      const { attributes } = props;
                      const blockProps = useBlockProps();
                      const courseOptions = usePostOptions();
                  
                  
                  Severity: Minor
                  Found in src/blocks/course-prerequisites/index.jsx - About 1 hr to fix

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

                            this.save_plans = function() {
                    
                                var self = this;
                    
                                self.$plans.find( '.llms-access-plan' ).not( '#llms-new-access-plan-model' ).each( function() {
                    Severity: Minor
                    Found in assets/js/llms-metabox-product.js - About 1 hr to fix

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

                      function setupPlugins( plugins, css, prefix, cleanAfterEveryBuildPatterns ) {
                          // Modify the CleanWebpackPlugin's cleanAfterEveryBuildPatterns config.
                          if ( cleanAfterEveryBuildPatterns.length ) {
                              plugins = plugins.filter( ( plugin ) => {
                                  if ( 'CleanWebpackPlugin' === plugin.constructor.name ) {
                      Severity: Minor
                      Found in packages/scripts/config/webpack.config.js - About 1 hr to fix

                        Method validate_upload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function validate_upload( $file ) {
                        
                                if ( ! empty( $file['error'] ) ) {
                        
                                    switch ( $file['error'] ) {
                        Severity: Minor
                        Found in includes/admin/class.llms.admin.import.php - About 1 hr to fix

                          Method output_instructors_assistant_fields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function output_instructors_assistant_fields( $user ) {
                          
                                  if ( is_numeric( $user ) || is_a( $user, 'WP_User' ) ) {
                                      $instructor = llms_get_instructor( $user );
                                      $selected   = $instructor->get( 'parent_instructors' );
                          Severity: Minor
                          Found in includes/admin/class.llms.admin.user.custom.fields.php - About 1 hr to fix

                            Method get_enrollment_data has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private static function get_enrollment_data( $post_id, $student, $post_type_object ) {
                            
                                    $data = array();
                            
                                    $data[] = array(
                            Severity: Minor
                            Found in includes/privacy/class-llms-privacy-exporters.php - About 1 hr to fix

                              Method get_test_settings has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function get_test_settings( $type ) {
                              
                                      if ( 'email' !== $type ) {
                                          return;
                                      }

                                Method llms_paginate_links has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function llms_paginate_links( $args ) {
                                
                                    global $wp_query;
                                
                                    $args = wp_parse_args(
                                Severity: Minor
                                Found in includes/functions/llms.functions.templates.loop.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language