intraxia/wp-gistpen

View on GitHub

Showing 137 of 273 total issues

Function reducer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const reducer = (state: State, action: Action): State => {
  switch (action.type) {
    case getType(actions.startup.request):
      return {
        ...state,
Severity: Minor
Found in commands/E2ECommand.tsx - About 1 hr to fix

    Method repos has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function repos( WP_REST_Request $request ) {
            $args = [ 'with' => [ 'blobs' => [] ] ];
    
            $search_term = $request->get_param( 's' );
    
    
    Severity: Minor
    Found in app/Http/SearchController.php - About 1 hr to fix

      Method process_item has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function process_item( $repo ) {
              if ( ! ( $repo instanceof Repo ) ) {
                  $this->log(
                      sprintf(
                          /* translators: %s: Invalid type for repo. */
      Severity: Minor
      Found in app/Jobs/ExportJob.php - About 1 hr to fix

        Method refresh has 33 lines of code (exceeds 25 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 1 hr to fix

          Method process_item has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function process_item( $gist ) {
                  if ( ! ( $gist instanceof stdClass ) ) {
                      $this->log(
                          sprintf(
                              /* translators: %s: Item type. */
          Severity: Minor
          Found in app/Jobs/ImportJob.php - About 1 hr to fix

            Function reducer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const reducer: EddyReducer<State, RootAction> = (
              state: State,
              action: RootAction,
            ) => {
              switch (state.status) {
            Severity: Minor
            Found in client/block/state.ts - About 1 hr to fix

              Function update has a Cognitive Complexity of 11 (exceeds 5 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 );
              
              
              Severity: Minor
              Found in app/Http/BlobController.php - About 1 hr 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 get has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function get( $args, $assoc_args ) {
                      if ( ! isset( $args[0] ) ) {
                          $value = $this->options->all();
                      } else {
                          $key    = $args[0];
              Severity: Minor
              Found in app/Console/Command/Site.php - About 1 hr 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

              Method merge has 31 lines of code (exceeds 25 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 1 hr to fix

                Method process_entrypoint has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function process_entrypoint( Register $assets, $entry, $files, $deps ) {
                        if ( ! isset( $this->asset_config[ $entry ] ) ) {
                            throw new Exception( 'Unexpected entry in manifest: ' . $entry );
                        }
                
                
                Severity: Minor
                Found in app/Register/Assets.php - About 1 hr to fix

                  Method apply has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function apply( WP_REST_Request $request ) {
                          $id    = $request->get_param( 'id' );
                          $model = $this->em->find( Repo::class, $id, array(
                              'with' => array(
                                  'blobs' => array(
                  Severity: Minor
                  Found in app/Http/RepoController.php - About 1 hr to fix

                    Method delete has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function delete( Model $model, $force = false ) {
                            global $wpdb;
                    
                            $results = $wpdb->delete(
                                $this->em->make_table_name( $model ),
                    Severity: Minor
                    Found in app/Database/Repository/WordPressCustomTable.php - About 1 hr to fix

                      Method update has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function update( WP_REST_Request $request ) {
                              $id = $request->get_param( 'id' );
                      
                              $model = $this->em->find( Repo::class, $id, array(
                                  'with' => array(
                      Severity: Minor
                      Found in app/Http/RepoController.php - About 1 hr to fix

                        Method create_gist_for_repo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function create_gist_for_repo( Repo $repo ) {
                                $response = $this->client->create( $this->map_repo_to_new_entity( $repo ) );
                        
                                if ( is_wp_error( $response ) ) {
                                    $this->log_response_error( $repo, $response );
                        Severity: Minor
                        Found in app/Jobs/ExportJob.php - About 1 hr to fix

                          Method filter_hooks has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function filter_hooks() {
                                  return array(
                                      array(
                                          'hook'     => 'the_content',
                                          'method'   => 'post_content',
                          Severity: Minor
                          Found in app/View/Content.php - About 1 hr to fix

                            Method do_shortcode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function do_shortcode( array $attrs, $content = '' ) {
                                    $args = shortcode_atts( static::$defaults, $attrs, 'gistpen' );
                            
                                    // If the user didn't provide an ID, raise an error
                                    if ( ! $args['id'] ) {
                            Severity: Minor
                            Found in app/View/Content.php - About 1 hr to fix

                              Method create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Confirmed

                                  public function create( $args, $assoc_args ) {
                                      if ( ! empty( $args[0] ) ) {
                                          $assoc_args['code'] = $this->read_from_file_or_stdin( $args[0] );
                                      }
                              
                              
                              Severity: Minor
                              Found in app/Console/Command/Blob.php - About 1 hr to fix

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

                                    public function patch( $user_id, array $update ) {
                                        $options = $this->all( $user_id );
                                
                                        foreach ( $update as $key => $value ) {
                                            if ( ! isset( $options[ $key ] ) ) {
                                Severity: Minor
                                Found in app/Options/User.php - About 1 hr 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 setSelectionRange has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const setSelectionRange = (node: Element, ss: number, se: number) =>
                                  Kefir.stream<never, never>(emitter => {
                                    if (ss === selectSelectionStart(node) && se === selectSelectionEnd(node)) {
                                      return emitter.end();
                                    }
                                Severity: Minor
                                Found in client/components/Editor/Code.tsx - About 1 hr 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

                                Method entity_matches_gist has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function entity_matches_gist( $entity, $gist ) {
                                        if ( $entity['description'] !== $gist->description ) {
                                            return false;
                                        }
                                
                                
                                Severity: Minor
                                Found in app/Jobs/ExportJob.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language