Skip to content

Commit

Permalink
Merge pull request #544 from ericwb/hidden
Browse files Browse the repository at this point in the history
 Ignore common directories by default
  • Loading branch information
lukehinds committed Jan 20, 2020
2 parents bf2bc42 + 94e95b0 commit c6b1302
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
8 changes: 5 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ Usage::
only show output in the case of an error
--ignore-nosec do not skip lines with # nosec comments
-x EXCLUDED_PATHS, --exclude EXCLUDED_PATHS
comma-separated list of paths (glob patterns supported)
to exclude from scan (note that these are in addition
to the excluded paths provided in the config file)
comma-separated list of paths (glob patterns
supported) to exclude from scan (note that these are
in addition to the excluded paths provided in the
config file) (default:
.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
-b BASELINE, --baseline BASELINE
path of a baseline report to compare against (only
JSON-formatted files are accepted)
Expand Down
10 changes: 6 additions & 4 deletions bandit/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ def main():
)
parser.add_argument(
'-x', '--exclude', dest='excluded_paths', action='store',
default='', help='comma-separated list of paths (glob patterns '
'supported) to exclude from scan '
'(note that these are in addition to the excluded '
'paths provided in the config file)'
default=','.join(constants.EXCLUDE),
help='comma-separated list of paths (glob patterns '
'supported) to exclude from scan '
'(note that these are in addition to the excluded '
'paths provided in the config file) (default: ' +
','.join(constants.EXCLUDE) + ')'
)
parser.add_argument(
'-b', '--baseline', dest='baseline', action='store',
Expand Down
13 changes: 13 additions & 0 deletions bandit/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,16 @@

# override with "log_format" option in config file
log_format_string = '[%(module)s]\t%(levelname)s\t%(message)s'

# Directories to exclude by default
EXCLUDE = (
".svn",
"CVS",
".bzr",
".hg",
".git",
"__pycache__",
".tox",
".eggs",
"*.egg",
)
12 changes: 7 additions & 5 deletions doc/source/man/bandit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ SYNOPSIS
bandit [-h] [-r] [-a {file,vuln}] [-n CONTEXT_LINES] [-c CONFIG_FILE]
[-p PROFILE] [-t TESTS] [-s SKIPS] [-l] [-i]
[-f {csv,custom,html,json,screen,txt,xml,yaml}]
[--msg-template MSG_TEMPLATE] [-o OUTPUT_FILE] [-v] [-d] [-q]
[--msg-template MSG_TEMPLATE] [-o [OUTPUT_FILE]] [-v] [-d] [-q]
[--ignore-nosec] [-x EXCLUDED_PATHS] [-b BASELINE]
[--ini INI_PATH] [--exit-zero] [--version]
targets [targets ...]
[targets [targets ...]]

DESCRIPTION
===========
Expand Down Expand Up @@ -59,9 +59,11 @@ OPTIONS
only show output in the case of an error
--ignore-nosec do not skip lines with # nosec comments
-x EXCLUDED_PATHS, --exclude EXCLUDED_PATHS
comma-separated list of paths (glob patterns supported)
to exclude from scan (note that these are in addition
to the excluded paths provided in the config file)
comma-separated list of paths (glob patterns
supported) to exclude from scan (note that these are
in addition to the excluded paths provided in the
config file) (default:
.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
-b BASELINE, --baseline BASELINE
path of a baseline report to compare against (only
JSON-formatted files are accepted)
Expand Down

0 comments on commit c6b1302

Please sign in to comment.