Showing 1,389 of 1,394 total issues
Function llms_expire_membership
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function llms_expire_membership() {
global $wpdb;
// find all memberships wth an expiration date
$args = array(
- Read upRead up
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 llms_update_300_migrate_account_field_options
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function llms_update_300_migrate_account_field_options() {
$email_confirm = get_option( 'lifterlms_registration_confirm_email' );
if ( 'yes' === $email_confirm ) {
$email_confirm = 'yes';
- Read upRead up
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
public static function handle_page_header_wrappers() {
/** This filter is documented in templates/loop.php */
$show_title = apply_filters( 'lifterlms_show_page_title', true );
- Read upRead up
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 140.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
public static function handle_page_header_wrappers() {
/** This filter is documented in templates/loop.php */
$show_title = apply_filters( 'lifterlms_show_page_title', true );
- Read upRead up
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 140.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File class.llms.settings.checkout.php
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Admin Settings Page, Checkout Tab
*
* @package LifterLMS/Admin/Settings/Classes
Function llmsPostsSelect2
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.llmsPostsSelect2 = function( options ) {
var self = this,
options = options || {},
defaults = {
Method llms_update_3160_ensure_no_lesson_dupe_rels
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_3160_ensure_no_lesson_dupe_rels() {
if ( 'complete' !== get_transient( 'llms_update_3160_ensure_no_dupe_question_rels_status' ) ) {
return true;
}
Method get_existing_posts
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_existing_posts( $post_type = '', $search_term = '', $page = 1 ) {
$args = array(
'order' => 'ASC',
'orderby' => 'post_title',
Method llms_get_restriction_message
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_get_restriction_message( $restriction ) {
$msg = __( 'You do not have permission to access this content', 'lifterlms' );
switch ( $restriction['reason'] ) {
LLMS_Email
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class LLMS_Email {
/**
* @var array
* @since 3.15.0
Method output
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output( $atts ) {
global $wp;
$atts = $atts ? $atts : array();
Method get_results
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_results( $args = array() ) {
$this->title = __( 'Students', 'lifterlms' );
if ( ! $args ) {
Function menu_item_classes
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function menu_item_classes( $menu_items ) {
if ( ! function_exists( 'is_lifterlms' ) || ! is_lifterlms() ) {
return $menu_items;
}
- Read upRead up
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_data
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function get_data( $key, $student ) {
switch ( $key ) {
case 'achievements':
- Read upRead up
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_block_tree
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function get_block_tree( $block, $block_list ) {
foreach ( $block_list as &$_block ) {
// Found the block.
- Read upRead up
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 prepare_options
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_options( $raw ) {
$prepared = array();
foreach ( $raw as $key => $val ) {
- Read upRead up
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 llms_is_post_restricted_by_membership
has a Cognitive Complexity of 20 (exceeds 5 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',
- Read upRead up
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 llms_update_3160_update_attempt_question_data
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function llms_update_3160_update_attempt_question_data() {
if ( 'complete' !== get_transient( 'llms_update_3160_update_question_data' ) ) {
return true;
}
- Read upRead up
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 bind_llms_order
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.bind_llms_order = function() {
$( 'button[name="llms-refund-toggle"]' ).on( 'click', function() {
var $btn = $( this ),
Function Tracking
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
LLMS.Tracking = function( settings ) {
settings = settings || {};
var self = this,