Showing 137 of 273 total issues
Method create
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create( $class, array $data = array(), array $options = array() ) {
$model = new $class();
/**
* Set aside the `blobs` key for use.
Function fill_relations
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function fill_relations( Model $model, array $params ) {
if ( ! isset( $params['with'] ) ) {
$params['with'] = array();
}
- 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 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find_by( $class, array $params = array() ) {
$post_type = $class::get_post_type();
$parent_search = 'post_parent__in';
if ( Blob::class === $class ) {
Method __construct
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( Container $container ) {
$this->container = $container;
$this->asset_config = [
'edit' => [
'type' => 'admin',
Method add_commit
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add_commit( Repo $repo ) {
$commits = $this->em->find_by( Commit::class, array(
'repo_id' => $repo->ID,
'with' => array(
'states' => array(
Function find
has a Cognitive Complexity of 17 (exceeds 5 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 ) {
- 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 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const reducer: EddyReducer<State, EditorAction> = (
state = initialState,
action,
) => {
switch (action.type) {
Method apply_editor
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apply_editor( $params ) {
/**
* Returned model.
*
* @var RepoModel
File E2ECommand.tsx
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import path from 'path';
import { Command } from 'brookjs-cli';
import { ofType, useDelta, Delta, sampleByAction } from 'brookjs';
import { Box, Color, AppContext } from 'ink';
import Kefir, { Observable } from 'kefir';
File AbstractJob.php
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Intraxia\Gistpen\Jobs;
use Intraxia\Gistpen\Contract\Job;
File jobsDelta.ts
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Kefir, { Observable, Stream, Property } from 'kefir';
import { ofType } from 'brookjs';
import * as t from 'io-ts';
import { Nullable } from 'typescript-nullable';
import { ajax$ } from 'kefir-ajax';
Function sanitize_prism
has a Cognitive Complexity of 16 (exceeds 5 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',
- 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 selectSelectionStart
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function selectSelectionStart(node: Element): number {
const selection = window.getSelection();
if (selection && selection.rangeCount) {
const range = selection.getRangeAt(0);
- 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 selectSelectionStart
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function selectSelectionStart(node: Element): number {
const selection = getSelection();
if (selection && selection.rangeCount) {
const range = selection.getRangeAt(0);
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
public function find_by( $class, array $params = array() ) {
$post_type = $class::get_post_type();
$parent_search = 'post_parent__in';
if ( Blob::class === $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
Method update_gist_for_repo
has 52 lines of code (exceeds 25 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(
Method update
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update( WP_REST_Request $request ) {
$repo_id = $request->get_param( 'repo_id' );
$repo = $this->em->find( Repo::class, $repo_id );
Function rootDelta
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const rootDelta: Delta<RootAction, State> = (action$, state$) => {
const createRepo$ = state$
.thru(sampleByAction(action$, createRepo.request))
.filter((state): state is NewRepoState => state.status === 'create-new')
.flatMapFirst(state =>
Method update_repo_for_gist
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function update_repo_for_gist( Repo $repo, stdClass $gist ) {
$repo->unguard();
$repo->sync = 'on';
$repo->description = $gist->description;
$repo->status = true === $gist->public ? 'publish' : 'private';
Function findOffset
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function findOffset(root: Element, ss: number): Offset {
// @TODO(mAAhaTTah) these types seem sketchy...
let container;
let offset = 0;
let element: ChildNode | null = root;