Showing 1,420 of 1,425 total issues
File llms.table.course.students.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Display students enrolled in a given course on the course students subtab
*
* @package LifterLMS/Admin/Reporting/Tables/Classes
Function submit
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.submit = function( e ) {
var self = e.data,
num = before_submit.length,
checks = 0,
Consider simplifying this complex logical expression. Open
if ( $blog_id === $object_id ) {
$menu_items[ $key ]->current = false;
foreach ( array( 'current_page_parent', 'current-menu-item' ) as $class ) {
if ( in_array( $class, $classes, true ) ) {
Method output
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output() {
?>
<div class="llms-dashboard-widget-wrap">
<h3><?php esc_html_e( 'Activity this week:', 'lifterlms' ); ?></h3>
<a class="llms-button-primary" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=course' ) ); ?>">
Method includes
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function includes() {
// Instantiate LLMS_Shortcodes before LLMS_Controller_Orders.
require_once LLMS_PLUGIN_DIR . 'includes/shortcodes/class.llms.shortcodes.php';
require_once LLMS_PLUGIN_DIR . 'includes/shortcodes/class.llms.shortcodes.blocks.php';
Method migrate_spanish_users
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function migrate_spanish_users() {
$per_page = \llms_update_util_get_items_per_page();
$states_migration_map = array(
Method llms_update_300_migrate_account_field_options
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_300_migrate_account_field_options() {
$email_confirm = get_option( 'lifterlms_registration_confirm_email' );
if ( 'yes' === $email_confirm ) {
$email_confirm = 'yes';
Method llms_is_post_restricted_by_prerequisite
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_is_post_restricted_by_prerequisite( $post_id, $user_id = null ) {
$post_type = get_post_type( $post_id );
switch ( $post_type ) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function send_test( $type, $data = array() ) {
if ( empty( $data['attempt_id'] ) ) {
return;
}
$attempt = new LLMS_Quiz_Attempt( $data['attempt_id'] );
- 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 121.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function send_test( $type, $data = array() ) {
if ( empty( $data['attempt_id'] ) ) {
return;
}
- 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 121.
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 manage_columns
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function manage_columns( $column, $post_id ) {
$lesson = llms_get_post( $post_id );
if ( ! $lesson ) {
return;
Method get_data
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_data( $key, $achievement ) {
// Handle old object being passed in.
if ( ! is_a( $achievement, 'LLMS_User_Achievement' ) && property_exists( $achievement, 'achievement_id' ) ) {
$achievement = new LLMS_User_Achievement( $achievement->certificate_id );
Method get_admin_settings_fields
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_admin_settings_fields() {
$fields = array();
$fields[] = array(
Method set_merge_data
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function set_merge_data( $code ) {
$quiz_id = $this->notification->get( 'post_id' );
$attempt = $this->user->quizzes()->get_last_completed_attempt( $quiz_id );
if ( ! $attempt ) {
Similar blocks of code found in 3 locations. Consider refactoring. Open
describe( 'trailingSlashIt', () => {
const testData = [
[
'Should leave a string with a trailing slash unchanged',
'string/',
- 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 74.
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
describe( 'untrailingSlashIt', () => {
const testData = [
[
'Should leave a string without a trailing slash unchanged',
'string',
- 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 74.
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
describe( 'getIssueLink', () => {
const testData = [
[ 'Should accept issue references to the current project', 'https://github.com/gocodebox/lifterlms/issues/123', '#123' ],
[ 'Should accept issue references to the another project', 'https://github.com/org/repo/issues/456', 'org/repo#456' ],
];
- 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 74.
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 answer_question
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
answer_question: function( $btn ) {
var self = this,
$question = this.$container.find( '.llms-question-wrapper' ),
type = $question.attr( 'data-type' ),
Method get_table_html
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function get_table_html() {
$integrations = llms()->integrations()->get_integrations();
ob_start();
?>
Method get_data
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_data( $key, $course_id ) {
$course = new LLMS_Course( $course_id );
switch ( $key ) {