-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/phpcs #286
Fix/phpcs #286
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oscarssanchez left some comments throughout the PR, let me know if you have any questions. Congrats on the huge effort here!
.github/workflows/lint.yml
Outdated
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oscarssanchez I imagine you are not using the default PHP 8.1 because it is still incompatible with the codebase. Can we bump this to PHP 7.4 at least?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumped here: db2d1d9
if ( isset( $_POST['folderId'] ) && isset( $_POST['oldFolderId'] ) ) { | ||
$folderId = sanitize_text_field( $_POST['folderId'] ); | ||
$oldFolderId = sanitize_text_field( $_POST['oldFolderId'] ); | ||
if ( isset( $_POST['folder_id'] ) && isset( $_POST['oldfolder_id'] ) ) { | ||
$folder_id = sanitize_text_field( $_POST['folder_id'] ); | ||
$old_folder_id = sanitize_text_field( $_POST['oldfolder_id'] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oscarssanchez I am probably missing it but did you also change the place where oldFolderId
is sent in the POST request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right @felipeelia , I've fixed it here: 552364b
while ( count( $results ) <= ( $page * $posts_per_page ) ) { | ||
$count_results = count( $results ); | ||
|
||
while ( $count_results <= ( $page * $posts_per_page ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As $results
is changed inside the while
, are you sure this will keep the same behavior it had before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is actually not used anymore, so I just removed the whole method db94cfc
$folder_id = ( isset( $_POST['folderId'] ) && '' !== $_POST['folderId'] ) ? sanitize_text_field( $_POST['folderId'] ) : false; | ||
$folder_id = ( isset( $_POST['folder_id'] ) && '' !== $_POST['folder_id'] ) ? sanitize_text_field( $_POST['folder_id'] ) : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before: did we also change the place where that POST field is sent?
* @param string $account_hash The account hash for the account. | ||
* @param int $video_id The ID of the video to associate the image with. | ||
* @param string $url The URL of the image to upload. | ||
* @param int $width The width of the image. | ||
* @param int $height The height of the image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we align these descriptions? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here 1069e77
* | ||
* This hook doesn't follow standard naming convention but needs to stay as it is for retro compatibility. | ||
*/ | ||
do_action( 'brightcove/admin/settings_page' ); | ||
do_action( 'brightcove/admin/settings_page' ); // phpcs:ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we mark this as deprecated with do_action_deprecated
and add a properly named action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here ff0df76
echo $this->render_source_rows(); | ||
echo $this->render_source_rows() // phpcs:ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should keep the ;
(this is a good example of why ignoring specific rules can help :P )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here af798f7
includes/api/class-bc-cms-api.php
Outdated
* name strings or quoted strings | ||
* text strings or quoted strings (name, description, long_description) | ||
* tags strings or quoted strings | ||
* reference_id string or quoted string | ||
* state ACTIVE, INACTIVE, DELETED, PENDING | ||
* updated_at date range | ||
* created_at date range | ||
* schedule.starts_at date range | ||
* schedule.ends_at date range | ||
* published_at date range | ||
* complete true or false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we could align these descriptions here too. I think that would increase readability by a ton. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here ab24ae0
public function _request_access_token( $force_new_token = false, $retry = true ) { | ||
public function request_access_token( $force_new_token = false, $retry = true ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how many people would use or extend this code but we should mark this as a breaking change OR keep the old version of the method marking it with _doing_it_wrong or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here 31b09b8
includes/class-bc-setup.php
Outdated
$message = sprintf( | ||
'<div class="error"><p><strong>%1$s</strong>%2$s<strong>%3$s</strong>%4$s %5$s %6$s<strong>4.2</strong></p></div>', | ||
esc_html__( 'Brightcove Video Cloud Enhanced', 'brightcove' ), | ||
esc_html__( 'has been', 'brightcove' ), | ||
esc_html__( 'deactivated', 'brightcove' ), | ||
esc_html__( 'because it\'s incompatibale with WordPress version', 'brightcove' ), | ||
esc_html( get_bloginfo( 'version' ) ), | ||
esc_html__( 'The minimum compatible WordPress version is ', 'brightcove' ) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, breaking up strings to make parts translatable makes translators work much harder. WP core does not care about leaving <strong>
in the string to be translated, for example.
A suggestion here would be something like:
$message = sprintf(
/* translators: 1. WP version; 2. Minimum compatible WP version */
__( '<strong>Brightcove Video Cloud Enhanced</strong> has been <strong>deactivated</strong> because it is incompatible with WordPress version %1$s. The minimum compatible WordPress version is <strong>%2$s</strong></p>', 'brightcove' ),
esc_html( get_bloginfo( 'version' ) ),
'4.2'
);
echo wp_kses_post( '<div class="error"><p>' . $message . '</p></div>' );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also not used anymore so It was removed here 8b6cce4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just remember to state in the changelog that some methods had their names changed @oscarssanchez
Description of the Change
This PR fixes PHPCS issues detected as well as adding a new PHPCS check
How to test the Change
Changelog Entry
Credits
Props @username, @username2, ...
Checklist: