intraxia/wp-gistpen

View on GitHub

Showing 137 of 273 total issues

File index.tsx has 483 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useEffect, useMemo } from 'react';
import Prism from 'prismjs';
import {
  useDelta,
  EddyReducer,
Severity: Minor
Found in client/block/EditEmbed/index.tsx - About 7 hrs to fix

    Function indent has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    function indent(
      { code, cursor, inverse }: EditorIndentValue,
      { tabs, width }: Indentation,
    ): EditorValue {
      if (!cursor) {
    Severity: Minor
    Found in client/reducers/editor.ts - About 7 hrs to fix

    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 indent has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    function indent(
      { code, cursor, inverse }: EditorIndentValue,
      { tabs, width }: Indentation,
    ): EditorValue {
      if (!cursor) {
    Severity: Minor
    Found in client/editor/state.tsx - About 7 hrs to fix

    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 39 (exceeds 5 allowed). Consider refactoring.
    Open

        public function persist( Model $model ) {
            $result = $model->get_primary_id() ?
                wp_update_post( $model->get_underlying_wp_object(), true ) :
                wp_insert_post( (array) $model->get_underlying_wp_object(), true );
    
    
    Severity: Minor
    Found in app/Database/Repository/WordPressPost.php - About 5 hrs to fix

    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 140 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const editorReducer: EddyReducer<EditorState, RootAction> = (
      state = defaultState,
      action: RootAction,
    ) => {
      switch (action.type) {
    Severity: Major
    Found in client/reducers/editor.ts - About 5 hrs to fix

      File editor.ts has 370 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { getType } from 'typesafe-actions';
      import { EddyReducer } from 'brookjs';
      import {
        editorThemeChange,
        editorTabsToggle,
      Severity: Minor
      Found in client/reducers/editor.ts - About 4 hrs to fix

        Method add_routes has 119 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function add_routes( CoreRouter $router ) {
                $router->set_vendor( 'intraxia' )->set_version( 1 );
        
                $router->group( array( 'prefix' => '/gistpen' ), function ( CoreRouter $router ) {
                    $search = $this->container->get( \Intraxia\Gistpen\Http\SearchController::class );
        Severity: Major
        Found in app/Register/Router.php - About 4 hrs to fix

          Function embedReducer has 114 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const embedReducer: EddyReducer<EmbedState, RootAction> = (
            state = defaultEmbedState,
            action: RootAction,
          ) => {
            switch (action.type) {
          Severity: Major
          Found in client/block/EditEmbed/index.tsx - About 4 hrs to fix

            Function merge has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

                public function merge( array $attributes ) {
                    try {
                        $blobs = $this->blobs;
                    } catch ( \Exception $exception ) {
                        $blobs = new Collection( Blob::class );
            Severity: Minor
            Found in app/Model/Repo.php - About 4 hrs to fix

            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

            AbstractJob has 32 functions (exceeds 20 allowed). Consider refactoring.
            Open

            abstract class AbstractJob implements Job {
                /**
                 * EntityManager service.
                 *
                 * @var EntityManager
            Severity: Minor
            Found in app/Jobs/AbstractJob.php - About 4 hrs to fix

              Function refresh has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function refresh( array $attributes ) {
                      try {
                          $prev_blobs = $this->blobs;
                      } catch ( \Exception $exception ) {
                          $prev_blobs = new Collection( Blob::class );
              Severity: Minor
              Found in app/Model/Repo.php - About 3 hrs to fix

              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 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const reducer: EddyReducer<State, RootAction> = (
                state: State,
                action: RootAction,
              ): State | Result<State, RootAction> => {
                switch (state.status) {
              Severity: Major
              Found in client/block/SetEmbed/Creating/state.tsx - About 3 hrs to fix

                Method persist has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function persist( Model $model ) {
                        $result = $model->get_primary_id() ?
                            wp_update_post( $model->get_underlying_wp_object(), true ) :
                            wp_insert_post( (array) $model->get_underlying_wp_object(), true );
                
                
                Severity: Major
                Found in app/Database/Repository/WordPressPost.php - About 3 hrs to fix

                  Function rootDelta has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const rootDelta: Delta<RootAction, State> = (action$, state$) => {
                    const fetch$ = state$
                      .thru(sampleByAction(action$, fetchBlob.request))
                      .flatMap(state =>
                        ajax$(
                  Severity: Major
                  Found in client/block/EditEmbed/index.tsx - About 3 hrs to fix

                    Function create has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function create( $class, array $data = array(), array $options = array() ) {
                            $model = new $class();
                    
                            /**
                             * Set aside the `blobs` key for use.
                    Severity: Minor
                    Found in app/Database/Repository/WordPressPost.php - About 3 hrs to fix

                    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 87 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const reducer: EddyReducer<State, RootAction> = (
                      state: State = initialState,
                      action: RootAction,
                    ) => {
                      switch (action.type) {
                    Severity: Major
                    Found in client/search/state.tsx - About 3 hrs to fix

                      Function patch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function patch( array $patch ) {
                              foreach ( $patch as $key => $value ) {
                                  if ( ! array_key_exists( $key, static::$defaults ) ) {
                                      throw new InvalidArgumentException( $key );
                                  }
                      Severity: Minor
                      Found in app/Options/Site.php - About 3 hrs to fix

                      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

                      File WordPressPost.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace Intraxia\Gistpen\Database\Repository;
                      
                      use Exception;
                      Severity: Minor
                      Found in app/Database/Repository/WordPressPost.php - About 3 hrs to fix

                        Function findOffset has a Cognitive Complexity of 22 (exceeds 5 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;
                        Severity: Minor
                        Found in client/editor/dom.ts - About 3 hrs to fix

                        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 findOffset has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function findOffset(root: Element, ss: number): Offset {
                          let container;
                          let offset = 0;
                          let element: ChildNode | null = root;
                        
                        
                        Severity: Minor
                        Found in client/components/Editor/findOffset.ts - About 3 hrs to fix

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language