lint 961 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env python
  2. from __future__ import absolute_import
  3. import click
  4. import os
  5. import sys
  6. # This is to avoid needing to have the `sentry` package explicitly installed.
  7. sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, 'src'))
  8. @click.command()
  9. @click.argument('files', nargs=-1)
  10. @click.option('--js', default=None, is_flag=True)
  11. @click.option('--python', default=None, is_flag=True)
  12. @click.option('--format', default=False, is_flag=True)
  13. @click.option('--parseable', default=False, is_flag=True)
  14. def run(files, js, python, format, parseable):
  15. from sentry.lint import engine
  16. if js and not python:
  17. python = False
  18. elif python and not js:
  19. js = False
  20. else:
  21. js = True
  22. python = True
  23. if not files:
  24. files = None
  25. results = engine.run(files, js=js, py=python, format=format, parseable=parseable)
  26. if results:
  27. raise click.Abort
  28. if __name__ == '__main__':
  29. run()