diff --git a/bandit/core/manager.py b/bandit/core/manager.py index 4e07517f2..fe20a2dc6 100644 --- a/bandit/core/manager.py +++ b/bandit/core/manager.py @@ -331,12 +331,13 @@ def _parse_file(self, fname, fdata, new_files_list): new_files_list.remove(fname) except Exception as e: LOG.error( - "Exception occurred when executing tests against " - '%s. Run "bandit --debug %s" to see the full ' - "traceback.", + "Exception occurred when executing tests against %s.", fname, fname, ) + if not LOG.isEnabledFor(logging.DEBUG): + LOG.error('Run "bandit --debug %s" to see the full traceback.') + self.skipped.append((fname, "exception while scanning file")) new_files_list.remove(fname) LOG.debug(" Exception string: %s", e)