Showing 137 of 273 total issues
Method find
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find( $class, $id, array $params = array() ) {
global $wpdb;
$result = $wpdb->get_row(
$wpdb->prepare(
Method filter_hooks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function filter_hooks() {
return array(
array(
'hook' => 'params.state.globals',
'method' => 'apply_globals',
Method dispatch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dispatch( Collection $items = null ) {
if ( null === $items ) {
$items = $this->fetch_items();
}
Method log_response_error_impl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function log_response_error_impl( $error_message, $auth_message, $client_message, $id, WP_Error $response ) {
$this->log(
sprintf(
$error_message,
$id,
Function create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function create( $class, array $data = array(), array $options = array() ) {
foreach ( $this->repositories as $interface => $repository ) {
if ( is_subclass_of( $class, $interface ) ) {
$model = $repository->create( $class, $data, $options );
- 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 filter_unregistered_params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function filter_unregistered_params( $response, $handler, WP_REST_Request $request ) {
if ( strpos( $request->get_route(), 'intraxia/v1/gistpen' ) === false ) {
return $response;
}
- 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 isSpecialEvent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function isSpecialEvent(
evt: KeyboardEvent | React.KeyboardEvent,
): boolean {
const { altKey, metaKey, ctrlKey } = evt;
const cmdOrCtrl = metaKey || ctrlKey;
- 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 editorReducer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const editorReducer: EddyReducer<EditorState, RootAction> = (
state = defaultState,
action: RootAction,
) => {
switch (action.type) {
- 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 process_response
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function process_response( Requests_Response $response ) {
$json = $response->json = json_decode( $response->body );
if ( ! $response->success ) {
// 4XX errors: client-side problems
- 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 isSpecialEvent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function isSpecialEvent(
evt: KeyboardEvent | React.KeyboardEvent,
): boolean {
const { altKey, metaKey, ctrlKey } = evt;
const cmdOrCtrl = metaKey || ctrlKey;
- 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 persist
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function persist( Model $model ) {
foreach ( $this->repositories as $interface => $repository ) {
if ( is_subclass_of( $model, $interface ) ) {
$model = $repository->persist( $model );
- 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 apply_jobs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function apply_jobs( $params ) {
$params['jobs'] = $this->jobs->serialize();
$parts = $params['route']['parts'];
if ( 'jobs' === $params['route']['name'] && ! isset( $parts->run ) && ! isset( $parts->job ) ) {
- 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
Avoid deeply nested control flow statements. Open
if (
isFirstLineWithoutSelection &&
' ' === newRolBefore.charAt(newRolBefore.length - 1)
) {
newRolBefore = rolBefore.slice(0, newRolBefore.length - 1);
Function mapStateToProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const mapStateToProps = (
state: State,
): React.ComponentProps<typeof View> => ({
route: (state.route && state.route.name) || null,
edit: {
- 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
Avoid deeply nested control flow statements. Open
if (
isFirstLineWithoutSelection &&
' ' === newRolBefore.charAt(newRolBefore.length - 1)
) {
newRolBefore = rolBefore.slice(0, newRolBefore.length - 1);
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct( EntityManager $em, Params $params, Templating $templating, $path, $url ) {
Method log_response_error_impl
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function log_response_error_impl( $error_message, $auth_message, $client_message, $id, WP_Error $response ) {
Function get_patch_from_args
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function get_patch_from_args( $args, $assoc_args, $defaults ) {
if ( ! isset( $args[0] ) ) {
$value = WP_CLI::get_value_from_arg_or_stdin( $args, -1 );
$patch = WP_CLI::read_value( $value, $assoc_args );
} else {
- 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 ErrorMsg
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const ErrorMsg: React.FC<{ error: { message: string; body?: string } }> = ({
error,
}) => {
const ref = useRef<HTMLDivElement>(null);
- 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 find
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function find( $class, $id, array $params = array() ) {
if ( ! is_subclass_of( $class, 'Intraxia\Jaxion\Axolotl\Model' ) ) {
return new WP_Error( 'invalid_model', __( 'Invalid model', 'wp-gistpen' ) );
}
- 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"