Showing 1,420 of 1,425 total issues
Function llms_bulk_delete_user_postmeta
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function llms_bulk_delete_user_postmeta( $user_id, $post_id, $data = array() ) {
$res = array_fill_keys( array_keys( $data ), null );
$err = false;
- 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 toggle_switch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toggle_switch: function( event ) {
event.stopPropagation();
var $el = $( event.target ),
attr = $el.attr( 'name' ),
Function options
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
options: function() {
var options = [
{
key: '',
Function get_available_prereq_options
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get_available_prereq_options: function() {
var parent_section_index = this.get_parent().collection.indexOf( this.get_parent() ),
lesson_index_in_section = this.collection.indexOf( this ),
options = [];
Function createUser
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function createUser( opts = {} ) {
await visitAdminPage( 'user-new.php' );
const login = `mock_${ Math.random().toString( 36 ).slice( 2 ) }`;
opts = Object.assign(
Method get_post_type_filter_html
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function get_post_type_filter_html( $name, $post_type = 'course', $selected = array() ) {
$id = sprintf( 'filter-by-llms-post-%s', $post_type );
$obj = get_post_type_object( $post_type );
Method get_css
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_css( $rule = '', $echo = true ) {
if ( empty( $rule ) ) {
return '';
}
Method get_fields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_fields() {
$next_id = llms_get_certificate_sequential_id( $this->post->ID );
$fields = array(
Method save
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function save( $post_id ) {
if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) ) {
return;
}
Method output
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function output() {
global $post;
if ( ! in_array( $post->post_type, array( 'course', 'llms_membership' ) ) ) {
Method get_fields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_fields() {
$fields = array();
if ( 'llms_achievement' === $this->post->post_type ) {
Method calculate_grade_from_children
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function calculate_grade_from_children( $children, $student ) {
$grade = null;
$grades = array();
Method output_table_filters_html
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function output_table_filters_html() {
$select_id = sprintf( '%1$s-%2$s-filter', $this->id, 'course-membership' );
$instructor_id = null;
// Limit Course/Membership results based on instructor access.
if ( ! current_user_can( 'view_others_lifterlms_reports' ) && current_user_can( 'view_lifterlms_reports' ) ) {
Method set_query
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function set_query() {
global $wpdb;
$dates = $this->get_posted_dates();
Method get_custom_schemas
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function get_custom_schemas() {
$quiz_fields = array();
/**
Method block_templates_from_db
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function block_templates_from_db( $slugs = array() ) {
$query_args = array(
'post_status' => array( 'auto-draft', 'draft', 'publish' ),
'post_type' => 'wp_template',
Method calculate_next_payment_date
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function calculate_next_payment_date( $format = 'Y-m-d H:i:s' ) {
// If the limited plan has already ended return early.
$remaining = $this->get_remaining_payments();
if ( 0 === $remaining ) {
Method get_checkout_url
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_checkout_url( $check_availability = true ) {
$ret = '#llms-plan-locked';
$available = $this->is_available_to_user( get_current_user_id() );
Method get_merge_data
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function get_merge_data() {
$template_id = $this->get( 'parent' );
$user_id = $this->get_user_id();
$related_id = $this->get( 'related' );
Method insert_incompletion_postmeta
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function insert_incompletion_postmeta( $object_id, $trigger = 'unspecified' ) {
global $wpdb;
// Add '_is_complete' to the user postmeta table for object.