Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from xenon.api import post
from xenon.core import analyze
from xenon.repository import gitrepo
args = args or parse_args()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('xenon')
if args.url and len(args.path) > 1:
logger.error(
'-u, --url cannot be used when multiple paths are specified',
)
sys.exit(1)
errors, cc_data = analyze(args, logger)
exit_code = 0
if args.url:
response = post(
url=args.url,
repo_token=args.repo_token,
service_job_id=args.service_job_id,
service_name=args.service_name,
git=gitrepo(args.path),
cc_data=cc_data
)
logger.info('HTTP: %s', response.status_code)
logger.info('HTTP: %s', response.text)
if 'error' in response.json():
exit_code = 3
if errors:
exit_code = 1
sys.exit(exit_code)