mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
37 lines
991 B
Python
Executable File
37 lines
991 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import os
|
|
import sys
|
|
|
|
# This is to avoid needing to have the `sentry` package explicitly installed.
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, "src"))
|
|
|
|
|
|
def run(files, js, python, format, parseable):
|
|
from sentry.lint import engine
|
|
|
|
if js and not python:
|
|
python = False
|
|
elif python and not js:
|
|
js = False
|
|
else:
|
|
js = True
|
|
python = True
|
|
|
|
if not files:
|
|
files = None
|
|
|
|
return engine.run(files, js=js, py=python, format=format, parseable=parseable)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("files", nargs="*")
|
|
parser.add_argument("--js", default=None, action="store_true")
|
|
parser.add_argument("--python", default=None, action="store_true")
|
|
parser.add_argument("--format", action="store_true")
|
|
parser.add_argument("--parseable", action="store_true")
|
|
sys.exit(run(**vars(parser.parse_args())))
|