add check for default config file

pull/1054/head
Jaime 3 years ago
parent 5abe86304b
commit 570a6227b2
  1. 2
      slither/__main__.py
  2. 6
      slither/utils/command_line.py

@ -462,7 +462,7 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s
help="Provide a config file (default: slither.config.json)", help="Provide a config file (default: slither.config.json)",
action="store", action="store",
dest="config_file", dest="config_file",
default="slither.config.json", default=None,
) )
group_misc.add_argument( group_misc.add_argument(

@ -52,6 +52,12 @@ defaults_flag_in_config = {
def read_config_file(args): def read_config_file(args):
# No config file was provided as an argument
if args.config_file == None:
# Check wether the default config file is present
if not os.path.exists("slither.config.json"):
return
if os.path.isfile(args.config_file): if os.path.isfile(args.config_file):
try: try:
with open(args.config_file, encoding="utf8") as f: with open(args.config_file, encoding="utf8") as f:

Loading…
Cancel
Save