Kaldari has uploaded a new change for review. https://gerrit.wikimedia.org/r/176733
Change subject: Hygiene: Just some comment fixes and additions to WikiGrokResponseApi ...................................................................... Hygiene: Just some comment fixes and additions to WikiGrokResponseApi Change-Id: I2d814e37f012d29b14a8372a760f1a8d8ca7dd32 --- M dev-scripts/pre-review M javascripts/modules/wikigrok/WikiGrokResponseApi.js 2 files changed, 9 insertions(+), 82 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/33/176733/1 diff --git a/dev-scripts/pre-review b/dev-scripts/pre-review index a40a470..746b54a 100755 --- a/dev-scripts/pre-review +++ b/dev-scripts/pre-review @@ -1,78 +1,2 @@ #!/usr/bin/env python # Enable this pre-review hook by running 'make installhooks' -import sys -import urllib2 -import subprocess -import json - -MAX_OPEN_PATCHES = 7 -PROJECT_NAME = "mediawiki/extensions/MobileFrontend" - -def get_last_commit(): - command = "git log -1" - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) - - #Launch the shell command: - output, error = process.communicate() - return output - -def query_gerrit(): - url = "https://gerrit.wikimedia.org/r/changes/?n=25&o=LABELS&q=status:open+project:%s" % PROJECT_NAME - req = urllib2.Request(url) - req.add_header('Accept', 'application/json') - resp, data = urllib2.urlopen(req) - return json.loads(data) - -changes = query_gerrit() -open_patches = 0 -commit = get_last_commit() - -if len(changes) == 0: - print "WARNING: Gerrit API did not return any changes for project %s!" % PROJECT_NAME - print "This is suspicious and should not happen unless there are no open changes." - print "If you are sure that this is the case, you can skip this check by running `git review --no-custom-script`." - sys.exit(1) - -for change in changes: - # This patch is updating an existing one so let's allow it. - if change["change_id"] in commit: - sys.exit() - - reviews = change["labels"]["Code-Review"] - jenkins = change["labels"]["Verified"] - - if ( - 'disliked' not in reviews and - 'rejected' not in reviews and - 'approved' not in reviews and - 'rejected' not in jenkins and - 'WIP' not in change['subject'] - ): - open_patches += 1 - -''' -Run jsduck and complain if there is an non zero exit code -@returns string if there are warnings -@returns false if no warnings -''' -def js_duck_warnings(): - command = "make jsduck" - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) - - #Launch the shell command: - output, error = process.communicate() - if error: - return error - else: - return False - -js_duck_warnings = js_duck_warnings() -if js_duck_warnings: - print 'Please fix the jsduck warnings before submitting this for code review:' - print js_duck_warnings - sys.exit(1) - -if open_patches > MAX_OPEN_PATCHES: - print 'Do some code review first! There are %s open unreviewed patches!' % open_patches - print 'You can still send this review by running `git review --no-custom-script` but note this will generate bad karma.' - sys.exit(1) diff --git a/javascripts/modules/wikigrok/WikiGrokResponseApi.js b/javascripts/modules/wikigrok/WikiGrokResponseApi.js index e9ac5eb..16618b3 100644 --- a/javascripts/modules/wikigrok/WikiGrokResponseApi.js +++ b/javascripts/modules/wikigrok/WikiGrokResponseApi.js @@ -4,25 +4,28 @@ Api = M.require( 'api' ).Api; /** - * Record claims to the WikiGrok api + * Record claims to the WikiGrok API * @class WikiGrokApi */ WikiGrokResponseApi = Api.extend( { - + /** + * Initialize with default values + * @method + */ initialize: function ( options ) { this.subjectId = options.itemId; this.subject = options.subject; this.userToken = options.userToken; this.taskToken = options.taskToken; this.taskType = 'version ' + options.version; - this.testing = false; // FIXME: TBD on what qualifies as a test + this.testing = false; Api.prototype.initialize.apply( this, arguments ); }, /** - * Saves claims to the wikigrok api server + * Saves claims to the wikigrok API server * @method - * @param {Array} claims a list of claims. Each claim must have correct, prop, propid, value and valueid set - * @return {jQuery.Deferred} + * @param {Array} claims A list of claims. Each claim must have correct, prop, propid, value and valueid set + * @return {jQuery.Deferred} Object returned by ajax call */ recordClaims: function ( claims ) { return this.postWithToken( 'edit', { -- To view, visit https://gerrit.wikimedia.org/r/176733 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2d814e37f012d29b14a8372a760f1a8d8ca7dd32 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Kaldari <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
