Skip to content

Commit cfc3b57

Browse files
Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability. See #48303. git-svn-id: https://develop.svn.wordpress.org/trunk@47122 602fd350-edb4-49c9-b593-d223f7449a82
1 parent bd2cd57 commit cfc3b57

File tree

810 files changed

+9871
-8362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

810 files changed

+9871
-8362
lines changed

Gruntfile.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = function(grunt) {
4343

4444
// Load tasks.
4545
require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );
46-
// Load legacy utils
46+
// Load legacy utils.
4747
grunt.util = require('grunt-legacy-util');
4848

4949
// Project configuration.
@@ -144,7 +144,7 @@ module.exports = function(grunt) {
144144
'!assets/**', // Assets is extracted into separate copy tasks.
145145
'!js/**', // JavaScript is extracted into separate copy tasks.
146146
'!.{svn,git}', // Exclude version control folders.
147-
'!wp-includes/version.php', // Exclude version.php
147+
'!wp-includes/version.php', // Exclude version.php.
148148
'!**/*.map', // The build doesn't need .map files.
149149
'!index.php', '!wp-admin/index.php',
150150
'!_index.php', '!wp-admin/_index.php'
@@ -168,7 +168,7 @@ module.exports = function(grunt) {
168168
[ WORKING_DIR + 'wp-includes/js/clipboard.js' ]: [ './node_modules/clipboard/dist/clipboard.js' ],
169169
[ WORKING_DIR + 'wp-includes/js/hoverIntent.js' ]: [ './node_modules/jquery-hoverintent/jquery.hoverIntent.js' ],
170170

171-
// Renamed to avoid conflict with jQuery hoverIntent.min.js (after minifying)
171+
// Renamed to avoid conflict with jQuery hoverIntent.min.js (after minifying).
172172
[ WORKING_DIR + 'wp-includes/js/hoverintent-js.min.js' ]: [ './node_modules/hoverintent/dist/hoverintent.min.js' ],
173173
[ WORKING_DIR + 'wp-includes/js/imagesloaded.min.js' ]: [ './node_modules/imagesloaded/imagesloaded.pkgd.min.js' ],
174174
[ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.js' ],
@@ -448,7 +448,7 @@ module.exports = function(grunt) {
448448
},
449449
rtlcss: {
450450
options: {
451-
// rtlcss options
451+
// rtlcss options.
452452
opts: {
453453
clean: false,
454454
processUrls: { atrule: true, decl: false },
@@ -516,7 +516,7 @@ module.exports = function(grunt) {
516516
'!wp-includes/css/*.min.css',
517517
'!wp-includes/css/dist',
518518

519-
// Exceptions
519+
// Exceptions.
520520
'!wp-includes/css/dashicons.css',
521521
'!wp-includes/css/wp-embed-template.css',
522522
'!wp-includes/css/wp-embed-template-ie.css'
@@ -558,7 +558,7 @@ module.exports = function(grunt) {
558558
src: [
559559
'twenty*/**/*.js',
560560
'!twenty{eleven,twelve,thirteen}/**',
561-
// Third party scripts
561+
// Third party scripts.
562562
'!twenty{fourteen,fifteen,sixteen}/js/html5.js',
563563
'!twentyseventeen/assets/js/html5.js',
564564
'!twentyseventeen/assets/js/jquery.scrollTo.js',
@@ -575,35 +575,36 @@ module.exports = function(grunt) {
575575
cwd: SOURCE_DIR,
576576
src: [
577577
'js/_enqueues/**/*.js',
578-
// Third party scripts
578+
// Third party scripts.
579579
'!js/_enqueues/vendor/**/*.js'
580580
],
581-
// Remove once other JSHint errors are resolved
581+
// Remove once other JSHint errors are resolved.
582582
options: {
583583
curly: false,
584584
eqeqeq: false
585585
},
586-
// Limit JSHint's run to a single specified file:
587-
//
588-
// grunt jshint:core --file=filename.js
589-
//
590-
// Optionally, include the file path:
591-
//
592-
// grunt jshint:core --file=path/to/filename.js
593-
//
586+
/*
587+
* Limit JSHint's run to a single specified file:
588+
*
589+
* grunt jshint:core --file=filename.js
590+
*
591+
* Optionally, include the file path:
592+
*
593+
* grunt jshint:core --file=path/to/filename.js
594+
*/
594595
filter: function( filepath ) {
595596
var index, file = grunt.option( 'file' );
596597

597-
// Don't filter when no target file is specified
598+
// Don't filter when no target file is specified.
598599
if ( ! file ) {
599600
return true;
600601
}
601602

602-
// Normalize filepath for Windows
603+
// Normalize filepath for Windows.
603604
filepath = filepath.replace( /\\/g, '/' );
604605
index = filepath.lastIndexOf( '/' + file );
605606

606-
// Match only the filename passed from cli
607+
// Match only the filename passed from cli.
607608
if ( filepath === file || ( -1 !== index && index === filepath.length - ( file.length + 1 ) ) ) {
608609
return true;
609610
}
@@ -618,22 +619,23 @@ module.exports = function(grunt) {
618619
'**/*.js',
619620
'!**/*.min.js'
620621
],
621-
// Limit JSHint's run to a single specified plugin directory:
622-
//
623-
// grunt jshint:plugins --dir=foldername
624-
//
622+
/*
623+
* Limit JSHint's run to a single specified plugin directory:
624+
*
625+
* grunt jshint:plugins --dir=foldername
626+
*/
625627
filter: function( dirpath ) {
626628
var index, dir = grunt.option( 'dir' );
627629

628-
// Don't filter when no target folder is specified
630+
// Don't filter when no target folder is specified.
629631
if ( ! dir ) {
630632
return true;
631633
}
632634

633635
dirpath = dirpath.replace( /\\/g, '/' );
634636
index = dirpath.lastIndexOf( '/' + dir );
635637

636-
// Match only the folder name passed from cli
638+
// Match only the folder name passed from cli.
637639
if ( -1 !== index ) {
638640
return true;
639641
}
@@ -703,12 +705,12 @@ module.exports = function(grunt) {
703705
'wp-includes/js/tinymce/plugins/wordpress/plugin.js',
704706
'wp-includes/js/tinymce/plugins/wp*/plugin.js',
705707

706-
// Exceptions
708+
// Exceptions.
707709
'!**/*.min.js',
708710
'!wp-admin/js/custom-header.js', // Why? We should minify this.
709711
'!wp-admin/js/farbtastic.js',
710712
'!wp-includes/js/swfobject.js',
711-
'!wp-includes/js/wp-embed.js' // We have extra options for this, see uglify:embed
713+
'!wp-includes/js/wp-embed.js' // We have extra options for this, see uglify:embed.
712714
]
713715
},
714716
embed: {
@@ -1030,41 +1032,41 @@ module.exports = function(grunt) {
10301032

10311033
grunt.log.writeln( 'Fetching list of Twemoji files...' );
10321034

1033-
// Fetch a list of the files that Twemoji supplies
1035+
// Fetch a list of the files that Twemoji supplies.
10341036
files = spawn( 'svn', [ 'ls', 'https://github.com/twitter/twemoji.git/trunk/assets/svg' ] );
10351037
if ( 0 !== files.status ) {
10361038
grunt.fatal( 'Unable to fetch Twemoji file list' );
10371039
}
10381040

10391041
entities = files.stdout.toString();
10401042

1041-
// Tidy up the file list
1043+
// Tidy up the file list.
10421044
entities = entities.replace( /\.svg/g, '' );
10431045
entities = entities.replace( /^$/g, '' );
10441046

1045-
// Convert the emoji entities to HTML entities
1047+
// Convert the emoji entities to HTML entities.
10461048
partials = entities = entities.replace( /([a-z0-9]+)/g, '&#x$1;' );
10471049

1048-
// Remove the hyphens between the HTML entities
1050+
// Remove the hyphens between the HTML entities.
10491051
entities = entities.replace( /-/g, '' );
10501052

1051-
// Sort the entities list by length, so the longest emoji will be found first
1053+
// Sort the entities list by length, so the longest emoji will be found first.
10521054
emojiArray = entities.split( '\n' ).sort( function ( a, b ) {
10531055
return b.length - a.length;
10541056
} );
10551057

1056-
// Convert the entities list to PHP array syntax
1058+
// Convert the entities list to PHP array syntax.
10571059
entities = '\'' + emojiArray.filter( function( val ) {
10581060
return val.length >= 8 ? val : false ;
10591061
} ).join( '\', \'' ) + '\'';
10601062

1061-
// Create a list of all characters used by the emoji list
1063+
// Create a list of all characters used by the emoji list.
10621064
partials = partials.replace( /-/g, '\n' );
10631065

1064-
// Set automatically removes duplicates
1066+
// Set automatically removes duplicates.
10651067
partialsSet = new Set( partials.split( '\n' ) );
10661068

1067-
// Convert the partials list to PHP array syntax
1069+
// Convert the partials list to PHP array syntax.
10681070
partials = '\'' + Array.from( partialsSet ).filter( function( val ) {
10691071
return val.length >= 8 ? val : false ;
10701072
} ).join( '\', \'' ) + '\'';
@@ -1158,7 +1160,7 @@ module.exports = function(grunt) {
11581160
}
11591161
});
11601162

1161-
// Allow builds to be minimal
1163+
// Allow builds to be minimal.
11621164
if( grunt.option( 'minimal-copy' ) ) {
11631165
var copyFilesOptions = grunt.config.get( 'copy.files.files' );
11641166
copyFilesOptions[0].src.push( '!wp-content/plugins/**' );

phpcompat.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<rule ref="PHPCompatibilityWP"/>
66

7-
<!-- WordPress Core currently supports PHP 5.6+ -->
7+
<!-- WordPress Core currently supports PHP 5.6+. -->
88
<config name="testVersion" value="5.6-"/>
99

1010
<!-- Only scan PHP files. -->
@@ -25,7 +25,7 @@
2525
<!-- Check up to 20 files simultaneously. -->
2626
<arg name="parallel" value="20"/>
2727

28-
<!-- Show sniff codes in all reports -->
28+
<!-- Show sniff codes in all reports. -->
2929
<arg value="ps"/>
3030

3131
<!-- For now, only the files in src are scanned. -->

phpcs.xml.dist

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<!-- Check up to 20 files simultaneously. -->
2121
<arg name="parallel" value="20"/>
2222

23-
<!-- Show sniff codes in all reports -->
23+
<!-- Show sniff codes in all reports. -->
2424
<arg value="ps"/>
2525

2626
<file>.</file>
@@ -48,7 +48,7 @@
4848
<rule ref="WordPress.NamingConventions.ValidVariableName">
4949
<properties>
5050
<property name="customPropertiesWhitelist" type="array">
51-
<!-- From database structure queries -->
51+
<!-- From database structure queries. -->
5252
<element value="Collation"/>
5353
<element value="Column_name"/>
5454
<element value="Default"/>
@@ -62,22 +62,22 @@
6262
<element value="Null"/>
6363
<element value="Sub_part"/>
6464
<element value="Type"/>
65-
<!-- From plugin/theme data -->
65+
<!-- From plugin/theme data. -->
6666
<element value="authorAndUri"/>
6767
<element value="Name"/>
6868
<element value="Version"/>
69-
<!-- From the result of wp_xmlrpc_server::wp_getPageList() -->
69+
<!-- From the result of wp_xmlrpc_server::wp_getPageList(). -->
7070
<element value="dateCreated"/>
7171

72-
<!-- From DOMDocument -->
72+
<!-- From DOMDocument. -->
7373
<element value="childNodes"/>
7474
<element value="formatOutput"/>
7575
<element value="nodeName"/>
7676
<element value="nodeType"/>
7777
<element value="parentNode"/>
7878
<element value="preserveWhiteSpace"/>
7979
<element value="textContent"/>
80-
<!-- From PHPMailer -->
80+
<!-- From PHPMailer. -->
8181
<element value="AltBody"/>
8282
<element value="Body"/>
8383
<element value="CharSet"/>
@@ -89,11 +89,11 @@
8989
<element value="MIMEHeader"/>
9090
<element value="Sender"/>
9191
<element value="Subject"/>
92-
<!-- From PHPUnit_Util_Getopt -->
92+
<!-- From PHPUnit_Util_Getopt. -->
9393
<element value="longOptions"/>
94-
<!-- From POP3 -->
94+
<!-- From POP3. -->
9595
<element value="ERROR"/>
96-
<!-- From ZipArchive -->
96+
<!-- From ZipArchive. -->
9797
<element value="numFiles"/>
9898
</property>
9999
</properties>
@@ -102,7 +102,7 @@
102102
<!-- Exclude the build folder in the current directory, as Travis puts the checkout in a build directory. -->
103103
<exclude-pattern type="relative">^build/*</exclude-pattern>
104104

105-
<!-- Directories and third party library exclusions -->
105+
<!-- Directories and third party library exclusions. -->
106106
<exclude-pattern>/node_modules/*</exclude-pattern>
107107
<exclude-pattern>/vendor/*</exclude-pattern>
108108

@@ -140,7 +140,7 @@
140140

141141
<exclude-pattern>/tests/phpunit/includes/speed-trap-listener\.php</exclude-pattern>
142142

143-
<!-- Test data and fixtures -->
143+
<!-- Test data and fixtures. -->
144144
<exclude-pattern>/tests/phpunit/build*</exclude-pattern>
145145
<exclude-pattern>/tests/phpunit/data/*</exclude-pattern>
146146

@@ -214,7 +214,7 @@
214214
<rule ref="WordPress.Files.FileName">
215215
<properties>
216216
<property name="custom_test_class_whitelist" type="array">
217-
<!-- Test case parent classes -->
217+
<!-- Test case parent classes. -->
218218
<element value="WP_UnitTestCase"/>
219219
<element value="WP_Ajax_UnitTestCase"/>
220220
<element value="WP_Canonical_UnitTestCase"/>
@@ -229,7 +229,7 @@
229229
<element value="WP_Import_UnitTestCase"/>
230230
<element value="Tests_Query_Conditionals"/>
231231

232-
<!-- Mock classes -->
232+
<!-- Mock classes. -->
233233
<element value="Spy_REST_Server"/>
234234
<element value="WP_REST_Test_Controller"/>
235235
<element value="WP_Image_Editor_Mock"/>
@@ -238,7 +238,7 @@
238238
<element value="MockAction"/>
239239
<element value="WP_Object_Cache"/>
240240

241-
<!-- PHPUnit helpers -->
241+
<!-- PHPUnit helpers. -->
242242
<element value="TracTickets"/>
243243
<element value="WP_PHPUnit_Util_Getopt"/>
244244
<element value="PHPUnit_Util_Test"/>
@@ -270,7 +270,7 @@
270270
</properties>
271271
</rule>
272272

273-
<!-- Assignments in while conditions are a valid method of looping over iterables -->
273+
<!-- Assignments in while conditions are a valid method of looping over iterables. -->
274274
<rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
275275
<exclude-pattern>*</exclude-pattern>
276276
</rule>
@@ -283,7 +283,7 @@
283283
<exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
284284
</rule>
285285

286-
<!-- Exclude some old classes that can't be renamed, as it would break back compat -->
286+
<!-- Exclude some old classes that can't be renamed, as it would break back compat. -->
287287
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
288288
<exclude-pattern>/src/wp-admin/includes/class-wp-filesystem-ftpsockets\.php</exclude-pattern>
289289
<exclude-pattern>/src/wp-includes/class-wp-oembed\.php</exclude-pattern>

phpunit.xml.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
beStrictAboutTestsThatDoNotTestAnything="true"
66
>
77
<testsuites>
8-
<!-- Default test suite to run all tests -->
8+
<!-- Default test suite to run all tests. -->
99
<testsuite name="default">
1010
<directory suffix=".php">tests/phpunit/tests</directory>
1111
<exclude>tests/phpunit/tests/rest-api/rest-autosaves-controller.php</exclude>
1212
</testsuite>
13-
<!-- Sets the DOING_AUTOSAVE constant, so needs to be run last -->
13+
<!-- Sets the DOING_AUTOSAVE constant, so needs to be run last. -->
1414
<testsuite name="restapi-autosave">
1515
<file>tests/phpunit/tests/rest-api/rest-autosaves-controller.php</file>
1616
</testsuite>
@@ -44,7 +44,7 @@
4444
<whitelist addUncoveredFilesFromWhitelist="true">
4545
<directory suffix=".php">src</directory>
4646
<exclude>
47-
<!-- Third party library exclusions -->
47+
<!-- Third party library exclusions. -->
4848
<directory suffix=".php">src/wp-includes/ID3</directory>
4949
<directory suffix=".php">src/wp-includes/IXR</directory>
5050
<directory suffix=".php">src/wp-includes/random_compat</directory>

src/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
wp_check_php_mysql_versions();
3030
wp_load_translations_early();
3131

32-
// Die with an error message
32+
// Die with an error message.
3333
$die = sprintf(
3434
'<p>%s</p>',
3535
__( 'You are running WordPress without JavaScript and CSS files. These need to be built.' )

src/js/_enqueues/admin/comment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jQuery(document).ready( function($) {
7070
* @param {Event} event The event object.
7171
* @return {void}
7272
*/
73-
$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
73+
$timestampdiv.find('.save-timestamp').click( function( event ) { // Crazyhorse - multiple OK cancels.
7474
var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
7575
newD = new Date( aa, mm - 1, jj, hh, mn );
7676

0 commit comments

Comments
 (0)