You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/01/15 19:48:59 UTC

[5/8] allura git commit: [#8039] remove jslint; run eslint

[#8039] remove jslint; run eslint


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/92ee579f
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/92ee579f
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/92ee579f

Branch: refs/heads/db/8039
Commit: 92ee579faab0533587148855271940a9de58d3de
Parents: 6181273
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Jan 14 13:30:57 2016 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri Jan 15 11:11:38 2016 -0500

----------------------------------------------------------------------
 AlluraTest/LICENSE                  |   10 -
 AlluraTest/alluratest/validation.py |   34 +-
 AlluraTest/jslint/LICENSE           |   21 -
 AlluraTest/jslint/Makefile          |    7 -
 AlluraTest/jslint/env-js.jar        |  Bin 1110999 -> 0 bytes
 AlluraTest/jslint/fulljslint.js     | 5688 -----------------------------
 AlluraTest/jslint/js.jar            |  Bin 871260 -> 0 bytes
 AlluraTest/jslint/jslint.js         | 5729 ------------------------------
 AlluraTest/jslint/rhino.js          |   41 -
 LICENSE                             |    3 -
 rat-excludes.txt                    |    1 -
 11 files changed, 14 insertions(+), 11520 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/92ee579f/AlluraTest/LICENSE
----------------------------------------------------------------------
diff --git a/AlluraTest/LICENSE b/AlluraTest/LICENSE
index 8da34a3..d645695 100644
--- a/AlluraTest/LICENSE
+++ b/AlluraTest/LICENSE
@@ -200,13 +200,3 @@
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-
-AlluraTest SUBCOMPONENTS:
-
-AlluraTest includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source code
-for the these subcomponents is subject to the terms and conditions of the
-following licenses.
-
-JSLint, which is available under the MIT license.
-For details, see jslint/

http://git-wip-us.apache.org/repos/asf/allura/blob/92ee579f/AlluraTest/alluratest/validation.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/validation.py b/AlluraTest/alluratest/validation.py
index 97691df..f1a235b 100644
--- a/AlluraTest/alluratest/validation.py
+++ b/AlluraTest/alluratest/validation.py
@@ -89,17 +89,16 @@ class Config(object):
 
 
 def report_validation_error(val_name, filename, message):
-    message = '%s Validation errors (%s):\n%s\n' % (
-        val_name, filename, message)
+    message = '%s Validation errors (%s):\n%s\n' % (val_name, filename, message)
     if Config.instance().fail_on_validation(val_name):
         ok_(False, message)
     else:
         sys.stderr.write('=' * 40 + '\n' + message)
 
 
-def dump_to_file(prefix, html):
-    f = tempfile.NamedTemporaryFile(prefix=prefix, delete=False)
-    f.write(html)
+def dump_to_file(prefix, contents, suffix=''):
+    f = tempfile.NamedTemporaryFile(prefix=prefix, delete=False, suffix=suffix)
+    f.write(contents)
     f.close()
     return f.name
 
@@ -165,7 +164,7 @@ def validate_html5(html_or_response):
         resp = re.sub('Error: ' + ignore, 'Ignoring: ' + ignore, resp)
 
     if 'Error:' in resp:
-        fname = dump_to_file('html5-', html)
+        fname = dump_to_file('html5-', html, suffix='.html')
         message = resp.decode('ascii', 'ignore')
         report_validation_error('html5', fname, message)
 
@@ -192,23 +191,18 @@ def validate_js(html_or_response):
     if hasattr(html_or_response, 'body'):
         if html_or_response.status_int != 200:
             return
-        html = html_or_response.body
+        js = html_or_response.body
     else:
-        html = html_or_response
-    basedir = path.dirname(path.abspath(__file__))
-    jslint_dir = basedir + '/../jslint'
-    fname = dump_to_file('jslint-', html)
-    cmd = 'java -jar ' + jslint_dir + '/js.jar ' + \
-        jslint_dir + '/jslint.js ' + fname
-    p = subprocess.Popen(cmd, shell=True,
+        js = html_or_response
+    fname = dump_to_file('eslint-', js, suffix='.js')
+    p = subprocess.Popen(['eslint', '--no-ignore', fname],
                          stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    stdout, stderr = p.communicate(html)
-    if stdout.startswith('jslint: No problems found'):
+    stdout, stderr = p.communicate(js)
+    if p.returncode == 0:
         os.unlink(fname)
-        return
-    stdout = stdout.decode('UTF-8', 'replace')
-    msg = '\n'.join(repr(s) for s in stdout.split('\n') if s)
-    report_validation_error('js', fname, msg)
+    else:
+        stdout = stdout.decode('utf8')
+        report_validation_error('js', fname, stdout)
 
 
 def validate_page(html_or_response):

http://git-wip-us.apache.org/repos/asf/allura/blob/92ee579f/AlluraTest/jslint/LICENSE
----------------------------------------------------------------------
diff --git a/AlluraTest/jslint/LICENSE b/AlluraTest/jslint/LICENSE
deleted file mode 100644
index 9532d4e..0000000
--- a/AlluraTest/jslint/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2002 Douglas Crockford  (www.JSLint.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

http://git-wip-us.apache.org/repos/asf/allura/blob/92ee579f/AlluraTest/jslint/Makefile
----------------------------------------------------------------------
diff --git a/AlluraTest/jslint/Makefile b/AlluraTest/jslint/Makefile
deleted file mode 100644
index 7efd72e..0000000
--- a/AlluraTest/jslint/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# Make single-file jslint script out of  main script (from jslint.com,
-# patched by us to tweak its behavior, as it configurability leaves much
-# to be desired) and Rhino support module. Needed because Rhino accepts
-# only single file as script.
-
-jslint.js: fulljslint.js rhino.js
-	cat $^ >$@

http://git-wip-us.apache.org/repos/asf/allura/blob/92ee579f/AlluraTest/jslint/env-js.jar
----------------------------------------------------------------------
diff --git a/AlluraTest/jslint/env-js.jar b/AlluraTest/jslint/env-js.jar
deleted file mode 100644
index 072891a..0000000
Binary files a/AlluraTest/jslint/env-js.jar and /dev/null differ