Skip to content

Commit

Permalink
tests_rules: fix some pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
regit committed Mar 19, 2023
1 parent dd6a47b commit ad4391e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions suricatals/tests_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def parse_suricata_error_after_7(self, error):
}
error_stream = io.StringIO(error)
wait_line = False
prev_err = None
prev_err = {}
for line in error_stream:
try:
s_err = json.loads(line)
Expand Down Expand Up @@ -238,11 +238,11 @@ def parse_suricata_error_after_7(self, error):
if match:
line_nb = int(match.groups()[0])
if wait_line:
if prev_err is not None:
if prev_err!= {}:
prev_err['engine']['line'] = line_nb - 1
ret['errors'].append(prev_err['engine'])
else:
if prev_err is not None and prev_err['log_level'] == 'Warning':
if prev_err != {} and prev_err['log_level'] == 'Warning':
prev_err['engine']['line'] = line_nb - 1
ret['errors'].append(prev_err['engine'])
else:
Expand Down Expand Up @@ -440,7 +440,7 @@ def rule_buffer(self, rule_buffer, config_buffer=None, related_files=None,
suri_cmd = [self.suricata_binary, '--engine-analysis', '-l', tmpdir, '-S', rule_file, '-c', config_file]
# start suricata in test mode
suriprocess = subprocess.Popen(suri_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(outdata, errdata) = suriprocess.communicate()
(_, errdata) = suriprocess.communicate()
engine_analysis = self.parse_engine_analysis(tmpdir)
for signature in engine_analysis:
for warning in signature.get('warnings', []):
Expand Down

0 comments on commit ad4391e

Please sign in to comment.