Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1418)

Unified Diff: common/eslint/eslint/__init__.py

Issue 2535983002: [eslint] Don't treat eslint warnings as PRESUBMIT errors (Closed)
Patch Set: fix smoke test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/eslint/bin/run_eslint ('k') | common/eslint/eslint/smoke_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/eslint/eslint/__init__.py
diff --git a/common/eslint/eslint/__init__.py b/common/eslint/eslint/__init__.py
index 442d87cd608ea27ad8544e38235f272a6def196b..fdd377c35bfd23f879cc8c4cdb96dca30ae0a239 100644
--- a/common/eslint/eslint/__init__.py
+++ b/common/eslint/eslint/__init__.py
@@ -42,39 +42,20 @@ DEFAULT_ESLINT_RULES_DIR = os.path.join(
def _CreateEslintCommand(rulesdir, extra_args):
eslint_cmd = BASE_ESLINT_CMD + [
- '--rulesdir', rulesdir
+ '--rulesdir', rulesdir, '--ext', '.js,.html'
]
if extra_args:
eslint_cmd += [extra_args]
return eslint_cmd
-def RunEslintOnDirs(dirs,
- rules_dir=DEFAULT_ESLINT_RULES_DIR,
- extra_args=None):
- if type(dirs) is not list or len(dirs) == 0:
- raise ValueError('Must specify a non-empty list of directories to lint.')
+def RunEslint(paths, rules_dir=DEFAULT_ESLINT_RULES_DIR, extra_args=None):
+ if type(paths) is not list or len(paths) == 0:
+ raise ValueError('Must specify a non-empty list of paths to lint.')
try:
- find_cmd = ['find'] + dirs + ['-name', '*.html']
eslint_cmd = _CreateEslintCommand(rules_dir, extra_args)
- p1 = subprocess.Popen(find_cmd, stdout=subprocess.PIPE)
- output = subprocess.check_output(['xargs'] + eslint_cmd, stdin=p1.stdout)
- p1.wait()
- return output
+ return True, subprocess.check_output(eslint_cmd + paths,
+ stderr=subprocess.STDOUT).rstrip()
except subprocess.CalledProcessError as e:
- return e.output
-
-
-def RunEslintOnFiles(filenames,
- rules_dir=DEFAULT_ESLINT_RULES_DIR,
- extra_args=None):
- if type(filenames) is not list or len(filenames) == 0:
- raise ValueError('Must specify a non-empty list of files to lint.')
-
- try:
- eslint_cmd = _CreateEslintCommand(rules_dir, extra_args)
- return subprocess.check_output(eslint_cmd + filenames,
- stderr=subprocess.STDOUT)
- except subprocess.CalledProcessError as e:
- return e.output
+ return False, e.output.rstrip()
« no previous file with comments | « common/eslint/bin/run_eslint ('k') | common/eslint/eslint/smoke_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698