Skip to content

Commit

Permalink
No verify by default (Yelp#166)
Browse files Browse the repository at this point in the history
* No verify by default

* No verify by default
  • Loading branch information
justineyster committed Sep 9, 2020
1 parent c7581a7 commit cf936e3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
31 changes: 25 additions & 6 deletions detect_secrets/core/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,11 @@ def add_use_all_plugins_argument(parser):
)


def add_no_verify_flag(parser):
def add_verify_flag(parser):
parser.add_argument(
'-n',
'--no-verify',
'--verify',
action='store_true',
help='Disables additional verification of secrets via network call.',
help='Enables additional verification of secrets via network call.',
)


Expand Down Expand Up @@ -128,8 +127,10 @@ def add_default_arguments(self):
def add_pre_commit_arguments(self):
self._add_filenames_argument()\
._add_set_baseline_argument()\

add_shared_arguments(self.parser)
._add_exclude_lines_argument()\
._add_word_list_argument()\
._add_use_all_plugins_argument()\
._add_verify_flag()

PluginOptions(self.parser).add_arguments()

Expand Down Expand Up @@ -215,6 +216,22 @@ def _add_set_baseline_argument(self):
)
return self

def _add_exclude_lines_argument(self):
add_exclude_lines_argument(self.parser)
return self

def _add_word_list_argument(self):
add_word_list_argument(self.parser)
return self

def _add_use_all_plugins_argument(self):
add_use_all_plugins_argument(self.parser)
return self

def _add_verify_flag(self):
add_verify_flag(self.parser)
return self


class ScanOptions:

Expand Down Expand Up @@ -269,6 +286,8 @@ def _add_initialize_baseline_argument(self):
help='Scan all files recursively (as compared to only scanning git tracked files).',
)

add_verify_flag(self.parser)

return self

def _add_adhoc_scanning_argument(self):
Expand Down
4 changes: 4 additions & 0 deletions detect_secrets/plugins/common/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,12 @@ def _remove_key(d, key):
plugins_dict,
custom_plugin_paths=args.custom_plugin_paths,
exclude_lines_regex=args.exclude_lines,
<<<<<<< HEAD
automaton=automaton,
should_verify_secrets=not args.no_verify,
=======
should_verify_secrets=args.verify,
>>>>>>> No verify by default (#166)
)

# Use baseline plugin as starting point
Expand Down
4 changes: 4 additions & 0 deletions detect_secrets/pre_commit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ def main(argv=sys.argv[1:]):
plugins_dict=args.plugins,
custom_plugin_paths=args.custom_plugin_paths,
exclude_lines_regex=args.exclude_lines,
<<<<<<< HEAD
automaton=automaton,
should_verify_secrets=not args.no_verify,
=======
should_verify_secrets=args.verify,
>>>>>>> No verify by default (#166)
)

# Merge plugins from baseline
Expand Down

0 comments on commit cf936e3

Please sign in to comment.