Skip to content
Snippets Groups Projects
Commit f607cf91 authored by George Marchment's avatar George Marchment
Browse files

Added while upper bound for the while for the extarction of conditions ->...

Added while upper bound for the while for the extarction of conditions -> gonna do the same for the rest of the whiles
parent 7a6cc359
No related branches found
No related tags found
No related merge requests found
Pipeline #14626 failed with stage
in 2 minutes and 9 seconds
......@@ -2,6 +2,8 @@
# CONSTANT VARIABLES
#==========================
WHILE_UPPER_BOUND = 1000000
ERROR_WORDS = ['null', "params", "log", "workflow", "it", "config"]
ERROR_WORDS_ORIGINS = ['channel', 'Channel', 'null', "params", "logs", "workflow", "log",
......
import re
import subprocess
import os
from .constant import WHILE_UPPER_BOUND
from .bioflowinsighterror import BioFlowInsightError
#=============================================================
# THESE A JUST UTILITY FUNCTIONS TO BE ABLE TO MANIPULATE CODE
......@@ -932,7 +935,8 @@ def extract_conditions(code, only_get_inside = True):
triple_single, triple_double = False, False
while(start<len(code)):
timeout = 0
while(start<len(code) and timeout < WHILE_UPPER_BOUND):
checked_triple = False
if(start+3<=len(code)):
if(code[start:start+3]=="'''" and not quote_single and not quote_double and not triple_single and not triple_double):
......@@ -1056,6 +1060,9 @@ def extract_conditions(code, only_get_inside = True):
start = end-1
start+=1
timeout+=1
if(timeout>=WHILE_UPPER_BOUND):
raise BioFlowInsightError("The WHILE_UPPER_BOUND was exceeded. BioFlow-Insight was unable to extarct the conditions. Make sure the workflow uses correct Nextflow syntaxe (https://www.nextflow.io/docs/latest/index.html).", type="Unable to extract conditions")
for c in conditions_dico:
start, end = conditions_dico[c]
return conditions_dico
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment