create config.py and move BUG_FOUND_ERROR_CODE there

Summary: public
This is the first of a series of patches that reorganise the inferlib package
into a bunch of smaller modules.

Reviewed By: martinoluca

Differential Revision: D2641917

fb-gh-sync-id: 19788b5
master
Jules Villard 9 years ago committed by facebook-github-bot-7
parent 1180aabe39
commit ded09066ed

@ -9,7 +9,7 @@ import platform
import sys
import inferlib
from inferlib import analyze, utils
from inferlib import analyze, config, utils
CAPTURE_PACKAGE = 'capture'
@ -174,7 +174,7 @@ def main():
encoding=utils.LOCALE) as bugs_file:
bugs = json.load(bugs_file)
if len(bugs) > 0:
sys.exit(analyze.BUG_FOUND_ERROR_CODE)
sys.exit(config.BUG_FOUND_ERROR_CODE)
except OSError:
pass

@ -25,7 +25,7 @@ import tempfile
import time
import xml.etree.ElementTree as ET
from . import jwlib, utils
from . import config, jwlib, utils
# Increase the limit of the CSV parser to sys.maxlimit
csv.field_size_limit(sys.maxsize)
@ -46,8 +46,6 @@ ERROR = 'ERROR'
WARNING = 'WARNING'
INFO = 'INFO'
BUG_FOUND_ERROR_CODE = 2
def get_infer_version():
try:
return subprocess.check_output([
@ -105,7 +103,7 @@ base_group.add_argument('-nf', '--no-filtering', action='store_true',
base_group.add_argument('--fail-on-bug', action='store_true',
help='''Exit with error code %d if Infer found
something to report'''
% BUG_FOUND_ERROR_CODE)
% config.BUG_FOUND_ERROR_CODE)
base_group.add_argument('--android-harness', action='store_true',
help='''[experimental] Create harness to detect bugs

@ -0,0 +1,14 @@
# Copyright (c) 2015 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# exit value when infer finds something to report
BUG_FOUND_ERROR_CODE = 2
Loading…
Cancel
Save