Showing 1,389 of 1,394 total issues
Function Edit
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Edit = ( props ) => {
const { attributes, setAttributes } = props;
const blockProps = useBlockProps();
const [ users, setUsers ] = useState( [] );
Method llms_update_3160_ensure_no_dupe_question_rels
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_3160_ensure_no_dupe_question_rels() {
if ( 'complete' !== get_transient( 'llms_update_3160_attempt_migration' ) ) {
return true;
}
Function action
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
action: async ( { archive, dir, commitMessage, branch, logfile, prerelease, prereleaseBranch, draft, merge, yes, verbose } ) => {
// Ensure the CLI is installed before proceeding.
try {
execSync( 'which gh', true );
} catch ( Error ) {
- 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_price_with_coupon
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function get_price_with_coupon( $key, $coupon_id, $price_args = array(), $format = 'html' ) {
// Allow id or instance to be passed for $coupon_id.
if ( $coupon_id instanceof LLMS_Coupon ) {
$coupon = $coupon_id;
- 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 lifterlms_template_student_dashboard_my_notifications
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function lifterlms_template_student_dashboard_my_notifications() {
$url = llms_get_endpoint_url( 'notifications', '', llms_get_page_url( 'myaccount' ) );
$sections = 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function get_period_filters() {
return array(
'today' => esc_attr__( 'Today', 'lifterlms' ),
'yesterday' => esc_attr__( 'Yesterday', '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 143.
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
protected function set_merge_codes() {
return array(
'{{COURSE_PROGRESS}}' => __( 'Course Progress Bar', 'lifterlms' ),
'{{COURSE_TITLE}}' => __( 'Course Title', 'lifterlms' ),
'{{GRADE}}' => __( 'Grade', '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 143.
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 llms-abstract-generator-posts.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Generate LMS Content from export files or raw arrays of data.
*
* @package LifterLMS/Abstracts/Classes
Function MetaboxStudents
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
var MetaboxStudents = function() {
/**
* Initialize
*
File class.llms.shortcodes.php
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* LifterLMS Shortcodes
*
* @package LifterLMS/Classes/Shortcodes
LLMS_Abstract_Query
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class LLMS_Abstract_Query {
/**
* Identify the extending query.
*
LLMS_Form_Field
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class LLMS_Form_Field {
/**
* Form Field Settings
*
Function setup_field
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup_field: function( orig_field, field_index ) {
var defaults = {
classes: [],
id: _.uniqueId( orig_field.attribute + '_' ),
Method init
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init( $user_data, $plan, $gateway, $coupon = false ) {
$this->set_user_data( $user_data );
// Access plan data.
Method get_enrollments
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_enrollments( $post_type = 'course', $args = array() ) {
global $wpdb;
$args = wp_parse_args(
Method llms_expire_membership
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_expire_membership() {
global $wpdb;
// find all memberships wth an expiration date
$args = array(
File class.llms.data.php
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Retrieve data sets used by various other classes and functions
*
* @package LifterLMS/Classes
Method llms_create_page
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_create_page( $slug, $title = '', $content = '', $option = '' ) {
$option_val = get_option( $option );
// See if there's a valid page already stored for the option we're trying to create.
Function manage_columns
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function manage_columns( $column, $post_id ) {
global $post;
$order = new LLMS_Order( $post_id );
- 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 autoload
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function autoload( $class ) {
$class = strtolower( $class );
if ( 0 !== strpos( $class, 'llms_' ) && 'lifterlms' !== $class && 'meta_box_field_interface' !== $class ) {
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"