diff --git a/engine/static.py b/engine/static.py index aaa932b6..5b5763b7 100644 --- a/engine/static.py +++ b/engine/static.py @@ -193,9 +193,14 @@ def analyse(self, directory=None, task_id=None, project_id=None): print("In Annotation") else: print('In Insert') - r_content = CobraResults.query.filter_by(task_id=task_id, rule_id=rule_id, - file=m_file, - line=m_line).first() + if rule.regex == "": + # Didn't filter line when regex is empty + r_content = CobraResults.query.filter_by(task_id=task_id, rule_id=rule_id, + file=m_file).first() + else: + r_content = CobraResults.query.filter_by(task_id=task_id, rule_id=rule_id, + file=m_file, + line=m_line).first() if r_content is not None: print("Exists Result") else: