Skip to:
Content

bbPress.org

Opened 4 weeks ago

Last modified 4 weeks ago

#3615 new regression

PHPCS: WordPress.WP.I18n.MissingTranslatorsComment

Reported by: sirlouen's profile SirLouen Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Tools - Code Improvements Keywords: has-patch
Cc:

Description

This is the 3rd part of a series of PHPCS WPCS sorting

First part here: https://bbpress.trac.wordpress.org/ticket/3613(https://bbpress.trac.wordpress.org/ticket/3613)
Second part here: https://bbpress.trac.wordpress.org/ticket/3614

I'm including in this issue, sorting exclusively for:

WordPress.WP.I18n.MissingTranslatorsComment

Which happens to be big enough for a patch by itself.

Also I've found some issues, that I've sorted on the fly:

L264 in src/includes/admin/classes/class-bbp-admin.php
Both parameters were wrongly pointing to upgrade_link

<<< esc_html__( 'bbPress requires a manual database upgrade. %1$s or %1$s.', 'bbpress' ),
>>> esc_html__( 'bbPress requires a manual database upgrade. %1$s or %2$s.', 'bbpress' ),

L420 in src/includes/search/template.php
It's needed both a singular and plural form in this else also.
Also, the singular format was wrongly coded

Before: https://i.imgur.com/TVeSZ3L.png
After: https://i.imgur.com/tn5rI9w.png

<<< $retstr = sprintf( _n( 'Viewing %2$s results (of %4$s total)', 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', $bbp->search_query->post_count, 'bbpress' ), $bbp->search_query->post_count, $from_num, $to_num, $total_num );  //phpcs:ignore
>>> $retstr = sprintf(
            _n(
                'Viewing %1$s result - %2$s through %3$s (of %4$s total)',
                'Viewing %1$s results - %2$s through %3$s (of %4$s total)',
                $bbp->search_query->post_count,
                'bbpress'
            ),
            $bbp->search_query->post_count,
            $from_num,
            $to_num,
            $total_num
        );

L707 in src/includes/core/theme-compat.php
I spotted that there is a reference to function display_reply_index which doesn't exist anymore.
In 'post_content'   => $bbp_shortcodes->display_reply_index(),
Shall this be sorted, so I will be opening a issue for this.

Another thing, according to PHPCS standards, the echo/getter pattern, doesn't justify an extra indentation, hence all the files that have been touched for this regard, have corrected this (but not all files in the project have been touched, so not all indentations has been sorted in this way).
Most affected file has been src/includes/common/template.php

Finally, its a good idea to use /* */ while documenting functions, hooks, translator comments, but using it amidst the code for single line informational comments, can be problematic because if you need to use this commenting pattern to comment large chunks of functions for testing and debugging, there are interferences on the full comment (we cannot comment /* */ over another /* */ but we can comment /* */ over a pattern). Some have been sorted, but there are so many, that it has become virtually impossible to sort them all. I will always try to correct them on the fly while sorting this kind of PHPCS issues.

Change History (1)

This ticket was mentioned in PR #28 on bbpress/bbPress by @SirLouen.


4 weeks ago
#1

Note: See TracTickets for help on using tickets.