--- Begin Message ---
Max Bowsher has proposed merging lp:~maxb/lazr-js/jslint-no-unneeded-bzr into lp:lazr-js.
Requested reviews:
Canonical Launchpad Engineering (launchpad)
For more details, see:
https://code.launchpad.net/~maxb/lazr-js/jslint-no-unneeded-bzr/+merge/48699
I was trying to use jslint on a file in a Subversion working copy. Having bzr-svn installed caused slow and unnecessary things to happen, even when I was providing jslint with an explicit file list.
This branch changes jslint to only call into bzrlib at all if it is operating in a mode in which it needs to.
--
https://code.launchpad.net/~maxb/lazr-js/jslint-no-unneeded-bzr/+merge/48699
Your team Canonical Launchpad Engineering is requested to review the proposed merge of lp:~maxb/lazr-js/jslint-no-unneeded-bzr into lp:lazr-js.
=== modified file 'src-py/lazr/js/jslint.py'
--- src-py/lazr/js/jslint.py 2009-11-13 18:08:43 +0000
+++ src-py/lazr/js/jslint.py 2011-02-05 16:01:30 +0000
@@ -24,12 +24,9 @@
js_filter = FiletypeFilter()
-class JSLinter:
- """Linter for Javascript."""
-
- def __init__(self, options=None):
+class FileFinder:
+ def __init__(self):
self.tree = workingtree.WorkingTree.open_containing('.')[0]
- self.options = options
def find_files_to_lint(self, delta):
"""Return the modified and added files in a tree from a delta."""
@@ -77,6 +74,13 @@
all_files.append(self.tree.abspath(path))
return all_files
+
+class JSLinter:
+ """Linter for Javascript."""
+
+ def __init__(self, options=None):
+ self.options = options
+
def jslint_rhino(self, filenames):
"""Run the linter on all selected files using rhino."""
args = ['rhino', '-f', FULLJSLINT, JSLINT_WRAPPER]
@@ -164,20 +168,22 @@
def main():
- load_plugins()
options, args = get_options()
linter = JSLinter(options.options)
js_filter.include_html = options.html
if args:
files = [f for f in args if js_filter(f)]
- elif options.all:
- files = linter.find_all_files_to_lint()
- elif options.working_tree:
- files = linter.find_files_to_lint_from_working_tree()
- elif options.parent:
- files = linter.find_files_to_lint_from_parent()
else:
- files = linter.find_files_to_lint_from_working_tree_or_parent()
+ load_plugins()
+ finder = FileFinder()
+ if options.all:
+ files = finder.find_all_files_to_lint()
+ elif options.working_tree:
+ files = finder.find_files_to_lint_from_working_tree()
+ elif options.parent:
+ files = finder.find_files_to_lint_from_parent()
+ else:
+ files = finder.find_files_to_lint_from_working_tree_or_parent()
if not files:
print 'jslint: No files to lint.'
else:
--- End Message ---