Skip to content

Commit

Permalink
Merge pull request #897 from carstingaxion/fix/update-phpcs-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mauteri authored Sep 24, 2024
2 parents 836ba22 + 1924fde commit bbf99c1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
4 changes: 2 additions & 2 deletions includes/core/classes/class-event-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ public function adjust_event_sql( array $pieces, string $type = 'all', string $o
$current = gmdate( Event::DATETIME_FORMAT, time() );

if ( 'upcoming' === $type ) {
$pieces['where'] .= $wpdb->prepare( ' AND %i.datetime_end_gmt >= %s', $table, $current ); // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnsupportedIdentifierPlaceholder
$pieces['where'] .= $wpdb->prepare( ' AND %i.datetime_end_gmt >= %s', $table, $current );
} elseif ( 'past' === $type ) {
$pieces['where'] .= $wpdb->prepare( ' AND %i.datetime_end_gmt < %s', $table, $current ); // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnsupportedIdentifierPlaceholder
$pieces['where'] .= $wpdb->prepare( ' AND %i.datetime_end_gmt < %s', $table, $current );
}

return $pieces;
Expand Down
2 changes: 1 addition & 1 deletion includes/core/classes/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ public function maybe_flush_rewrite_rules( $old_value, $new_value ): void {
isset( $old_value['urls'] ) && ! isset( $new_value['urls'] ) ||
$old_value['urls'] !== $new_value['urls']
) {
// Event_Setup->maybe_create_flush_rewrite_rules_flag // TODO maybe make this a public method ?!
// Event_Setup->maybe_create_flush_rewrite_rules_flag //@TODO https://github.com/GatherPress/gatherpress/issues/880 Maybe make this a public method ?!
add_option( 'gatherpress_flush_rewrite_rules_flag', true );
}
}
Expand Down
45 changes: 43 additions & 2 deletions phpcs.ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,45 @@
<!-- Rules: WordPress Coding Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="7.4"/>
<config name="minimum_wp_version" value="6.4"/>
<rule ref="WordPress"/>
<!-- Let's also check that everything is properly documented. -->
<rule ref="WordPress-Docs"/>
<!-- Trigger a Warning on @todo comments. -->
<rule ref="Generic.Commenting.Todo"/>

<!-- @source:
- https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset#the-annotated-sample-file
- https://github.com/squizlabs/PHP_CodeSniffer/issues/3769#issuecomment-1452605087
Here we are including a specific sniff but also changing
the error message of a specific message inside the sniff.
Note that the specific code for the message, which is
TaskFound in this case, is defined by the sniff developer.
You can display these codes by using the -s command line
argument when checking a file.
Also note that this message has a variable inside it,
which is why it is important that sniffs use a printf style
format for their error messages.
We also drop the severity of this message from the
default value (5) so that it is hidden by default. It can be
displayed by setting the minimum severity on the PHP_CodeSniffer
command line. This is great if you want to use some messages
only in code reviews and not have them block code commits.
-->
<!-- This error code is for when no description is found. -->
<rule ref="Generic.Commenting.Todo.CommentFound">
<message>Please review this TODO comment</message>
<severity>3</severity>
</rule>
<!-- This error code is used when a task description is found. -->
<rule ref="Generic.Commenting.Todo.TaskFound">
<message>Please review this TODO comment: %s</message>
<severity>3</severity>
</rule>

<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
Expand All @@ -41,7 +78,11 @@
<rule ref="WordPress.WP.I18n">
<properties>
<!-- Value: replace the text domain used. -->
<property name="text_domain" type="array" value="gatherpress"/>
<property name="text_domain" type="array">
<element value="gatherpress"/>
<!-- No need to translate 100%-core strings -->
<element value="default"/>
</property>
</properties>
</rule>
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
Expand Down

0 comments on commit bbf99c1

Please sign in to comment.