Function handle_caps
has a Cognitive Complexity of 17 (exceeds 5 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
*
- 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 editable_roles
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function editable_roles( $all_roles ) {
/**
* Prevent issues when other plugins call get_editable_roles() before `init`.
*
- 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 handle_cap_view_grades
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function handle_cap_view_grades( $allcaps, $args ) {
// Logged out user or missing required args.
if ( empty( $args[1] ) || empty( $args[2] ) ) {
return $allcaps;
- 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 user_can_manage_user
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function user_can_manage_user( $user_id, $edit_id ) {
$user = get_user_by( 'id', $user_id );
/**
- 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
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 editable_roles
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function editable_roles( $all_roles ) {
/**
* Prevent issues when other plugins call get_editable_roles() before `init`.
*
Method user_can_manage_user
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function user_can_manage_user( $user_id, $edit_id ) {
$user = get_user_by( 'id', $user_id );
/**
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $all_roles;