intraxia/wp-gistpen

View on GitHub

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(
Severity: Minor
Found in app/Database/Repository/WordPressCustomTable.php - About 1 hr to fix

    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',
    Severity: Minor
    Found in app/Params/Globals.php - About 1 hr to fix

      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();
              }
      
      
      Severity: Minor
      Found in app/Jobs/AbstractJob.php - About 1 hr to fix

        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,
        Severity: Minor
        Found in app/Jobs/AbstractJob.php - About 1 hr to fix

          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 );
          
          
          Severity: Minor
          Found in app/Database/EntityManager.php - About 55 mins 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 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;
                  }
          
          
          Severity: Minor
          Found in app/Http/StrictParams.php - About 55 mins 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 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;
          Severity: Minor
          Found in client/editor/dom.ts - About 55 mins 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export const editorReducer: EddyReducer<EditorState, RootAction> = (
            state = defaultState,
            action: RootAction,
          ) => {
            switch (action.type) {
          Severity: Minor
          Found in client/reducers/editor.ts - About 55 mins 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 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
          Severity: Minor
          Found in app/Client/Gist.php - About 55 mins 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 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;
          Severity: Minor
          Found in client/components/Editor/util.ts - About 55 mins 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 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 );
          
          
          Severity: Minor
          Found in app/Database/EntityManager.php - About 55 mins 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 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 ) ) {
          Severity: Minor
          Found in app/Params/Jobs.php - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                    if (
                      isFirstLineWithoutSelection &&
                      ' ' === newRolBefore.charAt(newRolBefore.length - 1)
                    ) {
                      newRolBefore = rolBefore.slice(0, newRolBefore.length - 1);
          Severity: Major
          Found in client/editor/state.tsx - About 45 mins to fix

            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: {
            Severity: Minor
            Found in client/pages/edit/state.ts - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                      if (
                        isFirstLineWithoutSelection &&
                        ' ' === newRolBefore.charAt(newRolBefore.length - 1)
                      ) {
                        newRolBefore = rolBefore.slice(0, newRolBefore.length - 1);
            Severity: Major
            Found in client/reducers/editor.ts - About 45 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function __construct( EntityManager $em, Params $params, Templating $templating, $path, $url ) {
              Severity: Minor
              Found in app/View/Edit.php - About 35 mins to fix

                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 ) {
                Severity: Minor
                Found in app/Jobs/AbstractJob.php - About 35 mins to fix

                  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 {
                  Severity: Minor
                  Found in app/Console/Command/Base.php - About 35 mins 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 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);
                  
                  
                  Severity: Minor
                  Found in client/components/EditPage/index.tsx - About 35 mins 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 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' ) );
                          }
                  
                  
                  Severity: Minor
                  Found in app/Database/EntityManager.php - About 35 mins 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