Thiemo Mättig (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/352349 )
Change subject: Enable JSCS rule to enforce space in "function ()"
......................................................................
Enable JSCS rule to enforce space in "function ()"
Change-Id: I6fe2c1e5c00e1bc8293051115a98588d80d52161
---
M .jscsrc
M phpcs.xml
M resources/datamodel/Lexeme.js
M resources/getDeserializer.js
M resources/jquery.wikibase.lexemeformlistview.js
M resources/jquery.wikibase.lexemeview.js
M resources/serialization/LexemeDeserializer.js
M resources/view/ControllerViewFactory.js
M tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
M tests/qunit/serialization/LexemeDeserializer.tests.js
10 files changed, 37 insertions(+), 54 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme
refs/changes/49/352349/1
diff --git a/.jscsrc b/.jscsrc
index 16fc4fe..1226880 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -13,22 +13,6 @@
}
},
"requireMultipleVarDecl": null,
- "requireSpaceAfterKeywords": [
- "do",
- "for",
- "if",
- "else",
- "switch",
- "case",
- "try",
- "catch",
- "void",
- "while",
- "with",
- "return",
- "typeof"
- // FIXME: Currently disabled for "function".
- ],
"requireSpaceAfterLineComment": null,
"requireVarDeclFirst": null,
diff --git a/phpcs.xml b/phpcs.xml
index 3199abd..68906a1 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<ruleset name="WikibaseLexeme">
- <rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase">
- </rule>
+ <rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase" />
<!-- Exceptions -->
diff --git a/resources/datamodel/Lexeme.js b/resources/datamodel/Lexeme.js
index c6abf2e..67dcdbb 100644
--- a/resources/datamodel/Lexeme.js
+++ b/resources/datamodel/Lexeme.js
@@ -1,4 +1,4 @@
-( function( wb, util ) {
+( function ( wb, util ) {
'use strict';
var PARENT = wb.datamodel.Entity;
@@ -21,7 +21,7 @@
var SELF = wb.datamodel.Lexeme = util.inherit(
'WbDataModelLexeme',
PARENT,
- function( lexemeId, labels, statementGroupSet ) {
+ function ( lexemeId, labels, statementGroupSet ) {
labels = labels || new wb.datamodel.TermMap();
statementGroupSet = statementGroupSet || new
wb.datamodel.StatementGroupSet();
@@ -48,28 +48,28 @@
/**
* @return {wikibase.datamodel.StatementGroupSet}
*/
- getStatements: function() {
+ getStatements: function () {
return this._statementGroupSet;
},
/**
* @param {wikibase.datamodel.Statement} statement
*/
- addStatement: function( statement ) {
+ addStatement: function ( statement ) {
this._statementGroupSet.addStatement( statement );
},
/**
* @param {wikibase.datamodel.Statement} statement
*/
- removeStatement: function( statement ) {
+ removeStatement: function ( statement ) {
this._statementGroupSet.removeStatement( statement );
},
/**
* @return {boolean}
*/
- isEmpty: function() {
+ isEmpty: function () {
return this._statementGroupSet.isEmpty() &&
this._fingerprint.isEmpty();
},
@@ -77,7 +77,7 @@
* @param {*} lexeme
* @return {boolean}
*/
- equals: function( lexeme ) {
+ equals: function ( lexeme ) {
return lexeme === this ||
( lexeme instanceof SELF &&
this._id === lexeme.getId() &&
diff --git a/resources/getDeserializer.js b/resources/getDeserializer.js
index 129a467..a296d58 100644
--- a/resources/getDeserializer.js
+++ b/resources/getDeserializer.js
@@ -1,6 +1,6 @@
-( function( wb ) {
+( function ( wb ) {
'use strict';
- module.exports = function() {
+ module.exports = function () {
return new wb.lexeme.serialization.LexemeDeserializer();
};
}( wikibase ) );
diff --git a/resources/jquery.wikibase.lexemeformlistview.js
b/resources/jquery.wikibase.lexemeformlistview.js
index c464a5f..f06d4ed 100644
--- a/resources/jquery.wikibase.lexemeformlistview.js
+++ b/resources/jquery.wikibase.lexemeformlistview.js
@@ -46,7 +46,7 @@
* @inheritdoc
* @protected
*/
- destroy: function() {
+ destroy: function () {
this._listview.destroy();
PARENT.prototype.destroy.call( this );
},
@@ -56,7 +56,7 @@
*
* @private
*/
- _createListView: function() {
+ _createListView: function () {
this._listview = new $.wikibase.listview( {
listItemAdapter:
this.options.getListItemAdapter( this._removeItem.bind( this ) ),
listItemNodeName: 'div'
@@ -70,7 +70,7 @@
* @see jQuery.wikibase.listview.enterNewItem
* @return {jQuery.Promise}
*/
- enterNewItem: function() {
+ enterNewItem: function () {
return this._listview.enterNewItem();
},
@@ -79,7 +79,7 @@
*
* @param {jQuery.wikibase.lexemeformview} lexemeformview
*/
- _removeItem: function( lexemeformview ) {
+ _removeItem: function ( lexemeformview ) {
this._listview.removeItem( lexemeformview.element );
this._trigger( 'afterremove' );
}
diff --git a/resources/jquery.wikibase.lexemeview.js
b/resources/jquery.wikibase.lexemeview.js
index 92c1b4b..c53c0f4 100644
--- a/resources/jquery.wikibase.lexemeview.js
+++ b/resources/jquery.wikibase.lexemeview.js
@@ -1,4 +1,4 @@
-( function( $ ) {
+( function ( $ ) {
'use strict';
var PARENT = $.wikibase.entityview;
@@ -37,7 +37,7 @@
* @inheritdoc
* @protected
*/
- _create: function() {
+ _create: function () {
this._createEntityview();
this.$statements = $(
'.wikibase-statementgrouplistview', this.element );
@@ -52,7 +52,7 @@
* @inheritdoc
* @protected
*/
- _init: function() {
+ _init: function () {
if ( !this.options.buildStatementGroupListView ||
!this.options.buildLexemeFormListView ) {
throw new Error( 'Required option(s) missing' );
}
@@ -64,7 +64,7 @@
/**
* @protected
*/
- _initStatements: function() {
+ _initStatements: function () {
this.options.buildStatementGroupListView(
this.options.value, this.$statements );
// This is here to be sure there is never a duplicate
id:
@@ -78,7 +78,7 @@
* @inheritdoc
* @protected
*/
- _attachEventHandlers: function() {
+ _attachEventHandlers: function () {
PARENT.prototype._attachEventHandlers.call( this );
var self = this;
@@ -88,7 +88,7 @@
'statementviewafterstartediting.' +
this.widgetName,
'referenceviewafterstartediting.' +
this.widgetName
].join( ' ' ),
- function() {
+ function () {
self._trigger( 'afterstartediting' );
} );
@@ -99,7 +99,7 @@
'statementviewafterremove.' + this.widgetName,
'referenceviewafterstopediting.' +
this.widgetName
].join( ' ' ),
- function( event, dropValue ) {
+ function ( event, dropValue ) {
self._trigger( 'afterstopediting', null, [
dropValue ] );
} );
},
@@ -108,7 +108,7 @@
* @inheritdoc
* @protected
*/
- _setState: function( state ) {
+ _setState: function ( state ) {
PARENT.prototype._setState.call( this, state );
this.$statements.data( 'statementgrouplistview' )[
state ]();
diff --git a/resources/serialization/LexemeDeserializer.js
b/resources/serialization/LexemeDeserializer.js
index 92f81e0..4b17d39 100644
--- a/resources/serialization/LexemeDeserializer.js
+++ b/resources/serialization/LexemeDeserializer.js
@@ -1,4 +1,4 @@
-( function( wb, util ) {
+( function ( wb, util ) {
'use strict';
var MODULE = wb.lexeme.serialization,
@@ -21,7 +21,7 @@
*
* @throws {Error} if serialization does not resolve to a
serialized Lexeme.
*/
- deserialize: function( serialization ) {
+ deserialize: function ( serialization ) {
if ( serialization.type !== wb.datamodel.Lexeme.TYPE ) {
throw new Error( 'Serialization does not
resolve to a Lexeme' );
}
diff --git a/resources/view/ControllerViewFactory.js
b/resources/view/ControllerViewFactory.js
index 939ba70..2b71fad 100644
--- a/resources/view/ControllerViewFactory.js
+++ b/resources/view/ControllerViewFactory.js
@@ -103,7 +103,7 @@
SELF.prototype.getListItemAdapterForLexemeFormListView = function (
startEditingCallback, removeCallback ) {
var self = this,
view,
- doRemove = function() {
+ doRemove = function () {
return removeCallback( view );
};
diff --git a/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
b/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
index 8ec6f6a..a5c5597 100644
--- a/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
+++ b/tests/qunit/jquery.wikibase.lexemeformlistview.tests.js
@@ -1,42 +1,42 @@
/**
* @license GPL-2.0+
*/
-( function( $, wb, QUnit, sinon ) {
+( function ( $, wb, QUnit, sinon ) {
'use strict';
var lexemeformviewListItemAdapter = wb.tests.getMockListItemAdapter(
'lexemeformview',
- function() {
+ function () {
}
);
- var createViewElement = function() {
+ var createViewElement = function () {
var $node = $( '<div><div
class="wikibase-lexeme-forms"/></div>' );
return $node.lexemeformlistview( {
- getListItemAdapter: function() {
+ getListItemAdapter: function () {
return lexemeformviewListItemAdapter;
},
- getAdder: function() {}
+ getAdder: function () {}
} );
};
- var getViewFromElement = function( $view ) {
+ var getViewFromElement = function ( $view ) {
return $view.data( 'lexemeformlistview' );
};
- var newView = function() {
+ var newView = function () {
return getViewFromElement( createViewElement() );
};
QUnit.module( 'jquery.wikibase.lexemeformlistview' );
- QUnit.test( 'Can be created', function( assert ) {
+ QUnit.test( 'Can be created', function ( assert ) {
var view = newView();
assert.ok( view instanceof $.wikibase.lexemeformlistview );
} );
- QUnit.test( 'enterNewItem adds new list item', function( assert ) {
+ QUnit.test( 'enterNewItem adds new list item', function ( assert ) {
var view = newView(),
listItemAdapterSpy = sinon.spy(
lexemeformviewListItemAdapter, 'newListItem' );
@@ -48,7 +48,7 @@
listItemAdapterSpy.restore();
} );
- QUnit.test( 'Can be destroyed', function( assert ) {
+ QUnit.test( 'Can be destroyed', function ( assert ) {
var $view = createViewElement();
assert.ok( getViewFromElement( $view ) );
diff --git a/tests/qunit/serialization/LexemeDeserializer.tests.js
b/tests/qunit/serialization/LexemeDeserializer.tests.js
index ccc52e1..8418b02 100644
--- a/tests/qunit/serialization/LexemeDeserializer.tests.js
+++ b/tests/qunit/serialization/LexemeDeserializer.tests.js
@@ -2,7 +2,7 @@
* @license GPL-2.0+
* @author Jonas Kress
*/
-( function( $, wb, QUnit ) {
+( function ( $, wb, QUnit ) {
'use strict';
QUnit.module( 'wikibase.lexeme.serialization.LexemeDeserializer' );
@@ -39,7 +39,7 @@
] )
);
- QUnit.test( 'deserialize()', 2, function( assert ) {
+ QUnit.test( 'deserialize()', 2, function ( assert ) {
var ds = new wb.lexeme.serialization.LexemeDeserializer();
assert.deepEqual(
--
To view, visit https://gerrit.wikimedia.org/r/352349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fe2c1e5c00e1bc8293051115a98588d80d52161
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits