Showing 1,386 of 1,391 total issues
File llms-functions-updates-300.php
has 428 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Update functions for version 3.0.0
*
* @package LifterLMS/Functions/Updates
Method get_settings_default
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function get_settings_default() {
$currency_code_options = get_lifterlms_currencies();
foreach ( $currency_code_options as $code => $name ) {
$currency_code_options[ $code ] = $name . ' (' . get_lifterlms_currency_symbol( $code ) . ')';
Function Edit
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Edit = ( props ) => {
const { attributes, setAttributes } = props;
const blockProps = useBlockProps();
const [ accessPlans, setAccessPlans ] = useState( [
{
Function save
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function save( $post_id ) {
if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) {
return;
}
- 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 update_lessons
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private static function update_lessons( $lessons, $section ) {
$ret = array();
foreach ( $lessons as $lesson_data ) {
- 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
LLMS_Admin_Table
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class LLMS_Admin_Table extends LLMS_Abstract_Exportable_Admin_Table {
/**
* Unique ID for the Table.
*
File llms-metabox-product.js
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Product Options MetaBox.
*
* Displays on Course & Membership Post Types.
*
Method get_fields
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_fields() {
$triggers = llms_get_engagement_triggers();
$types = llms_get_engagement_types();
Method llms_update_300_create_access_plans
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_300_create_access_plans() {
$courses = new WP_Query(
array(
'post_type' => array( 'course', 'llms_membership' ),
Similar blocks of code found in 2 locations. Consider refactoring. Open
array(
'name' => __( 'Awarded Certificates', 'lifterlms' ),
'singular_name' => __( 'Awarded Certificate', 'lifterlms' ),
'add_new' => __( 'Award Certificate', 'lifterlms' ),
'add_new_item' => __( 'Award New Certificate', 'lifterlms' ),
- 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 202.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
array(
'name' => __( 'Certificate Templates', 'lifterlms' ),
'singular_name' => __( 'Certificate Template', 'lifterlms' ),
'add_new' => __( 'Add Certificate Template', 'lifterlms' ),
'add_new_item' => __( 'Add New Certificate Template', 'lifterlms' ),
- 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 202.
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
Method query_students
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function query_students() {
_deprecated_function( __METHOD__, '6.2.0', 'the REST API list students endpoint' );
// Grab the search term if it exists.
Function update_custom_schemas
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public static function update_custom_schemas( $type, $post, $post_data ) {
$schemas = self::get_custom_schemas();
if ( empty( $schemas[ $type ] ) ) {
return;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
return array(
'{{CUSTOMER_ADDRESS}}' => __( 'Customer Address', 'lifterlms' ),
'{{CUSTOMER_NAME}}' => __( 'Customer Name', 'lifterlms' ),
'{{CUSTOMER_PHONE}}' => __( 'Customer Phone', 'lifterlms' ),
'{{ORDER_ID}}' => __( 'Order ID', 'lifterlms' ),
- 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 197.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
array(
'user_registration' => __( 'Student creates a new account', 'lifterlms' ),
'access_plan_purchased' => __( 'Student Purchases an Access Plan', 'lifterlms' ),
'course_enrollment' => __( 'Student enrolls in a course', 'lifterlms' ),
'course_purchased' => __( 'Student purchases a course', 'lifterlms' ),
- 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 197.
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
LLMS_Payment_Gateway
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class LLMS_Payment_Gateway extends LLMS_Abstract_Options_Data {
/**
* Optional gateway description for the admin panel
*
Method get_fields
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_fields() {
$lesson = llms_get_post( $this->post );
$methods = array(
Function save
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function save( $post_id ) {
if ( ! empty( llms_filter_input( INPUT_POST, 'llms_generate_export' ) ) || ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) {
return false;
}
- 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
File llms-quiz.js
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
;/* global LLMS, $ */
/* jshint strict: true */
/**
* Front End Quiz Class
File class.llms.install.php
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* LLMS_Install class file
*
* @package LifterLMS/Classes