lint 991 B

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