Skip to content

Commit

Permalink
Merge pull request #1054 from crytic/issue-1052
Browse files Browse the repository at this point in the history
add check for default config file
  • Loading branch information
montyly authored Feb 15, 2022
2 parents 57bf155 + 5a0bac0 commit f7b55bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion slither/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
action="store",
dest="config_file",
default="slither.config.json",
default=None,
)

group_misc.add_argument(
Expand Down
9 changes: 9 additions & 0 deletions slither/utils/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@


def read_config_file(args):
# No config file was provided as an argument
if args.config_file is None:
# Check wether the default config file is present
if os.path.exists("slither.config.json"):
# The default file exists, use it
args.config_file = "slither.config.json"
else:
return

if os.path.isfile(args.config_file):
try:
with open(args.config_file, encoding="utf8") as f:
Expand Down

0 comments on commit f7b55bc

Please sign in to comment.