Showing 1,420 of 1,425 total issues
Function updateDOM
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDOM() {
const { getCurrentPostAttribute, getEditedPostAttribute, getCurrentPostType } = select( editorStore ),
bg = getEditedPostAttribute( 'certificate_background' ),
margins = getEditedPostAttribute( 'certificate_margins' ),
width = getEditedPostAttribute( 'certificate_width' ),
Function draw_chart
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.draw_chart = function() {
if ( ! this.charts_loaded || ! this.is_loading_finished() ) {
return;
}
Function start_quiz_timer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
start_quiz_timer: function( total_minutes ) {
// create and append the UI for the countdown clock
var $el = $( '<div class="llms-quiz-timer" id="llms-quiz-timer" />' ),
msg = LLMS.l10n.translate( 'Time Remaining' );
Function bind
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
bind: function() {
var self = this;
self.$repeaters.each( function() {
Method sql_where
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function sql_where() {
global $wpdb;
$sql = 'WHERE 1';
Method maybe_restrict_post_content
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function maybe_restrict_post_content( $post, $query ) {
/**
* Filters the post types that must be skipped.
*
* The LifterLMS post types content restriction should be handled by the LifterLMS rest-api.
Method get_settings_group_email
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_settings_group_email() {
return $this->generate_settings_group(
'email_options',
__( 'Email Settings', 'lifterlms' ),
Method output_copy_box
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output_copy_box() {
?>
<div class="llms-setting-group top">
<p class="llms-label"><?php esc_html_e( 'Support', 'lifterlms' ); ?></p>
<div id="llms-debug-report">
Method breadcrumbs
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function breadcrumbs() {
$links = array();
// Single student.
Method __construct
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
$this->id = 'setup';
$this->views_dir = LLMS_PLUGIN_DIR . 'includes/admin/views/setup-wizard/';
$this->title = esc_html__( 'LifterLMS Setup Wizard', 'lifterlms' );
$this->steps = array(
Method process_detachments
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function process_detachments( $data ) {
$ret = array();
foreach ( $data['detach'] as $id ) {
Method add_note
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_note( $note, $added_by_user = false ) {
if ( ! $note ) {
return;
}
Method output_tfoot_html
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output_tfoot_html() {
?>
<tfoot>
<tr>
<th colspan="<?php echo esc_attr( $this->get_columns_count() ); ?>">
Method get_access_plans
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_access_plans( $free_only = false, $visible_only = true ) {
$args = array(
'meta_key' => '_llms_product_id', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
'meta_value' => $this->get( 'id' ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
Method record
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function record( $args = array() ) {
$err = new WP_Error();
foreach ( array( 'actor_id', 'object_type', 'object_id', 'event_type', 'event_action' ) as $key ) {
Method dupcheck
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function dupcheck( $type, $user_id, $template_id, $related_id = '', $engagement_id = null ) {
$student = llms_get_student( $user_id );
$query = new LLMS_Awards_Query(
Method llms_get_certificate_fonts
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_get_certificate_fonts() {
/**
* Determines whether or not webfonts are loaded from Google CDNs.
*
* @since 6.11.0
Method llms_update_300_migrate_lesson_postmeta
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_300_migrate_lesson_postmeta() {
global $wpdb;
llms_update_util_rekey_meta( 'lesson', '_llms_audio_embed', '_audio_embed' );
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( Array.isArray( logEntry.attributions ) ) {
logEntry.attributions.forEach( ( attribution ) => {
if ( ! isAttributionValid( attribution ) ) {
errors.push( `The attribution ${ highlight( attribution, formatting ) } is invalid.` );
}
- 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 63.
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
if ( Array.isArray( logEntry.links ) ) {
logEntry.links.forEach( ( link ) => {
if ( ! isLinkValid( link ) ) {
errors.push( `The link ${ highlight( link, formatting ) } is invalid.` );
}
- 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 63.
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