Showing 1,420 of 1,425 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
if ( 'clone' === event.action ) {
question = _.prepareQuestionObjectForCloning( question );
} else {
// Use author id instead of the question author object.
question = _.prepareExistingPostObjectDataForAddingOrCloning( question );
- 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 62.
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
Consider simplifying this complex logical expression. Open
if ( is_home() && $sitewide_membership_id ) {
$restriction_id = $sitewide_membership_id;
$reason = 'sitewide_membership';
// if it's a search page and the site isn't restricted to a membership bypass restrictions.
} elseif ( ( is_search() ) && ! get_option( 'lifterlms_membership_required', '' ) ) {
Consider simplifying this complex logical expression. Open
if ( ! function_exists( 'is_lifterlms' ) ) {
/**
* Determine if a LifterLMS post type or post type archive is being displayed.
*
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function __construct() {
$this->id = 'courses';
$this->label = __( 'Courses', '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 107.
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 3 locations. Consider refactoring. Open
public function __construct() {
$this->id = 'general';
$this->label = __( 'General', '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 107.
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 3 locations. Consider refactoring. Open
public function __construct() {
$this->id = 'memberships';
$this->label = __( 'Memberships', '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 107.
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
Function Donut
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Donut(options) {
this.settings = $.extend( {
element: options.element,
percent: 100
Function init_formatting_els
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
init_formatting_els: function() {
var self = this;
this.$el.find( '.llms-input-formatting[data-formatting]' ).each( function() {
Function addEvent
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.addEvent = function( event, args ) {
args = args || {};
if ( 'string' === typeof event ) {
args.event = event;
Method output
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output() {
?>
<div id="posttype-llms-nav-items" class="posttypediv">
<div id="tabs-panel-llms-nav-items" class="tabs-panel tabs-panel-active">
Method get_dashboard_widget_data
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_dashboard_widget_data() {
return apply_filters(
/**
* Filters the dashboard widget data.
*
Method parse_engagement
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parse_engagement( $engagement, $trigger_data ) {
$parsed = array(
'handler_action' => null,
'handler_args' => null,
Method maybe_schedule_retry
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function maybe_schedule_retry() {
if ( ! $this->can_be_retried() ) {
return null;
}
Method get_link
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_link( $context = 'course' ) {
$url = '';
switch ( $this->get( 'meta_key' ) ) {
Method get_posts
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_posts( $args = array(), $return = 'llms_posts' ) {
$serialized_id = serialize( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
array(
'id' => $this->get_id(),
Method checkout
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function checkout( $atts ) {
// if there are membership restrictions, check the user is in at least one membership.
// this is to combat CHEATERS.
if ( $atts['plan']->has_availability_restrictions() ) {
Method set_merge_data
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function set_merge_data( $code ) {
$order = $this->post;
switch ( $code ) {
Method llms_update_500_add_admin_notice
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_500_add_admin_notice() {
require_once LLMS_PLUGIN_DIR . 'includes/admin/class.llms.admin.notices.php';
$notice_id = 'v500-welcome-msg';
Method llms_sd_my_grades_table_content
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_sd_my_grades_table_content( $id, $lesson, $student, $restrictions ) {
ob_start();
/**
Similar blocks of code found in 2 locations. Consider refactoring. Open
it.each( testData )( '%s', ( name, slug, expected, isPublic ) => {
mockedApiReturn = getMockApiReturn( isPublic );
mockedSlug = slug;
expect( getProjectPrivacy() ).toBe( expected );
} );
- 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 61.
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