Skip to content

Commit

Permalink
Lint for and fix incorrect next-version tokens
Browse files Browse the repository at this point in the history
The correct token is `$$next-version$$`. In the past, however, people
have used incorrect tokens such as `$next-version$` or
`$$next_version$$`. Lint for these, and fix the existing instances.

Fixes #38760
  • Loading branch information
anomiex committed Aug 13, 2024
1 parent 7f3d11b commit fcbed9a
Show file tree
Hide file tree
Showing 33 changed files with 70 additions and 29 deletions.
12 changes: 12 additions & 0 deletions .github/files/lint-project-structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,16 @@ if ! pnpm semver --range "$RANGE" "$PNPM_VERSION" &>/dev/null; then
echo "::error file=package.json,line=$LINE::Pnpm version $PNPM_VERSION in .github/versions.sh does not satisfy requirement $RANGE from package.json"
fi

# - Check for incorrect next-version tokens.
debug "Checking for incorrect next-version tokens."
RE='[^$]\$next[-_]version\$\|\$next[-_]version\$[^$]\|\$\$next_version\$\$'
while IFS= read -r FILE; do
EXIT=1
while IFS=: read -r LINE COL X; do
X=${X/#[^$]/}
X=${X/%[^$]/}
echo "::error file=$FILE,line=$LINE,col=$COL::You probably mean \`\$\$next-version\$\$\` here rather than \`$X\`."
done < <( git grep -h --line-number --column -o "$RE" "$FILE" )
done < <( git -c core.quotepath=off grep -l "$RE" )

exit $EXIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs.
2 changes: 1 addition & 1 deletion projects/packages/boost-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-boost-core",
"version": "0.2.7",
"version": "0.2.8-alpha",
"description": "Core functionality for boost and relevant packages to depend on",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/boost-core/#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/boost-core/src/lib/class-boost-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Boost_API {
* Get the API client instance.
*
* @return Boost_API_Client
* @deprecated $$next_version$$ Use get(), and post() directly instead.
* @deprecated 3.1.1 Use get(), and post() directly instead.
*/
public static function get_client() {
return self::get_api_client();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static function get_plugin_status( $plugin_file ) {
/**
* Safely checks if the plugin is active
*
* @since $next-version$
* @since 0.1.0
*
* @param string $plugin_file The plugin file to check.
* @return bool
Expand All @@ -202,7 +202,7 @@ public static function is_plugin_active( $plugin_file ) {
/**
* Safely checks if the plugin is active for network
*
* @since $next-version$
* @since 0.1.0
*
* @param string $plugin_file The plugin file to check.
* @return bool
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs.
2 changes: 1 addition & 1 deletion projects/packages/publicize/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-publicize",
"version": "0.49.0",
"version": "0.49.1-alpha",
"description": "Publicize makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/publicize/#readme",
"bugs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Flagged to be removed after deprecation.
*
* @deprecated $$next_version$$
* @deprecated 0.38.3
*
* @package automattic/jetpack-publicize
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Settings class.
* Flagged to be removed after deprecation.
*
* @deprecated $$next_version$$
* @deprecated 0.38.3
*
* @package automattic/jetpack-publicize
*/
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/publicize/src/class-publicize-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function on_jetpack_feature_publicize_enabled() {
add_action( 'admin_init', array( static::class, 'register_core_options' ) );

// Flagged to be removed after deprecation.
// @deprecated $$next_version$$
// @deprecated 0.38.3
add_action( 'rest_api_init', array( new Auto_Conversion\REST_Settings_Controller(), 'register_routes' ) );

( new Social_Image_Generator\Setup() )->init();
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/publicize/src/class-rest-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function register_rest_routes() {

// Dismiss a notice.
// Flagged to be removed after deprecation.
// @deprecated $$next_version$$.
// @deprecated 0.47.2
register_rest_route(
'jetpack/v4',
'/social/dismiss-notice',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Flagged to be removed after deprecation.
*
* @deprecated $$next_version$$
* @deprecated 0.38.3
*
* @package automattic/jetpack-publicize
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Flagged to be removed after deprecation.
*
* @deprecated $$next_version$$
* @deprecated 0.38.3
*
* @package automattic/jetpack-publicize
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function init() {
add_action( 'rest_api_init', array( new REST_Token_Controller(), 'register_routes' ) );

// Flagged to be removed after deprecation.
// @deprecated $$next_version$$
// @deprecated 0.38.3
add_action( 'rest_api_init', array( new REST_Settings_Controller(), 'register_routes' ) );
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs.
2 changes: 1 addition & 1 deletion projects/packages/search/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jetpack-search",
"version": "0.44.14",
"version": "0.44.15-alpha",
"description": "Package for Jetpack Search products",
"main": "main.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/search/src/class-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ public static function generate_initial_javascript_state() {
*
* @module search
*
* @since $next-version$
* @since 0.41.0
*
* @param bool Prevent cookie reset for automattic sites as default value.
*/
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/search/src/class-package.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Search package general information
*/
class Package {
const VERSION = '0.44.14';
const VERSION = '0.44.15-alpha';
const SLUG = 'search';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected static function init_search( $blog_id ) {
/**
* Filter whether classic search should be enabled. By this stage, search module would be enabled already.
*
* @since Jetpack $$next_version$$
* @since 0.39.6
* @param boolean initial value whether classic search is enabled.
* @param boolean filtered result whether classic search is enabled.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs.
2 changes: 1 addition & 1 deletion projects/packages/sync/src/class-dedicated-sender.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public static function get_request_lock_id_from_request() {
* Test Sync spawning functionality by making a request to the
* Sync spawning endpoint and storing the result (status code) in a transient.
*
* @since $$next_version$$
* @since 1.34.0
*
* @return bool True if we got a successful response, false otherwise.
*/
Expand Down
6 changes: 3 additions & 3 deletions projects/packages/sync/src/class-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ public static function get_themes() {
/**
* Return the list of active Jetpack modules.
*
* @since $$next_version$$
* @since 1.34.0
*
* @return array
*/
Expand All @@ -678,7 +678,7 @@ public static function get_active_modules() {
/**
* Return a list of PHP modules that we want to track.
*
* @since $$next_version$$
* @since 1.50.0
*
* @return array
*/
Expand Down Expand Up @@ -714,7 +714,7 @@ public static function get_loaded_extensions() {
/**
* Return the list of active connected Jetpack plugins.
*
* @since $$next_version$$
* @since 3.2.0
*
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/sync/src/class-package-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '3.5.1';
const PACKAGE_VERSION = '3.5.2-alpha';

const PACKAGE_SLUG = 'sync';

Expand Down
2 changes: 1 addition & 1 deletion projects/packages/sync/src/class-rest-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ public static function get_object_id_range( $request ) {
* @see Actions::init
* @see Sender::do_dedicated_sync_and_exit
*
* @since $$next_version$$
* @since 1.34.0
*
* @return \WP_REST_Response
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs.
4 changes: 2 additions & 2 deletions projects/packages/waf/src/class-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static function is_brute_force_running_in_jetpack() {
/**
* Default the allow list enabled option to the value of the generic IP lists enabled option it replaced.
*
* @since $next-version$
* @since 0.17.0
*
* @param mixed $default The default value to return if the option does not exist in the database.
* @param string $option Option name.
Expand Down Expand Up @@ -268,7 +268,7 @@ public static function default_option_waf_ip_allow_list_enabled( $default, $opti
/**
* Default the block list enabled option to the value of the generic IP lists enabled option it replaced.
*
* @since $next-version$
* @since 0.17.0
*
* @param mixed $default The default value to return if the option does not exist in the database.
* @param string $option Option name.
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/waf/src/class-rest-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static function update_waf( $request ) {
/**
* IP Lists Enabled
*
* @deprecated $next-version$ This is a legacy option maintained here for backwards compatibility.
* @deprecated 0.17.0 This is a legacy option maintained here for backwards compatibility.
*/
if ( isset( $request['jetpack_waf_ip_list'] ) ) {
update_option( Waf_Rules_Manager::IP_BLOCK_LIST_ENABLED_OPTION_NAME, $request['jetpack_waf_ip_list'] ? '1' : '' );
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/waf/src/class-waf-rules-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Waf_Rules_Manager {
/**
* IP Lists Enabled Option Name
*
* @deprecated $next-version$ Use Waf_Rules_Manager::IP_ALLOW_LIST_ENABLED_OPTION_NAME and Waf_Rules_Manager::IP_BLOCK_LIST_ENABLED_OPTION_NAME instead.
* @deprecated 0.17.0 Use Waf_Rules_Manager::IP_ALLOW_LIST_ENABLED_OPTION_NAME and Waf_Rules_Manager::IP_BLOCK_LIST_ENABLED_OPTION_NAME instead.
*/
const IP_LISTS_ENABLED_OPTION_NAME = 'jetpack_waf_ip_list';

Expand Down
2 changes: 1 addition & 1 deletion projects/packages/waf/src/class-waf-runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static function get_config() {
* Provide the deprecated IP lists options for backwards compatibility with older versions of the Jetpack and Protect plugins.
* i.e. If one plugin is updated and the other is not, the latest version of this package will be used by both plugins.
*
* @deprecated $next-version$
* @deprecated 0.17.0
*/
// @phan-suppress-next-line PhanDeprecatedClassConstant -- Needed for backwards compatibility.
Waf_Rules_Manager::IP_LISTS_ENABLED_OPTION_NAME => Waf_Rules_Manager::ip_allow_list_enabled() || Waf_Rules_Manager::ip_block_list_enabled(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Fix incorrect next-version tokens in php `@since` and/or `@deprecated` docs.


2 changes: 1 addition & 1 deletion projects/plugins/jetpack/class.jetpack-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ public static function enqueue_block_editor_assets() {
* @module publicize
*
* @since 10.3.0
* @deprecated $$next_version$$ This is a feature flag that is no longer used.
* @deprecated 11.5 This is a feature flag that is no longer used.
*
* @param bool true Enable the RePublicize UI in the block editor context. Defaults to true.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Adds support for Jetpack Subscription Site feature.
*
* @package automattic/jetpack
* @since $$next_version$$
* @since 13.3
*/

namespace Automattic\Jetpack\Extensions\Subscriber_Login;
Expand Down

0 comments on commit fcbed9a

Please sign in to comment.