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

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

Issue 2535983002: [eslint] Don't treat eslint warnings as PRESUBMIT errors (Closed)
Patch Set: Created 4 years, 1 month 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
« common/eslint/bin/run_eslint ('K') | « common/eslint/bin/run_eslint ('k') | no next file » | 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..1a3570888cca34934ab5f40f829ec43f1f232f22 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.')
-
- 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
- except subprocess.CalledProcessError as e:
- return e.output
-
-
-def RunEslintOnFiles(filenames,
- rules_dir=DEFAULT_ESLINT_RULES_DIR,
- extra_args=None):
+def RunEslint(filenames, rules_dir=DEFAULT_ESLINT_RULES_DIR, extra_args=None):
charliea (OOO until 10-5) 2016/11/28 21:54:21 For the return value: - I think it might make sen
eakuefner 2016/11/28 22:27:50 Done.
if type(filenames) is not list or len(filenames) == 0:
- raise ValueError('Must specify a non-empty list of files to lint.')
+ raise ValueError('Must specify a non-empty list of files/dirs to lint.')
try:
eslint_cmd = _CreateEslintCommand(rules_dir, extra_args)
return subprocess.check_output(eslint_cmd + filenames,
- stderr=subprocess.STDOUT)
+ stderr=subprocess.STDOUT).rstrip(), False
except subprocess.CalledProcessError as e:
- return e.output
+ return e.output.rstrip(), True
« common/eslint/bin/run_eslint ('K') | « common/eslint/bin/run_eslint ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698