gocodebox/lifterlms

View on GitHub

Showing 1,389 of 1,394 total issues

Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private static function create( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
Severity: Minor
Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

    Method create_actions has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function create_actions( $type, $user_id, $generated_id, $related_id = '', $engagement_id = null ) {
    Severity: Minor
    Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

      Method do_deprecated_filter has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function do_deprecated_filter( $args, $init_args, $type, $deprecated, $replacement ) {
      Severity: Minor
      Found in includes/class-llms-engagement-handler.php - About 35 mins to fix

        Method create_lesson has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected function create_lesson( $raw, $order, $section_id, $course_id, $fallback_author_id = null ) {
        Severity: Minor
        Found in includes/class-llms-generator-courses.php - About 35 mins to fix

          Method llms_get_user_postmeta has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function llms_get_user_postmeta( $user_id, $post_id, $meta_key = null, $single = true, $return = 'meta_value' ) {
          Severity: Minor
          Found in includes/functions/llms.functions.user.postmeta.php - About 35 mins to fix

            Method llms_update_user_postmeta has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function llms_update_user_postmeta( $user_id, $post_id, $meta_key, $meta_value, $unique = true ) {
            Severity: Minor
            Found in includes/functions/llms.functions.user.postmeta.php - About 35 mins to fix

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

                              } else if ( 'patch' === entry.significance ) {
                                  Object.keys( entry ).forEach( ( key ) => entry[ key ] = chalk.dim( entry[ key ] ) );
                              }
              Severity: Minor
              Found in packages/dev/src/cmds/changelog/list.js and 1 other location - About 35 mins to fix
              packages/dev/src/cmds/changelog/list.js on lines 28..32

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

              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

                      if ( ! $modal.length ) {
                          $modal = $( '<div class="llms-achievement-modal" id="' + id + '" />' );
                          $( 'body' ).append( $modal );
                      }
              Severity: Minor
              Found in assets/js/app/llms-achievements.js and 1 other location - About 35 mins to fix
              assets/js/llms-form-checkout.js on lines 132..135

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

              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

                          if ( ! $err.length ) {
                              $err = $( '<ul class="llms-notice llms-error" id="' + id + '" />' );
                              $( '.llms-checkout-wrapper' ).prepend( $err );
                          }
              Severity: Minor
              Found in assets/js/llms-form-checkout.js and 1 other location - About 35 mins to fix
              assets/js/app/llms-achievements.js on lines 80..83

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

              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

                              if ( 'major' === entry.significance ) {
                                  Object.keys( entry ).forEach( ( key ) => entry[ key ] = chalk.bold( entry[ key ] ) );
                              } else if ( 'patch' === entry.significance ) {
                                  Object.keys( entry ).forEach( ( key ) => entry[ key ] = chalk.dim( entry[ key ] ) );
                              }
              Severity: Minor
              Found in packages/dev/src/cmds/changelog/list.js and 1 other location - About 35 mins to fix
              packages/dev/src/cmds/changelog/list.js on lines 30..32

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

              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

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

                  public function set_args() {
              
                      $student = false;
                      if ( ! empty( $this->student ) ) {
                          $student = $this->student->get_id();
              Severity: Minor
              Found in includes/admin/reporting/tables/llms.table.student.course.php and 1 other location - About 35 mins to fix
              includes/admin/reporting/tables/llms.table.student.courses.php on lines 203..216

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

              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

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

                  public function set_args() {
              
                      $student = false;
                      if ( ! empty( $this->student ) ) {
                          $student = $this->student->get_id();
              Severity: Minor
              Found in includes/admin/reporting/tables/llms.table.student.courses.php and 1 other location - About 35 mins to fix
              includes/admin/reporting/tables/llms.table.student.course.php on lines 235..248

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

              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 getChangelogSection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function getChangelogSection( file, length ) {
                  const entries = parseChangelogFile( file ),
                      total = entries.length,
                      lines = [];
              
              
              Severity: Minor
              Found in packages/dev/src/cmds/readme.js - About 35 mins 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 send_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function send_data( $force = false ) {
              
                      // Don't trigger during AJAX Requests.
                      if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
                          return;
              Severity: Minor
              Found in includes/class.llms.tracker.php - About 35 mins 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 action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  action: ( { dir } ) => {
                      const val = {
                          major: 2,
                          minor: 1,
                          patch: 0,
              Severity: Minor
              Found in packages/dev/src/cmds/changelog/list.js - About 35 mins 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 restricted_by_quiz has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function restricted_by_quiz( $info ) {
              
                      $msg      = '';
                      $redirect = '';
              
              
              Severity: Minor
              Found in includes/class.llms.template.loader.php - About 35 mins 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __construct() {
              
                      if ( isset( $_GET['post_type'] ) && 'page' === $_GET['post_type'] ) {
              
                          $pages = array(

              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 modify_views has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function modify_views( $views ) {
              
                      if ( LLMS_User_Permissions::is_current_user_instructor() ) {
              
                          $users = count_users();
              Severity: Minor
              Found in includes/admin/class-llms-admin-users-table.php - About 35 mins 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 pre_get_posts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function pre_get_posts( $query ) {
              
                      if ( ! is_admin() ) {
                          return;
                      }

              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 get_results has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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