Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174147

Change subject: build: Create a 'typos' task and fix a remaining @returns to be 
@return
......................................................................

build: Create a 'typos' task and fix a remaining @returns to be @return

Change-Id: Iba63e2766319b13fb0dd374eda240828d2a55f96
---
M Gruntfile.js
A build/tasks/typos.js
A build/typos.txt
M src/core.js
4 files changed, 56 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/47/174147/1

diff --git a/Gruntfile.js b/Gruntfile.js
index 6d51162..e97eab3 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -94,6 +94,12 @@
                                
originalLessFiles['dist/oojs-ui-mediawiki.svg.css']
                        )
                },
+               typos: {
+                       options: {
+                               typos: 'build/typos.txt'
+                       },
+                       src: '{src,php}/**'
+               },
                concat: {
                        options: {
                                banner: grunt.file.read( 'build/banner.txt' )
@@ -326,13 +332,13 @@
                'concat:css', 'cssjanus', 'csscomb', 'cssmin'
        ] );
        grunt.registerTask( 'build-i18n', [ 'copy:i18n' ] );
-       grunt.registerTask( 'build', [ 'clean:build', 'fileExists', 
'build-code', 'build-styling', 'build-i18n', 'clean:tmp' ] );
+       grunt.registerTask( 'build', [ 'clean:build', 'fileExists', 'typos', 
'build-code', 'build-styling', 'build-i18n', 'clean:tmp' ] );
 
        grunt.registerTask( 'git-build', [ 'pre-git-build', 'build' ] );
 
        // Quickly build a no-frills vector-only ltr-only version for 
development
        grunt.registerTask( 'quick-build', [
-               'pre-git-build', 'clean:build', 'fileExists',
+               'pre-git-build', 'clean:build', 'fileExists', 'typos',
                'concat:js',
                'copy:lessTemp', 'colorizeSvg', 'less:distSvg', 'copy:svg',
                'copy:imagesApex', 'copy:imagesMediaWiki',
diff --git a/build/tasks/typos.js b/build/tasks/typos.js
new file mode 100644
index 0000000..c7f9ecf
--- /dev/null
+++ b/build/tasks/typos.js
@@ -0,0 +1,44 @@
+/*!
+ * Check files from 'src' for typos; fail if any are found.
+ */
+
+/*jshint node:true */
+module.exports = function ( grunt ) {
+
+       grunt.registerMultiTask( 'typos', function () {
+               var i, typoCount,
+                       options = this.options( {
+                               typos: 'typos.txt'
+                       } ),
+                       files = this.filesSrc,
+                       fileCount = files.length,
+                       typos = grunt.file.read( options.typos ).split( '\n' ),
+                       ok = true;
+
+               if ( typos.indexOf( '' ) > -1 ) {
+                       typos.splice( -1, 1 );
+               }
+               typoCount = typos.length;
+
+               files.forEach( function ( filepath ) {
+                       if ( grunt.file.isDir( filepath ) ) {
+                               fileCount--;
+                               return;
+                       }
+
+                       for (i = 0; i < typoCount; i++ ) {
+                               if ( grunt.file.read( filepath ).indexOf( 
typos[i] ) > -1 ) {
+                                       grunt.log.error( 'File "' + filepath + 
'" contains typo "' + typos[i] + '".' );
+                                       ok = false;
+                               }
+                       }
+               } );
+
+               if ( !ok ) {
+                       return false;
+               }
+
+               grunt.log.ok( 'No typos found; ' + fileCount + ' file' + ( 
fileCount !== 1 ? 's' : '') + ' checked for ' + typoCount + ' typo' + ( 
typoCount !== 1 ? 's' : '') + '.' );
+       } );
+
+};
diff --git a/build/typos.txt b/build/typos.txt
new file mode 100644
index 0000000..37f366d
--- /dev/null
+++ b/build/typos.txt
@@ -0,0 +1,3 @@
+@returns
+paralell
+properites
diff --git a/src/core.js b/src/core.js
index 96d31e5..b3813ba 100644
--- a/src/core.js
+++ b/src/core.js
@@ -88,7 +88,7 @@
  * @param {HTMLElement|HTMLElement[]} containers Container node(s) to search in
  * @param {HTMLElement} contained Node to find
  * @param {boolean} [matchContainers] Include the container(s) in the list of 
nodes to match, otherwise only match descendents
- * @returns {boolean} The node is in the list of target nodes
+ * @return {boolean} The node is in the list of target nodes
  */
 OO.ui.contains = function ( containers, contained, matchContainers ) {
        var i;

-- 
To view, visit https://gerrit.wikimedia.org/r/174147
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba63e2766319b13fb0dd374eda240828d2a55f96
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to