Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lugensa/gocept.jslint
This package integrates the JSHint code analysis tool (http://jshint.com) with Python's unittest module.
https://github.com/lugensa/gocept.jslint
jshint python unittest
Last synced: 21 days ago
JSON representation
This package integrates the JSHint code analysis tool (http://jshint.com) with Python's unittest module.
- Host: GitHub
- URL: https://github.com/lugensa/gocept.jslint
- Owner: lugensa
- Created: 2019-08-27T07:27:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T06:29:13.000Z (about 1 year ago)
- Last Synced: 2024-11-15T19:48:41.148Z (about 1 month ago)
- Topics: jshint, python, unittest
- Language: Python
- Homepage:
- Size: 123 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
Awesome Lists containing this project
README
=============
gocept.jslint
=============This package integrates the JSHint code analysis tool (http://jshint.com) with
Python's unittest module. (The name is left over from when JSHint didn't exist
and only Douglas Crockford's JSLint was available.)It provides a special JSLint-TestCase class that collects JavaScript files (in
a configurable manner) and dynamically generates a test method for each file
that calls jshint on that file.To use it, create a test class like this::
class MyJSLintTest(gocept.jslint.TestCase):
include = ('my.package.browser:js',
'my.package.browser:js/lib')
options = (gocept.jslint.TestCase.options +
('browser', 'jquery',))``include`` is a list of "resource paths" of the form ``packagename:path``
(passed to pkg_resources).``options`` is a list of arguments that are passed to JSHint (see its
`documentation`_ for details)... _documentation: http://www.jshint.com/options/
``predefined`` is a list of global names that should be considered predefined
(for use with the ``undef`` option).``exclude`` can be a list of filenames (without path) that will not be
collected.All files ending in ``.js`` contained in each of these paths will be collected,
and the test class will grow a method named ``test_jslint_filename.js``.You can ignore JSLint error by setting ``ignore`` on the test class (a list of
substrings that are matched against each JSLint output line):ignore = (
"Use a named parameter",
)Requirements
============gocept.jslint is tested with Python 3.6 up to 3.9.
gocept.jslint uses `node.js`_ to run jshint, so you need to have node.js
(version 0.3 or later) with the ``jshint`` npm module installed and the
``jshint`` binary available on your ``$PATH``.You can customize the name of the jshint binary by setting ``jshint_command``
on the TestCase, or set the environment variable ``JSHINT_COMMAND``... _node.js: http://nodejs.org/