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

Unified Diff: recipe_engine/lint_test.py

Issue 2845783002: [recipes.py] Move fetch, lint and bundle parsers to separate modules. (Closed)
Patch Set: rebase Created 3 years, 8 months 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
Index: recipe_engine/lint_test.py
diff --git a/recipe_engine/lint_test.py b/recipe_engine/lint_test.py
old mode 100644
new mode 100755
index 860453039b9f25cd0e65fbe99244fea1da89d925..f71348e32b0b087a0698e53271b8be0df77b01dd
--- a/recipe_engine/lint_test.py
+++ b/recipe_engine/lint_test.py
@@ -61,11 +61,25 @@ def ImportsTest(recipe_path, recipe_name, whitelist, universe_view):
(recipe_path, module_name))
-def main(universe_view, whitelist=[]):
+def add_subparser(parser):
+ lint_p = parser.add_parser(
+ 'lint',
+ description='Check recipes for stylistic and hygenic issues')
+ lint_p.add_argument(
+ '--whitelist', '-w', action='append', default=[],
+ help='A regexp matching module names to add to the default whitelist. '
+ 'Use multiple times to add multiple patterns,')
+
+ lint_p.set_defaults(command='lint', func=main)
+
+
+def main(package_deps, args):
from . import loader
- from . import package
- whitelist = map(re.compile, MODULES_WHITELIST + whitelist)
+ universe = loader.RecipeUniverse(package_deps, args.package)
+ universe_view = loader.UniverseView(universe, package_deps.root_package)
+
+ whitelist = map(re.compile, MODULES_WHITELIST + args.whitelist)
errors = []
for recipe_path, recipe_name in universe_view.loop_over_recipes():
@@ -74,4 +88,3 @@ def main(universe_view, whitelist=[]):
if errors:
raise TestFailure('\n'.join(map(str, errors)))
-

Powered by Google App Engine
This is Rietveld 408576698