gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Method update_quiz has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function update_quiz( $quiz_data, $lesson ) {

        $res = array_merge(
            $quiz_data,
            array(
Severity: Minor
Found in includes/admin/class.llms.admin.builder.php - About 1 hr to fix

    Method get_enrollment_order has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_enrollment_order( $product_id ) {
    
            // If a lesson id was passed in, cascade up to the course for order retrieval.
            if ( 'lesson' === get_post_type( $product_id ) ) {
                $lesson     = new LLMS_Lesson( $product_id );
    Severity: Minor
    Found in includes/models/model.llms.student.php - About 1 hr to fix

      Method duplicate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function duplicate( $post_id ) {
      
              // Make sure we have a post id and it returns a post.
              if ( ! isset( $post_id ) ) {
                  return false;
      Severity: Minor
      Found in includes/class.llms.lesson.handler.php - About 1 hr to fix

        Method add_post_actions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function add_post_actions( $actions, $post ) {
        
                if ( ! $post || "llms_{$this->engagement_type}" !== $post->post_type ) {
                    return $actions;
                }
        Severity: Minor
        Found in includes/traits/llms-trait-award-templates-post-list-table.php - About 1 hr to fix

          Method llms_get_author has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function llms_get_author( $args = array() ) {
          
              $args = wp_parse_args(
                  $args,
                  array(
          Severity: Minor
          Found in includes/llms.template.functions.php - About 1 hr to fix

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

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

              Method llms_template_my_favorites_loop has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function llms_template_my_favorites_loop( $student = null, $favorites = null ) {
              
                      $student = llms_get_student( $student );
                      if ( ! $student ) {
                          return;
              Severity: Minor
              Found in includes/functions/llms.functions.templates.dashboard.php - About 1 hr to fix

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

                                case 'audio_embed':
                                    defaults.classes.push( 'llms-editable-audio' );
                                    defaults.placeholder = 'https://';
                                    defaults.tip         = LLMS.l10n.translate( 'Use SoundCloud or Spotify audio URLS.' );
                                    defaults.input_type  = 'url';
                Severity: Major
                Found in assets/js/builder/Views/SettingsFields.js and 1 other location - About 1 hr to fix
                assets/js/builder/Views/SettingsFields.js on lines 348..353

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

                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

                                case 'video_embed':
                                    defaults.classes.push( 'llms-editable-video' );
                                    defaults.placeholder = 'https://';
                                    defaults.tip         = LLMS.l10n.translate( 'Use YouTube, Vimeo, or Wistia video URLS.' );
                                    defaults.input_type  = 'url';
                Severity: Major
                Found in assets/js/builder/Views/SettingsFields.js and 1 other location - About 1 hr to fix
                assets/js/builder/Views/SettingsFields.js on lines 316..321

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

                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

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

                    protected function get_text( $text_type, $variables = array() ) {
                
                        $engagement_template_id = $variables['engagement_template_id'] ?? 0;
                
                        switch ( $text_type ) {
                Severity: Minor
                Found in includes/processors/class-llms-processor-achievement-sync.php - About 1 hr to fix

                  Function coupon_apply has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          this.coupon_apply = function ( $btn ) {
                  
                              var self       = this,
                                  $code      = $( '#llms_coupon_code' ),
                                  code       = $code.val(),
                  Severity: Minor
                  Found in assets/js/llms-form-checkout.js - About 1 hr to fix

                    Function bind_mce_fixes has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                             this.bind_mce_fixes = function() {
                    
                                // We need `wp.data` to proceed.
                                if ( undefined === wp.data || [ null, undefined ].includes( wp.data.select( 'core/edit-post' ) ) ) {
                                    return;
                    Severity: Minor
                    Found in assets/js/private/llms-metaboxes.js - About 1 hr to fix

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

                      const Edit = ( props ) => {
                          const { attributes, setAttributes } = props;
                          const blockProps = useBlockProps();
                      
                          const memoizedServerSideRender = useMemo( () => {
                      Severity: Minor
                      Found in src/blocks/my-account/index.jsx - About 1 hr to fix

                        Function make_editable has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    function make_editable( $field ) {
                        
                                        var $label   = $field.find( 'label' ).clone(),
                                            name     = $field.attr( 'data-llms-editable' ),
                                            type     = $field.attr( 'data-llms-editable-type' ),
                        Severity: Minor
                        Found in assets/js/private/llms-metaboxes.js - About 1 hr to fix

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

                              protected function get_text( $text_type, $variables = array() ) {
                          
                                  $engagement_template_id = $variables['engagement_template_id'] ?? 0;
                          
                                  switch ( $text_type ) {
                          Severity: Minor
                          Found in includes/processors/class-llms-processor-certificate-sync.php - About 1 hr to fix

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

                                public function handle_link_actions() {
                            
                                    $action = llms_filter_input( INPUT_GET, 'action' );
                            
                                    // Bail early if request doesn't concern us.
                            Severity: Minor
                            Found in includes/admin/post-types/class.llms.post.tables.php - About 1 hr to fix

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

                                  private function redemption_section_html() {
                              
                                      global $post;
                              
                                      $pid            = $post->ID;

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

                                    public static function register_meta_boxes() {
                                
                                        add_meta_box(
                                            'llms_dashboard_quick_links',
                                            __( 'Quick Links', 'lifterlms' ),
                                Severity: Minor
                                Found in includes/admin/class.llms.admin.dashboard.php - About 1 hr to fix

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

                                      public function get_results( $args = array() ) {
                                  
                                          $args = $this->clean_args( $args );
                                  
                                          if ( is_numeric( $args['student'] ) ) {
                                  Severity: Minor
                                  Found in includes/admin/reporting/tables/llms.table.student.courses.php - About 1 hr to fix

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

                                        protected function set_columns() {
                                            return array(
                                                'id'       => array(
                                                    'exportable' => true,
                                                    'title'      => __( 'ID', 'lifterlms' ),
                                    Severity: Minor
                                    Found in includes/admin/reporting/tables/llms.table.quizzes.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language