lint 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env python
  2. from __future__ import absolute_import
  3. import os
  4. import sys
  5. # This is to avoid needing to have the `sentry` package explicitly installed.
  6. sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, "src"))
  7. def run(files, js, python, format, parseable):
  8. from sentry.lint import engine
  9. if js and not python:
  10. python = False
  11. elif python and not js:
  12. js = False
  13. else:
  14. js = True
  15. python = True
  16. if not files:
  17. files = None
  18. return engine.run(files, js=js, py=python, format=format, parseable=parseable)
  19. if __name__ == "__main__":
  20. import argparse
  21. parser = argparse.ArgumentParser()
  22. parser.add_argument("files", nargs="*")
  23. parser.add_argument("--js", default=None, action="store_true")
  24. parser.add_argument("--python", default=None, action="store_true")
  25. parser.add_argument("--format", action="store_true")
  26. parser.add_argument("--parseable", action="store_true")
  27. sys.exit(run(**vars(parser.parse_args())))