Remove show_progress_every from Bandit config file
As part of the move to no longer require a configuration file, Bandit will just use a default value from constants.py instead of making this a configurable option. We doubt anybody will miss this incredible, amazing, flexible feature. Change-Id: I6f3ac5185cc3c1f879496052709fb08bf092cad7 Partial-Implements: blueprint config-change
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
# optional: after how many files to update progress
|
||||
#show_progress_every: 100
|
||||
|
||||
# optional: plugins directory name
|
||||
#plugins_dir: plugins
|
||||
|
||||
|
||||
@@ -96,17 +96,9 @@ class BanditConfig():
|
||||
:return: -
|
||||
'''
|
||||
self._settings = {}
|
||||
self._init_progress_increment()
|
||||
self._init_output_colors()
|
||||
self._init_plugin_name_pattern()
|
||||
|
||||
def _init_progress_increment(self):
|
||||
'''Sets settings['progress'] from default or config file.'''
|
||||
progress = constants.progress_increment
|
||||
if self.get_option('show_progress_every'):
|
||||
progress = self.get_option('show_progress_every')
|
||||
self._settings['progress'] = progress
|
||||
|
||||
def _init_output_colors(self):
|
||||
'''Sets the settings colors
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class BanditManager():
|
||||
profile=profile)
|
||||
|
||||
# set the increment of after how many files to show progress
|
||||
self.progress = self.b_conf.get_setting('progress')
|
||||
self.progress = b_constants.progress_increment
|
||||
self.scores = []
|
||||
|
||||
def get_issue_list(self,
|
||||
|
||||
@@ -54,7 +54,6 @@ class TestInit(testtools.TestCase):
|
||||
b_config = config.BanditConfig(f.name)
|
||||
|
||||
# After initialization, can get settings.
|
||||
self.assertEqual(50, b_config.get_setting('progress'))
|
||||
self.assertEqual('', b_config.get_setting('color_HEADER'))
|
||||
self.assertEqual('', b_config.get_setting('color_DEFAULT'))
|
||||
self.assertEqual('', b_config.get_setting('color_LOW'))
|
||||
@@ -82,17 +81,6 @@ class TestInit(testtools.TestCase):
|
||||
self.assertRaisesRegex(
|
||||
utils.ConfigFileInvalidYaml, f.name, config.BanditConfig, f.name)
|
||||
|
||||
def test_progress_conf_setting(self):
|
||||
# The progress setting can be set in bandit.yaml via
|
||||
# show_progress_any.
|
||||
|
||||
example_value = 23
|
||||
sample_yaml = 'show_progress_every: %s' % example_value
|
||||
f = self.useFixture(TempFile(sample_yaml))
|
||||
|
||||
b_config = config.BanditConfig(f.name)
|
||||
self.assertEqual(example_value, b_config.get_setting('progress'))
|
||||
|
||||
def test_colors_isatty_defaults(self):
|
||||
# When stdout says it's a tty there are default colors.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user