Showing 1,420 of 1,425 total issues
Method heartbeat_received
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function heartbeat_received( $res, $data ) {
// Exit if there's no builder data in the heartbeat data.
if ( empty( $data['llms_builder'] ) ) {
return $res;
Method sideload_images
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function sideload_images( $post, $raw ) {
// Sideloading is disabled.
if ( ! $this->is_image_sideloading_enabled() ) {
return null;
Method get_order_data_props
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function get_order_data_props( $type ) {
$props = array();
// don't erase these fields, only export them
Method validate_field
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate_field( $posted_value, $field ) {
// Validate field by type.
$type_map = array(
'email' => array( $this, 'validate_field_email' ),
Method create_question
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function create_question( $raw, $manager, $author_id ) {
/**
* Filter raw question import data prior to generation
*
Method handle_caps
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle_caps( $allcaps, $cap, $args ) {
/**
* Modify the list of post types that users may not own but can still edit based on instructor permissions on the course
*
Method prepare_meta_query_for_relationships
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function prepare_meta_query_for_relationships() {
$meta_query = array();
$relations = array(
Method render_block
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render_block( array $attributes, string $content, WP_Block $block ): string {
if ( ! property_exists( $block, 'name' ) ) {
return '';
}
Method handle_prerequisites
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handle_prerequisites() {
foreach ( array( 'course', 'lesson' ) as $obj_type ) {
$ids = ! empty( $this->tempids[ $obj_type ] ) ? $this->tempids[ $obj_type ] : array();
Method set_body_email
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function set_body_email() {
$mailer = llms()->mailer();
$rows = array(
Similar blocks of code found in 2 locations. Consider refactoring. Open
on_trashed: function( quiz ) {
this.lesson.set( 'quiz_enabled', 'no' );
this.lesson.set( 'quiz', '' );
- 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 59.
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
on_trashed: function( assignment ) {
this.lesson.set( 'assignment_enabled', 'no' );
this.lesson.set( 'assignment', '' );
- 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 59.
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 bind
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
bind: function() {
var self = this;
// start quiz
Function delete_plan
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.delete_plan = function( $btn ) {
var self = this,
$plan = $btn.closest( '.llms-access-plan' ),
plan_id = $plan.attr( 'data-id' ),
Function draggable
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
draggable: function() {
$( '#llms-new-section' ).draggable( {
appendTo: '#llms-sections',
cancel: false,
Function load_questions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
load_questions: function( cb ) {
if ( this.get( '_questions_loaded' ) ) {
cb();
Function favorite
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
favorite: function( $btn ) {
var object_id = $btn.attr( 'data-id' ),
object_type = $btn.attr( 'data-type' ),
user_action = $btn.attr( 'data-action' );
Function success
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function( res ) {
if ( ! res.success && res.message ) {
activate_button();
Method get_model
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_model() {
return apply_filters(
'llms_question_type_model_defaults',
array(
Method output
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output( $post ) {
global $post;
if ( 'publish' !== $post->post_status ) {
esc_html_e( 'You need to publish this post before you can generate a CSV.', 'lifterlms' );