Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/171995
Change subject: Tools: Run `make jsduck` on git review
......................................................................
Tools: Run `make jsduck` on git review
When publishing code for review run jsduck and complain if there
are warnings.
Change-Id: I3ac7c8a6115c7392b3b86d6955fc565c60ff070d
---
M Makefile
M dev-scripts/pre-review
2 files changed, 24 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/95/171995/1
diff --git a/Makefile b/Makefile
index f2245de..f6daa73 100644
--- a/Makefile
+++ b/Makefile
@@ -34,10 +34,11 @@
mkdir -p docs
jsduck ${MW_INSTALL_PATH}/extensions/Mantle/javascripts/ javascripts/ \
--output docs/js/ \
+ --warnings-exit-nonzero \
--external=OO.EventEmitter,jQuery.Object,Hogan.Template,HandleBars.Template,jQuery.Deferred,jQuery.Event,mw.user
\
--exclude=javascripts/external \
--ignore-global \
- --warnings=nodoc,nodocmember
+ --warnings=nodoc
phpdoc: nodecheck ## Build the PHP documentation
mkdir -p docs
diff --git a/dev-scripts/pre-review b/dev-scripts/pre-review
index 35a5a74..fdc6e47 100755
--- a/dev-scripts/pre-review
+++ b/dev-scripts/pre-review
@@ -50,6 +50,28 @@
):
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.'
--
To view, visit https://gerrit.wikimedia.org/r/171995
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ac7c8a6115c7392b3b86d6955fc565c60ff070d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits