Patchwork [2,of,2] tests: use jshint when available to check .js files

login
register
mail settings
Submitter Anton Shestakov
Date Nov. 11, 2017, 7:40 a.m.
Message ID <42809ebcbc783e0d2738.1510386036@neuro>
Download mbox | patch
Permalink /patch/25475/
State Accepted
Headers show

Comments

Anton Shestakov - Nov. 11, 2017, 7:40 a.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1510384041 -28800
#      Sat Nov 11 15:07:21 2017 +0800
# Node ID 42809ebcbc783e0d27385c6ea1e1731df44a4f4e
# Parent  36e26161d81233a8ef18e40b4198d86b23113159
tests: use jshint when available to check .js files
Denis Laxalde - Nov. 11, 2017, 9:27 a.m.
LGTM.

Anton Shestakov a écrit :
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1510384041 -28800
> #      Sat Nov 11 15:07:21 2017 +0800
> # Node ID 42809ebcbc783e0d27385c6ea1e1731df44a4f4e
> # Parent  36e26161d81233a8ef18e40b4198d86b23113159
> tests: use jshint when available to check .js files
> 
> diff --git a/tests/hghave.py b/tests/hghave.py
> --- a/tests/hghave.py
> +++ b/tests/hghave.py
> @@ -444,6 +444,10 @@ def has_clang_format():
>       return matchoutput("clang-format --help",
>                          br"^OVERVIEW: A tool to format C/C\+\+[^ ]+ code.")
>   
> +@check("jshint", "JSHint static code analysis tool")
> +def has_jshint():
> +    return matchoutput("jshint --version 2>&1", br"jshint v")
> +
>   @check("pygments", "Pygments source highlighting library")
>   def has_pygments():
>       try:
> diff --git a/tests/test-check-jshint.t b/tests/test-check-jshint.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-check-jshint.t
> @@ -0,0 +1,12 @@
> +#require test-repo jshint hg10
> +
> +  $ . "$TESTDIR/helpers-testrepo.sh"
> +
> +run jshint on all tracked files ending in .js except vendored dependencies
> +
> +  $ cd "`dirname "$TESTDIR"`"
> +
> +  $ testrepohg locate 'set:**.js' \
> +  > -X mercurial/templates/static/excanvas.js \
> +  > 2>/dev/null \
> +  > | xargs jshint
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Yuya Nishihara - Nov. 12, 2017, 8:21 a.m.
On Sat, 11 Nov 2017 10:27:32 +0100, Denis Laxalde wrote:
> LGTM.
> 
> Anton Shestakov a écrit :
> > # HG changeset patch
> > # User Anton Shestakov <av6@dwimlabs.net>
> > # Date 1510384041 -28800
> > #      Sat Nov 11 15:07:21 2017 +0800
> > # Node ID 42809ebcbc783e0d27385c6ea1e1731df44a4f4e
> > # Parent  36e26161d81233a8ef18e40b4198d86b23113159
> > tests: use jshint when available to check .js files

Queued, thanks.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -444,6 +444,10 @@  def has_clang_format():
     return matchoutput("clang-format --help",
                        br"^OVERVIEW: A tool to format C/C\+\+[^ ]+ code.")
 
+@check("jshint", "JSHint static code analysis tool")
+def has_jshint():
+    return matchoutput("jshint --version 2>&1", br"jshint v")
+
 @check("pygments", "Pygments source highlighting library")
 def has_pygments():
     try:
diff --git a/tests/test-check-jshint.t b/tests/test-check-jshint.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-jshint.t
@@ -0,0 +1,12 @@ 
+#require test-repo jshint hg10
+
+  $ . "$TESTDIR/helpers-testrepo.sh"
+
+run jshint on all tracked files ending in .js except vendored dependencies
+
+  $ cd "`dirname "$TESTDIR"`"
+
+  $ testrepohg locate 'set:**.js' \
+  > -X mercurial/templates/static/excanvas.js \
+  > 2>/dev/null \
+  > | xargs jshint