Showing 137 of 273 total issues
Method fill_relations
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fill_relations( Model $model, array $params ) {
if ( ! isset( $params['with'] ) ) {
$params['with'] = array();
}
Method find
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find( $class, $id, array $params = array() ) {
$post_type = $class::get_post_type();
$post = get_post( $id );
if ( ! $post || $post->post_type !== $post_type ) {
Function findOffset
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function findOffset(root: Element, ss: number): Offset {
let container;
let offset = 0;
let element: ChildNode | null = root;
Function refback
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
ref$.flatMap(el => {
const keyUp$ = Kefir.fromEvents<KeyboardEvent, never>(el, 'keyup').setName(
'keyUp$',
);
const keyDown$ = Kefir.fromEvents<KeyboardEvent, never>(
Function process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
if ( $this->is_running() ) {
return new WP_Error(
'job_running',
sprintf(
- 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 find_by
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find_by( $class, array $params = array() ) {
global $wpdb;
$models = new Collection( $class );
$query = "SELECT * FROM {$this->em->make_table_name( $class )}";
Function reducer
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const reducer = (
state: State,
action: RootAction,
): State | EddyResult<State, RootAction> => {
switch (state.status) {
Method post_type_gistpen
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function post_type_gistpen() {
$labels = array(
'name' => _x( 'Gistpens', 'Post Type General Name', 'wp-gistpen' ),
'singular_name' => _x( 'Gistpen', 'Post Type Singular Name', 'wp-gistpen' ),
'menu_name' => __( 'Gistpens', 'wp-gistpen' ),
Function entity_matches_gist
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function entity_matches_gist( $entity, $gist ) {
if ( $entity['description'] !== $gist->description ) {
return 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 setSelectionRange
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const setSelectionRange = (node: Element, cursor: Cursor) =>
Kefir.stream<never, never>(emitter => {
if (node !== document.activeElement || cursor == null) {
return emitter.end();
}
- 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 process
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process() {
if ( $this->is_running() ) {
return new WP_Error(
'job_running',
sprintf(
Method update_to_1_0_0
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update_to_1_0_0() {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$runs_table = $this->em->make_table_name( \Intraxia\Gistpen\Model\Run::class );
$messages_table = $this->em->make_table_name( \Intraxia\Gistpen\Model\Message::class );
Method sanitize_prism
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sanitize_prism( array $prism ) {
foreach ( $prism as $key => $value ) {
if ( ! array_key_exists( $key, Site::$defaults['prism'] ) ) {
return new WP_Error(
'invalid_rest_param',
Method validate_data
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function validate_data( $class, $data ) {
switch ( $class ) {
case \Intraxia\Gistpen\Model\Run::class:
if ( isset( $data['items'] ) ) {
$data['items'] = maybe_serialize( $data['items'] );
Function update_gist_for_repo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function update_gist_for_repo( Repo $repo, stdClass $gist ) {
$entity = $this->map_repo_to_new_entity( $repo );
if ( $this->entity_matches_gist( $entity, $gist ) ) {
$this->log(
- 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_by
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function find_by( $class, array $params = array() ) {
global $wpdb;
$models = new Collection( $class );
$query = "SELECT * FROM {$this->em->make_table_name( $class )}";
- 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 reducer
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const reducer: EddyReducer<State, RootAction> = (
state: State = initialState,
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
Method filter_unregistered_params
has 35 lines of code (exceeds 25 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;
}
Method taxonomy_language
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function taxonomy_language() {
$labels = array(
'name' => _x( 'Languages', 'Taxonomy General Name', 'wp-gistpen' ),
'singular_name' => _x( 'Language', 'Taxonomy Singular Name', 'wp-gistpen' ),
Method apply_globals
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apply_globals( $params ) {
$languages = $this->config->get_json_resource( 'languages' );
$params['globals'] = array(
'languages' => $languages['list'],